diff --git a/wolfcrypt/src/ecc.c b/wolfcrypt/src/ecc.c index 332b89c4d..67e0cab51 100644 --- a/wolfcrypt/src/ecc.c +++ b/wolfcrypt/src/ecc.c @@ -8003,15 +8003,15 @@ int wc_ecc_rs_to_sig(const char* r, const char* s, byte* out, word32* outlen) if (err == MP_OKAY) err = mp_read_radix(stmp, s, MP_RADIX_HEX); - /* convert mp_ints to ECDSA sig, initializes rtmp and stmp internally */ - if (err == MP_OKAY) - err = StoreECC_DSA_Sig(out, outlen, rtmp, stmp); - if (err == MP_OKAY) { if (mp_iszero(rtmp) == MP_YES || mp_iszero(stmp) == MP_YES) err = MP_ZERO_E; } + /* convert mp_ints to ECDSA sig, initializes rtmp and stmp internally */ + if (err == MP_OKAY) + err = StoreECC_DSA_Sig(out, outlen, rtmp, stmp); + mp_clear(rtmp); mp_clear(stmp); #ifdef WOLFSSL_SMALL_STACK