Skip to content

Commit 09b087d

Browse files
committed
Fix output formatting for unrecognized DESFire card types; detect more DESFire card types
1 parent 9b59204 commit 09b087d

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

client/src/cmdhfmfdes.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,11 @@ static char *getTypeStr(uint8_t type) {
295295
case 0x81:
296296
snprintf(retStr, sizeof(buf), "0x%02X ( " _YELLOW_("Smartcard") " )", type);
297297
break;
298+
case 0x91:
299+
snprintf(retStr, sizeof(buf), "0x%02X ( " _YELLOW_("Applet") " )", type);
300+
break;
298301
default:
302+
snprintf(retStr, sizeof(buf), "0x%02X", type);
299303
break;
300304
}
301305
return buf;
@@ -347,7 +351,9 @@ nxp_cardtype_t getCardType(uint8_t type, uint8_t major, uint8_t minor) {
347351
return DESFIRE_EV2;
348352

349353
// Apple Wallet DESFire Applet
350-
if (type == 0x91 && major == 0x62 && minor == 0x01)
354+
// - v62.1 encountered on iPhone
355+
// - v62.0 encountered on Apple Watch
356+
if (type == 0x91 && major == 0x62 && (minor == 0x01 || minor == 0x00))
351357
return DESFIRE_EV2;
352358

353359
// Plus EV1
@@ -747,7 +753,7 @@ static int CmdHF14ADesInfo(const char *Cmd) {
747753
PrintAndLogEx(INFO, " raw: %s", sprint_hex_inrow(info.versionHW, sizeof(info.versionHW)));
748754

749755
PrintAndLogEx(INFO, " Vendor Id: " _YELLOW_("%s"), getTagInfo(info.versionHW[0]));
750-
PrintAndLogEx(INFO, " Type: %s", getTypeStr(info.versionHW[1]));
756+
PrintAndLogEx(INFO, " Type: " _YELLOW_("%s"), getTypeStr(info.versionHW[1]));
751757
PrintAndLogEx(INFO, " Subtype: " _YELLOW_("0x%02X"), info.versionHW[2]);
752758
PrintAndLogEx(INFO, " Version: %s", getVersionStr(info.versionHW[1], info.versionHW[3], info.versionHW[4]));
753759
PrintAndLogEx(INFO, " Storage size: %s", getCardSizeStr(info.versionHW[5]));
@@ -756,7 +762,7 @@ static int CmdHF14ADesInfo(const char *Cmd) {
756762
PrintAndLogEx(INFO, "--- " _CYAN_("Software Information"));
757763
PrintAndLogEx(INFO, " raw: %s", sprint_hex_inrow(info.versionSW, sizeof(info.versionSW)));
758764
PrintAndLogEx(INFO, " Vendor Id: " _YELLOW_("%s"), getTagInfo(info.versionSW[0]));
759-
PrintAndLogEx(INFO, " Type: %s", getTypeStr(info.versionSW[1]));
765+
PrintAndLogEx(INFO, " Type: " _YELLOW_("%s"), getTypeStr(info.versionSW[1]));
760766
PrintAndLogEx(INFO, " Subtype: " _YELLOW_("0x%02X"), info.versionSW[2]);
761767
PrintAndLogEx(INFO, " Version: " _YELLOW_("%d.%d"), info.versionSW[3], info.versionSW[4]);
762768
PrintAndLogEx(INFO, " Storage size: %s", getCardSizeStr(info.versionSW[5]));

0 commit comments

Comments
 (0)