From e9bbf892870c98adc57d1b037d3fc773e6a82a00 Mon Sep 17 00:00:00 2001 From: David Garske Date: Tue, 14 Jan 2020 14:13:12 -0800 Subject: [PATCH] Fix for `WOLFSSL_ECDSA_SET_K` with normal math. The sign_k mp_int was not initialized. --- wolfcrypt/src/ecc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wolfcrypt/src/ecc.c b/wolfcrypt/src/ecc.c index e4aec5380..aeca14cc2 100644 --- a/wolfcrypt/src/ecc.c +++ b/wolfcrypt/src/ecc.c @@ -5118,9 +5118,15 @@ int wc_ecc_sign_set_k(const byte* k, word32 klen, ecc_key* key) if (key->sign_k == NULL) { ret = MEMORY_E; } + else { + XMEMSET(key->sign_k, 0, sizeof(mp_int)); + } } } + if (ret == 0) { + ret = mp_init(key->sign_k); + } if (ret == 0) { ret = mp_read_unsigned_bin(key->sign_k, k, klen); }