check mode in ev2 like ev1
This commit is contained in:
1 parent
fd5afbdfac
commit
645985a1f9
2 files changed
+11
-2
No files matched your search
@@ -347,7 +347,7 @@ void DesfirePrintContext(DesfireContext *ctx) {
|
||||
desfire_get_key_block_length(ctx->keyType),
|
||||
sprint_hex(ctx->IV, desfire_get_key_block_length(ctx->keyType)));
|
||||
if (ctx->secureChannel == DACEV2) {
|
||||
PrintAndLogEx(INFO, " TI: %s cmdCntr: 0x%08x",
|
||||
PrintAndLogEx(INFO, " TI: %s cmdCntr: 0x%04x",
|
||||
sprint_hex(ctx->TI, 4),
|
||||
ctx->cmdCntr);
|
||||
}
|
||||
|
||||
@@ -256,7 +256,7 @@ static void DesfireSecureChannelEncodeEV2(DesfireContext *ctx, uint8_t cmd, uint
|
||||
|
||||
if (ctx->commMode == DCMMACed || ctx->commMode == DCMEncrypted) {
|
||||
uint8_t cmac[DESFIRE_MAX_CRYPTO_BLOCK_SIZE] = {0};
|
||||
DesfireEV2CalcCMAC(ctx, cmd, data, srcdatalen, cmac);
|
||||
DesfireEV2CalcCMAC(ctx, cmd, srcdata, srcdatalen, cmac);
|
||||
|
||||
memcpy(&dstdata[srcdatalen], cmac, DesfireGetMACLength(ctx));
|
||||
*dstdatalen = srcdatalen + DesfireGetMACLength(ctx);
|
||||
@@ -515,6 +515,15 @@ bool PrintChannelModeWarning(uint8_t cmd, DesfireSecureChannel secureChannel, De
|
||||
break;
|
||||
}
|
||||
|
||||
// ev2 like ev1
|
||||
if (secureChannel == DACEV2 &&
|
||||
AllowedChannelModes[i].secureChannel == DACEV1 &&
|
||||
(AllowedChannelModes[i].cmdSet == cmdSet || (AllowedChannelModes[i].cmdSet == DCCNative && cmdSet == DCCNativeISO)) &&
|
||||
AllowedChannelModes[i].commMode == commMode) {
|
||||
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
|
||||
Reference in new issue
Block a user