From cddf89ca4cdee9e1004eac8c7549a7942f9f1886 Mon Sep 17 00:00:00 2001 From: merlokk <807634+merlokk@users.noreply.github.com> Date: Fri, 30 Jul 2021 00:35:14 +0300 Subject: [PATCH] verbosity --- client/src/mifare/desfirecore.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/client/src/mifare/desfirecore.c b/client/src/mifare/desfirecore.c index 9476825b7..7b6750cc0 100644 --- a/client/src/mifare/desfirecore.c +++ b/client/src/mifare/desfirecore.c @@ -266,6 +266,12 @@ void DesfirePrintContext(DesfireContext *ctx) { PrintAndLogEx(INFO, " IV [%zu]: %s", 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 cnTX: 0x%08x cnRx: 0x%08x", + sprint_hex(ctx->TI, 4), + ctx->cntrTx, + ctx->cntrRx); + } } } @@ -1128,10 +1134,6 @@ PrintAndLogEx(INFO, "EncBoth: %s", sprint_hex(both, CRYPTO_AES_BLOCK_SIZE * 2)); // Part 4 memcpy(encRndA, recv_data, CRYPTO_AES_BLOCK_SIZE); - - //struct desfire_key sesskey = {0}; - //Desfire_session_key_new(RndA, RndB, key, &sesskey); - //memcpy(dctx->sessionKeyEnc, sesskey.data, desfire_get_key_length(dctx->keyType)); PrintAndLogEx(INFO, "encRndA : %s", sprint_hex(encRndA, CRYPTO_AES_BLOCK_SIZE)); PrintAndLogEx(INFO, "IV : %s", sprint_hex(IV, CRYPTO_AES_BLOCK_SIZE)); @@ -1155,7 +1157,15 @@ PrintAndLogEx(INFO, "Generated_RndA : %s", sprint_hex(&data[4], CRYPTO_AES_BLOCK } return 11; } + + if (verbose) { + PrintAndLogEx(INFO, " TI: %s", sprint_hex(data, 4)); + PrintAndLogEx(INFO, "pic: %s", sprint_hex(&data[20], 6)); + PrintAndLogEx(INFO, "pcd: %s", sprint_hex(&data[26], 6)); + } + dctx->cntrRx = 0; + dctx->cntrTx = 0; memcpy(dctx->TI, data, 4); memset(dctx->IV, 0, DESFIRE_MAX_KEY_SIZE); dctx->secureChannel = secureChannel;