From 1f8e21dda74c45dd3b284c1c5909b5b10f4aaeff Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Mon, 9 Nov 2026 14:30:13 +0700 Subject: [PATCH] trace extract: tell 2TDEA from 3TDEA by the challenge length The ISO auth branch took a tag reply longer than 20 bytes as 3TDEA. A native 3TDEA reply is 20 bytes, so it was shown as 2TDEA with half the challenge. Use what is left after the framing, SW and CRC instead. Co-Authored-By: Claude Opus 5.5 --- client/src/cmdtrace.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/src/cmdtrace.c b/client/src/cmdtrace.c index 033202224..44083e29e 100644 --- a/client/src/cmdtrace.c +++ b/client/src/cmdtrace.c @@ -471,8 +471,10 @@ static uint16_t extractChallenges(uint16_t tracepos, uint16_t traceLen, uint8_t break; } + // wrapped replies end with SW 91 AF before the CRC + uint8_t sw_len = (long_jmp == 1) ? 0 : 2; uint8_t tdea = 8; - if (next_hdr->data_len > 20) { + if (next_hdr->data_len >= cpos + 16 + sw_len + 2) { tdea = 16; PrintAndLogEx(INFO, "3TDEA 1499999999 %s " NOLF, sprint_hex_inrow(next_hdr->frame + cpos, tdea)); } else {