mirror of
https://github.com/kmackay/micro-ecc.git
synced 2026-08-01 16:17:46 +00:00
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:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user