Skip to content

Commit 3c14ef8

Browse files
committed
Add wc_ecc_set_rng to ecdh_gen_secret
1 parent ec73776 commit 3c14ef8

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

pk/ecdh_generate_secret/ecdh_gen_secret.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,20 @@ int do_ecc(void)
8686
ret = wc_ecc_make_key(&rng, ECC_256_BIT_FIELD, &AliceKey);
8787
if (ret != 0)
8888
goto all_three;
89+
#ifdef ECC_TIMING_RESISTANT
90+
ret = wc_ecc_set_rng(&AliceKey, &rng);
91+
if (ret != 0)
92+
goto all_three;
93+
#endif
94+
8995
ret = wc_ecc_make_key(&rng, ECC_256_BIT_FIELD, &BobKey);
9096
if (ret != 0)
9197
goto all_three;
98+
#ifdef ECC_TIMING_RESISTANT
99+
ret = wc_ecc_set_rng(&BobKey, &rng);
100+
if (ret != 0)
101+
goto all_three;
102+
#endif
92103

93104
secretLen = ECC_256_BIT_FIELD; /* explicit set */
94105
ret = wc_ecc_shared_secret(&AliceKey, &BobKey, AliceSecret, &secretLen);

0 commit comments

Comments
 (0)