From 5ecfb002cf066d3e583f1bbaff48e93acd539b1d Mon Sep 17 00:00:00 2001 From: Ryad Benadjila Date: Wed, 28 Feb 2024 09:43:52 +0100 Subject: [PATCH] Fix a missing BGT in the T=1 loop (see https://github.com/wookey-project/libiso7816/issues/13 for the discussion). --- Src/iso7816/smartcard_iso7816.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Src/iso7816/smartcard_iso7816.c b/Src/iso7816/smartcard_iso7816.c index e7d9b32..88ba5dc 100644 --- a/Src/iso7816/smartcard_iso7816.c +++ b/Src/iso7816/smartcard_iso7816.c @@ -2017,6 +2017,8 @@ static int SC_send_APDU_T1(SC_APDU_cmd* apdu, SC_APDU_resp* resp, SC_ATR* atr) log_printf("[Smartcard T=1] Unexpected case: received other block than expected RBLOCK, or bad sequence number ...\r\n"); goto err; } + /* Wait for BGT as we will send the next block after looping */ + SC_delay_etu(BGT_block_guard_time); /* Wait for the standardized Block Guard Time (22 ETU by default) */ } else{ /* This is the last block, we should receive at least one I type block with a last I Block received sequence + 1 value