From e17f86d1454e200a7242282eba4cf25131d00184 Mon Sep 17 00:00:00 2001 From: Sean Parkinson Date: Wed, 14 Jun 2023 08:05:57 +1000 Subject: [PATCH] TFM: fix big endian reading a zero length buffer Bail early as big endian implementation doesn't handle it. --- wolfcrypt/src/tfm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wolfcrypt/src/tfm.c b/wolfcrypt/src/tfm.c index 1ab156a24..99be4217e 100644 --- a/wolfcrypt/src/tfm.c +++ b/wolfcrypt/src/tfm.c @@ -3697,6 +3697,10 @@ int fp_read_unsigned_bin(fp_int *a, const unsigned char *b, int c) /* zero the int */ fp_zero (a); + if (c == 0) { + return FP_OKAY; + } + /* if input b excess max, then truncate */ if (c > 0 && (word32)c > maxC) { int excess = (c - maxC);