From 3122cc6c7c7c42c65b989cade7ac57851fbe548a Mon Sep 17 00:00:00 2001 From: Ken MacKay Date: Sun, 9 Mar 2014 11:33:56 -0700 Subject: [PATCH] Fix an issue when the RNG gives all 0 (or if it fails and the stack buffer contained all 0). --- ecc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ecc.c b/ecc.c index 0d81a93..bed782e 100644 --- a/ecc.c +++ b/ecc.c @@ -4354,7 +4354,7 @@ int ecdh_shared_secret(const uint8_t p_publicKey[ECC_BYTES*2], const uint8_t p_p vli_flip(l_public.y, p_publicKey + ECC_BYTES); EccPoint l_product; - EccPoint_mult(&l_product, &l_public, l_private, l_random); + EccPoint_mult(&l_product, &l_public, l_private, (vli_isZero(l_random) ? 0: l_random)); vli_flip(p_secret, l_product.x);