Fix an issue when the RNG gives all 0 (or if it fails and the stack buffer contained all 0).

This commit is contained in:
Ken MacKay
2014-03-09 11:33:56 -07:00
parent 5b9e310b34
commit 3122cc6c7c
+1 -1
View File
@@ -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);