From 10561e99695c196f4b9d75213fe69ca1bfb7b46a Mon Sep 17 00:00:00 2001 From: merlokk <807634+merlokk@users.noreply.github.com> Date: Fri, 20 Aug 2021 23:59:11 +0300 Subject: [PATCH] move transaction counter --- client/src/cmdhfmfdes.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/client/src/cmdhfmfdes.c b/client/src/cmdhfmfdes.c index 5b09192d1..2e4ddf173 100644 --- a/client/src/cmdhfmfdes.c +++ b/client/src/cmdhfmfdes.c @@ -4624,16 +4624,15 @@ static int DesfileReadFileAndPrint(DesfireContext *dctx, uint8_t fnum, int filet PrintAndLogEx(WARNING, "Read wrong %zu bytes from file 0x%02x offset %u", resplen, fnum, offset); print_buffer_with_offset(resp, resplen, offset, true); } else { + uint32_t cnt = MemLeToUint4byte(&resp[0]); + transactionCounter = cnt; if (dctx->secureChannel != DACLRP) { - uint32_t cnt = MemLeToUint4byte(&resp[0]); - transactionCounter = cnt; PrintAndLogEx(SUCCESS, "Transaction counter: %d (0x%08x)", cnt, cnt); } else { // For composing TMC the two subparts are concatenated as follows: actTMC || sesTMC. Both subparts are represented LSB first. // MF2DLHX0.pdf, 10.3.2.1 Transaction MAC Counter, page 41 uint32_t actTMC = MemLeToUint2byte(&resp[0]); uint32_t sessTMC = MemLeToUint2byte(&resp[2]); - transactionCounter = actTMC; PrintAndLogEx(SUCCESS, "Session tr counter : %d (0x%08x)", sessTMC, sessTMC); PrintAndLogEx(SUCCESS, "Actual tr counter : %d (0x%08x)", actTMC, actTMC); }