Skip to content
This repository was archived by the owner on Mar 5, 2024. It is now read-only.

Commit 3db4aa9

Browse files
committed
enabling side-channel countermeasure for EC-DH
1 parent 87d74dd commit 3db4aa9

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

lib/source/ecc_dh.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,6 @@
6060
#include <tinycrypt/utils.h>
6161
#include <string.h>
6262

63-
#if default_RNG_defined
64-
static uECC_RNG_Function g_rng_function = &default_CSPRNG;
65-
#else
66-
static uECC_RNG_Function g_rng_function = 0;
67-
#endif
68-
6963
int uECC_make_key_with_d(uint8_t *public_key, uint8_t *private_key,
7064
unsigned int *d, uECC_Curve curve)
7165
{
@@ -174,7 +168,7 @@ int uECC_shared_secret(const uint8_t *public_key, const uint8_t *private_key,
174168

175169
/* If an RNG function was specified, try to get a random initial Z value to
176170
* improve protection against side-channel attacks. */
177-
if (g_rng_function) {
171+
if (uECC_get_rng()) {
178172
if (!uECC_generate_random_int(p2[carry], curve->p, num_words)) {
179173
r = 0;
180174
goto clear_and_out;

0 commit comments

Comments
 (0)