Skip to content

Commit

Permalink
ltc: ctr: fix counter increment when LTC_FAST is defined
Browse files Browse the repository at this point in the history
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 <jork.loeser@microsoft.com>
Closes: https://lists.trustedfirmware.org/archives/list/op-tee@lists.trustedfirmware.org/thread/J4MMZPCM2MNKC2KWAXZUMTVEJP56U6OI/
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
  • Loading branch information
jforissier committed Jan 27, 2025
1 parent a54dc52 commit d3dcaf5
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions core/lib/libtomcrypt/src/modes/ctr/ctr_encrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d3dcaf5

Please sign in to comment.