From 17d476a9e2345d9f7a5dc42007392bb648f72824 Mon Sep 17 00:00:00 2001 From: Pol Henarejos Date: Thu, 21 Mar 2024 22:01:41 +0100 Subject: [PATCH] Fix crash on PIN change. Signed-off-by: Pol Henarejos --- src/openpgp/openpgp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/openpgp/openpgp.c b/src/openpgp/openpgp.c index 2af286a..8c0e5dd 100644 --- a/src/openpgp/openpgp.c +++ b/src/openpgp/openpgp.c @@ -1021,7 +1021,7 @@ static int cmd_put_data() { if (!tf) { return SW_REFERENCE_NOT_FOUND(); } - uint8_t def[IV_SIZE + 32 + 32 + 32]; + uint8_t def[IV_SIZE + 32 + 32 + 32 + 32]; memcpy(def, file_get_data(tf), file_get_size(tf)); hash_multi(apdu.data, apdu.nc, session_rc); memcpy(def + IV_SIZE + 32, dek + IV_SIZE, 32); @@ -1066,7 +1066,7 @@ static int cmd_change_pin() { if (!tf) { return SW_REFERENCE_NOT_FOUND(); } - uint8_t def[IV_SIZE + 32 + 32 + 32]; + uint8_t def[IV_SIZE + 32 + 32 + 32 + 32]; memcpy(def, file_get_data(tf), file_get_size(tf)); if (P2(apdu) == 0x81) { hash_multi(apdu.data + pin_len, apdu.nc - pin_len, session_pw1); @@ -1125,7 +1125,7 @@ static int cmd_reset_retry() { if (!tf) { return SW_REFERENCE_NOT_FOUND(); } - uint8_t def[IV_SIZE + 32 + 32 + 32]; + uint8_t def[IV_SIZE + 32 + 32 + 32 + 32]; memcpy(def, file_get_data(tf), file_get_size(tf)); hash_multi(apdu.data + (apdu.nc - newpin_len), newpin_len, session_pw1); memcpy(def + IV_SIZE, dek + IV_SIZE, 32);