From d1957bb3a58f8b0a412dc07aa4b37b68105c8b02 Mon Sep 17 00:00:00 2001 From: Jerome Forissier Date: Fri, 24 Jan 2025 11:21:12 +0100 Subject: [PATCH] ltc: ctr: fix counter increment when LTC_FAST is defined In CTR mode the counter needs to be incremented upon completion of each block. Unfortunately, if there is no crypto acceleration (accel_ctr_encrypt == NULL) and if LTC_FAST is defined, this does not happen. Add the missing call to fix the issue. Reported-by: Jork Loeser Closes: https://lists.trustedfirmware.org/archives/list/op-tee@lists.trustedfirmware.org/thread/J4MMZPCM2MNKC2KWAXZUMTVEJP56U6OI/ Signed-off-by: Jerome Forissier Acked-by: Jens Wiklander --- core/lib/libtomcrypt/src/modes/ctr/ctr_encrypt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/core/lib/libtomcrypt/src/modes/ctr/ctr_encrypt.c b/core/lib/libtomcrypt/src/modes/ctr/ctr_encrypt.c index 5ef6915248a..b19e12cc355 100644 --- a/core/lib/libtomcrypt/src/modes/ctr/ctr_encrypt.c +++ b/core/lib/libtomcrypt/src/modes/ctr/ctr_encrypt.c @@ -61,6 +61,7 @@ static int s_ctr_encrypt(const unsigned char *pt, unsigned char *ct, unsigned lo ct += ctr->blocklen; len -= ctr->blocklen; ctr->padlen = ctr->blocklen; + s_ctr_increment_counter(ctr); continue; } #endif