From 52e6ff7c5602ef93210aaa679666d8336bedda4a Mon Sep 17 00:00:00 2001 From: Guido Vranken Date: Tue, 6 Apr 2021 01:34:09 +0200 Subject: [PATCH] Account for sp_sqr failure in _sp_exptmod_nct ZD 12039 --- wolfcrypt/src/sp_int.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wolfcrypt/src/sp_int.c b/wolfcrypt/src/sp_int.c index d22dd82bc..bd94e9d00 100644 --- a/wolfcrypt/src/sp_int.c +++ b/wolfcrypt/src/sp_int.c @@ -8874,7 +8874,7 @@ static int _sp_exptmod_nct(sp_int* b, sp_int* e, sp_int* m, sp_int* r) /* Sqaure until we find bit that is 1 or there's less than a * window of bits left. */ - while ((i >= 0) || (c >= winBits)) { + while (err == MP_OKAY && ((i >= 0) || (c >= winBits))) { sp_digit n2 = n; int c2 = c; int i2 = i;