diff --git a/wolfcrypt/src/sp_int.c b/wolfcrypt/src/sp_int.c index 763ec1f8f..ad74b1dc2 100644 --- a/wolfcrypt/src/sp_int.c +++ b/wolfcrypt/src/sp_int.c @@ -7121,7 +7121,7 @@ int sp_div(sp_int* a, sp_int* d, sp_int* r, sp_int* rem) } } - if (!done) { + if ((!done) && (err == MP_OKAY)) { #if (defined(WOLFSSL_SMALL_STACK) || defined(SP_ALLOC)) && \ !defined(WOLFSSL_SP_NO_MALLOC) int cnt = 4;