From f8fd3f8bc15f2316ea6921fb5e5b87e0fb011481 Mon Sep 17 00:00:00 2001 From: Chris Conlon Date: Thu, 19 Nov 2020 14:35:35 -0700 Subject: [PATCH] wc_ecc_rs_to_sig: check r,s for zero before StoreECC_DSA_Sig() --- wolfcrypt/src/ecc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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