Add wc_ecc_set_rng to ecdh_gen_secret
parent
ec737760ba
commit
3c14ef823a
|
@ -86,9 +86,20 @@ int do_ecc(void)
|
||||||
ret = wc_ecc_make_key(&rng, ECC_256_BIT_FIELD, &AliceKey);
|
ret = wc_ecc_make_key(&rng, ECC_256_BIT_FIELD, &AliceKey);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
goto all_three;
|
goto all_three;
|
||||||
|
#ifdef ECC_TIMING_RESISTANT
|
||||||
|
ret = wc_ecc_set_rng(&AliceKey, &rng);
|
||||||
|
if (ret != 0)
|
||||||
|
goto all_three;
|
||||||
|
#endif
|
||||||
|
|
||||||
ret = wc_ecc_make_key(&rng, ECC_256_BIT_FIELD, &BobKey);
|
ret = wc_ecc_make_key(&rng, ECC_256_BIT_FIELD, &BobKey);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
goto all_three;
|
goto all_three;
|
||||||
|
#ifdef ECC_TIMING_RESISTANT
|
||||||
|
ret = wc_ecc_set_rng(&BobKey, &rng);
|
||||||
|
if (ret != 0)
|
||||||
|
goto all_three;
|
||||||
|
#endif
|
||||||
|
|
||||||
secretLen = ECC_256_BIT_FIELD; /* explicit set */
|
secretLen = ECC_256_BIT_FIELD; /* explicit set */
|
||||||
ret = wc_ecc_shared_secret(&AliceKey, &BobKey, AliceSecret, &secretLen);
|
ret = wc_ecc_shared_secret(&AliceKey, &BobKey, AliceSecret, &secretLen);
|
||||||
|
|
Loading…
Reference in New Issue