From d6935ed3be8ea4c710d1fb87056b26cf2b58ac13 Mon Sep 17 00:00:00 2001 From: Tesfa Mael Date: Tue, 17 May 2022 09:21:20 -0700 Subject: [PATCH] Review comments --- wolfcrypt/src/rsa.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wolfcrypt/src/rsa.c b/wolfcrypt/src/rsa.c index 58ee2b28e..b6a445005 100644 --- a/wolfcrypt/src/rsa.c +++ b/wolfcrypt/src/rsa.c @@ -886,14 +886,15 @@ static int RsaMGF1(enum wc_HashType hType, byte* seed, word32 seedSz, /* find largest amount of memory needed which will be the max of * hLen and (seedSz + 4) since tmp is used to store the hash digest */ tmpSz = ((seedSz + 4) > (word32)hLen)? seedSz + 4: (word32)hLen; - if (tmpSz > RSA_MAX_SIZE/8) - return BAD_FUNC_ARG; #if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC) tmp = (byte*)XMALLOC(tmpSz, heap, DYNAMIC_TYPE_RSA_BUFFER); if (tmp == NULL) { return MEMORY_E; } tmpF = 1; /* make sure to free memory when done */ +#else + if (tmpSz > RSA_MAX_SIZE/8) + return BAD_FUNC_ARG; #endif } else {