mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-22 14:23:50 -07:00
check mode in ev2 like ev1
This commit is contained in:
parent
fd5afbdfac
commit
645985a1f9
2 changed files with 11 additions and 2 deletions
|
@ -347,7 +347,7 @@ void DesfirePrintContext(DesfireContext *ctx) {
|
||||||
desfire_get_key_block_length(ctx->keyType),
|
desfire_get_key_block_length(ctx->keyType),
|
||||||
sprint_hex(ctx->IV, desfire_get_key_block_length(ctx->keyType)));
|
sprint_hex(ctx->IV, desfire_get_key_block_length(ctx->keyType)));
|
||||||
if (ctx->secureChannel == DACEV2) {
|
if (ctx->secureChannel == DACEV2) {
|
||||||
PrintAndLogEx(INFO, " TI: %s cmdCntr: 0x%08x",
|
PrintAndLogEx(INFO, " TI: %s cmdCntr: 0x%04x",
|
||||||
sprint_hex(ctx->TI, 4),
|
sprint_hex(ctx->TI, 4),
|
||||||
ctx->cmdCntr);
|
ctx->cmdCntr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -256,7 +256,7 @@ static void DesfireSecureChannelEncodeEV2(DesfireContext *ctx, uint8_t cmd, uint
|
||||||
|
|
||||||
if (ctx->commMode == DCMMACed || ctx->commMode == DCMEncrypted) {
|
if (ctx->commMode == DCMMACed || ctx->commMode == DCMEncrypted) {
|
||||||
uint8_t cmac[DESFIRE_MAX_CRYPTO_BLOCK_SIZE] = {0};
|
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));
|
memcpy(&dstdata[srcdatalen], cmac, DesfireGetMACLength(ctx));
|
||||||
*dstdatalen = srcdatalen + DesfireGetMACLength(ctx);
|
*dstdatalen = srcdatalen + DesfireGetMACLength(ctx);
|
||||||
|
@ -515,6 +515,15 @@ bool PrintChannelModeWarning(uint8_t cmd, DesfireSecureChannel secureChannel, De
|
||||||
break;
|
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)
|
if (!found)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue