From 1264c0742cdfa808b4cd5cd6704e7cce4b39d177 Mon Sep 17 00:00:00 2001 From: toddouska Date: Thu, 10 Jul 2014 11:14:22 -0700 Subject: [PATCH 1/2] make sure ntru benchmark pub key size init --- ctaocrypt/benchmark/benchmark.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ctaocrypt/benchmark/benchmark.c b/ctaocrypt/benchmark/benchmark.c index 604782480..00ac9d220 100644 --- a/ctaocrypt/benchmark/benchmark.c +++ b/ctaocrypt/benchmark/benchmark.c @@ -1062,7 +1062,7 @@ void bench_ntruKeyGen(void) int i; byte public_key[5951]; /* 2048 key equivalent to rsa */ - word16 public_key_len; + word16 public_key_len = sizeof(public_key); byte private_key[5951]; word16 private_key_len = sizeof(private_key); @@ -1071,8 +1071,8 @@ void bench_ntruKeyGen(void) 'C', 'y', 'a', 'S', 'S', 'L', ' ', 't', 'e', 's', 't' }; - word32 rc = ntru_crypto_drbg_instantiate(112, pers_str, sizeof(pers_str), GetEntropy, &drbg); - + word32 rc = ntru_crypto_drbg_instantiate(112, pers_str, sizeof(pers_str), + GetEntropy, &drbg); if(rc != DRBG_OK) { printf("NTRU drbg instantiate failed\n"); return; From 4d969d2850210c856d1818178aad61cc28aab5c9 Mon Sep 17 00:00:00 2001 From: toddouska Date: Thu, 10 Jul 2014 11:47:05 -0700 Subject: [PATCH 2/2] reduce ntru benchmark stack use --- ctaocrypt/benchmark/benchmark.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ctaocrypt/benchmark/benchmark.c b/ctaocrypt/benchmark/benchmark.c index 00ac9d220..b2517f084 100644 --- a/ctaocrypt/benchmark/benchmark.c +++ b/ctaocrypt/benchmark/benchmark.c @@ -1061,9 +1061,9 @@ void bench_ntruKeyGen(void) double start, total, each, milliEach; int i; - byte public_key[5951]; /* 2048 key equivalent to rsa */ + byte public_key[557]; /* 2048 key equivalent to rsa */ word16 public_key_len = sizeof(public_key); - byte private_key[5951]; + byte private_key[607]; word16 private_key_len = sizeof(private_key); DRBG_HANDLE drbg;