mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-23 22:55:37 -07:00
add rx mac print if OK
This commit is contained in:
parent
bf59d29919
commit
c3a5a45d37
1 changed files with 10 additions and 1 deletions
|
@ -324,6 +324,8 @@ static void DesfireSecureChannelDecodeD40(DesfireContext *ctx, uint8_t *srcdata,
|
||||||
|
|
||||||
if (memcmp(mac, &srcdata[srcdatalen - maclen], maclen) == 0) {
|
if (memcmp(mac, &srcdata[srcdatalen - maclen], maclen) == 0) {
|
||||||
*dstdatalen = srcdatalen - maclen;
|
*dstdatalen = srcdatalen - maclen;
|
||||||
|
if (GetAPDULogging())
|
||||||
|
PrintAndLogEx(INFO, "Received MAC OK");
|
||||||
} else {
|
} else {
|
||||||
PrintAndLogEx(WARNING, "Received MAC is not match with calculated");
|
PrintAndLogEx(WARNING, "Received MAC is not match with calculated");
|
||||||
//PrintAndLogEx(INFO, " received MAC: %s", sprint_hex(&srcdata[srcdatalen - maclen], maclen));
|
//PrintAndLogEx(INFO, " received MAC: %s", sprint_hex(&srcdata[srcdatalen - maclen], maclen));
|
||||||
|
@ -383,6 +385,9 @@ static void DesfireSecureChannelDecodeEV1(DesfireContext *ctx, uint8_t *srcdata,
|
||||||
PrintAndLogEx(WARNING, "Received MAC is not match with calculated");
|
PrintAndLogEx(WARNING, "Received MAC is not match with calculated");
|
||||||
PrintAndLogEx(INFO, " received MAC: %s", sprint_hex(&srcdata[*dstdatalen], desfire_get_key_block_length(ctx->keyType)));
|
PrintAndLogEx(INFO, " received MAC: %s", sprint_hex(&srcdata[*dstdatalen], desfire_get_key_block_length(ctx->keyType)));
|
||||||
PrintAndLogEx(INFO, " calculated MAC: %s", sprint_hex(cmac, desfire_get_key_block_length(ctx->keyType)));
|
PrintAndLogEx(INFO, " calculated MAC: %s", sprint_hex(cmac, desfire_get_key_block_length(ctx->keyType)));
|
||||||
|
} else {
|
||||||
|
if (GetAPDULogging())
|
||||||
|
PrintAndLogEx(INFO, "Received MAC OK");
|
||||||
}
|
}
|
||||||
} else if (ctx->commMode == DCMEncrypted) {
|
} else if (ctx->commMode == DCMEncrypted) {
|
||||||
if (srcdatalen < desfire_get_key_block_length(ctx->keyType)) {
|
if (srcdatalen < desfire_get_key_block_length(ctx->keyType)) {
|
||||||
|
@ -432,6 +437,9 @@ static void DesfireSecureChannelDecodeEV2(DesfireContext *ctx, uint8_t *srcdata,
|
||||||
PrintAndLogEx(WARNING, "Received MAC is not match with calculated");
|
PrintAndLogEx(WARNING, "Received MAC is not match with calculated");
|
||||||
PrintAndLogEx(INFO, " received MAC: %s", sprint_hex(&srcdata[*dstdatalen], desfire_get_key_block_length(ctx->keyType)));
|
PrintAndLogEx(INFO, " received MAC: %s", sprint_hex(&srcdata[*dstdatalen], desfire_get_key_block_length(ctx->keyType)));
|
||||||
PrintAndLogEx(INFO, " calculated MAC: %s", sprint_hex(cmac, desfire_get_key_block_length(ctx->keyType)));
|
PrintAndLogEx(INFO, " calculated MAC: %s", sprint_hex(cmac, desfire_get_key_block_length(ctx->keyType)));
|
||||||
|
} else {
|
||||||
|
if (GetAPDULogging())
|
||||||
|
PrintAndLogEx(INFO, "Received MAC OK");
|
||||||
}
|
}
|
||||||
} else if (ctx->commMode == DCMEncrypted) {
|
} else if (ctx->commMode == DCMEncrypted) {
|
||||||
if (srcdatalen < desfire_get_key_block_length(ctx->keyType) + DesfireGetMACLength(ctx)) {
|
if (srcdatalen < desfire_get_key_block_length(ctx->keyType) + DesfireGetMACLength(ctx)) {
|
||||||
|
@ -447,7 +455,8 @@ static void DesfireSecureChannelDecodeEV2(DesfireContext *ctx, uint8_t *srcdata,
|
||||||
PrintAndLogEx(INFO, " received MAC: %s", sprint_hex(&srcdata[*dstdatalen], desfire_get_key_block_length(ctx->keyType)));
|
PrintAndLogEx(INFO, " received MAC: %s", sprint_hex(&srcdata[*dstdatalen], desfire_get_key_block_length(ctx->keyType)));
|
||||||
PrintAndLogEx(INFO, " calculated MAC: %s", sprint_hex(cmac, desfire_get_key_block_length(ctx->keyType)));
|
PrintAndLogEx(INFO, " calculated MAC: %s", sprint_hex(cmac, desfire_get_key_block_length(ctx->keyType)));
|
||||||
} else {
|
} else {
|
||||||
//PrintAndLogEx(INFO, "Received MAC OK");
|
if (GetAPDULogging())
|
||||||
|
PrintAndLogEx(INFO, "Received MAC OK");
|
||||||
}
|
}
|
||||||
|
|
||||||
DesfireEV2FillIV(ctx, false, NULL); // fill response IV to ctx
|
DesfireEV2FillIV(ctx, false, NULL); // fill response IV to ctx
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue