Skip to content

Commit

Permalink
Avoid clearing out-of-bound bytes when producing secret keys
Browse files Browse the repository at this point in the history
  • Loading branch information
patricklonga committed Jul 1, 2019
1 parent 6b6e0ad commit 5ca332a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/test_sidh.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
int cryptotest_kex()
{ // Testing key exchange
unsigned int i;
unsigned char PrivateKeyA[SIDH_SECRETKEYBYTES], PrivateKeyB[SIDH_SECRETKEYBYTES];
unsigned char PrivateKeyA[SIDH_SECRETKEYBYTES_A], PrivateKeyB[SIDH_SECRETKEYBYTES_B];
unsigned char PublicKeyA[SIDH_PUBLICKEYBYTES], PublicKeyB[SIDH_PUBLICKEYBYTES];
unsigned char SharedSecretA[SIDH_BYTES], SharedSecretB[SIDH_BYTES];
bool passed = true;
Expand Down Expand Up @@ -53,14 +53,17 @@ int cryptotest_kex()
int cryptorun_kex()
{ // Benchmarking key exchange
unsigned int n;
unsigned char PrivateKeyA[SIDH_SECRETKEYBYTES], PrivateKeyB[SIDH_SECRETKEYBYTES];
unsigned char PrivateKeyA[SIDH_SECRETKEYBYTES_A], PrivateKeyB[SIDH_SECRETKEYBYTES_B];
unsigned char PublicKeyA[SIDH_PUBLICKEYBYTES], PublicKeyB[SIDH_PUBLICKEYBYTES];
unsigned char SharedSecretA[SIDH_BYTES], SharedSecretB[SIDH_BYTES];
unsigned long long cycles, cycles1, cycles2;

printf("\n\nBENCHMARKING EPHEMERAL ISOGENY-BASED KEY EXCHANGE SYSTEM %s\n", SCHEME_NAME);
printf("--------------------------------------------------------------------------------------------------------\n\n");

random_mod_order_A(PrivateKeyA);
random_mod_order_B(PrivateKeyB);

// Benchmarking Alice's key generation
cycles = 0;
for (n = 0; n < BENCH_LOOPS; n++)
Expand Down

0 comments on commit 5ca332a

Please sign in to comment.