ntru keygen is indepedent of additional cyassl keygen, use cyassl types, correct ntru benchmark output
This commit is contained in:
parent
b134894eb8
commit
1c7eb61017
@ -226,9 +226,10 @@ int benchmark_test(void *args)
|
||||
|
||||
#if defined(CYASSL_KEY_GEN) && !defined(NO_RSA)
|
||||
bench_rsaKeyGen();
|
||||
#ifdef HAVE_NTRU
|
||||
bench_ntruKeyGen();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NTRU
|
||||
bench_ntruKeyGen();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ECC
|
||||
@ -1063,7 +1064,7 @@ void bench_ntruKeyGen(void)
|
||||
byte public_key[5951]; /* 2048 key equivalent to rsa */
|
||||
word16 public_key_len;
|
||||
byte private_key[5951];
|
||||
word16 private_key_len;
|
||||
word16 private_key_len = sizeof(private_key);
|
||||
|
||||
DRBG_HANDLE drbg;
|
||||
static uint8_t const pers_str[] = {
|
||||
@ -1080,10 +1081,8 @@ void bench_ntruKeyGen(void)
|
||||
start = current_time(1);
|
||||
|
||||
for(i = 0; i < genTimes; i++) {
|
||||
ntru_crypto_ntru_encrypt_keygen(drbg, NTRU_EES401EP2,
|
||||
&public_key_len, NULL, &private_key_len, NULL);
|
||||
ntru_crypto_ntru_encrypt_keygen(drbg, NTRU_EES401EP2,
|
||||
&public_key_len, public_key, &private_key_len, private_key);
|
||||
ntru_crypto_ntru_encrypt_keygen(drbg, NTRU_EES401EP2, &public_key_len,
|
||||
public_key, &private_key_len, private_key);
|
||||
}
|
||||
|
||||
total = current_time(0) - start;
|
||||
@ -1099,7 +1098,7 @@ void bench_ntruKeyGen(void)
|
||||
milliEach = each * 1000;
|
||||
|
||||
printf("\n");
|
||||
printf("NTRU 2048 key generation %6.3f milliseconds, avg over %d"
|
||||
printf("NTRU 112 key generation %6.3f milliseconds, avg over %d"
|
||||
" iterations\n", milliEach, genTimes);
|
||||
|
||||
}
|
||||
|
@ -1662,16 +1662,14 @@ static int GetKey(DecodedCert* cert)
|
||||
byte* next = (byte*)key;
|
||||
word16 keyLen;
|
||||
word32 rc;
|
||||
word32 remaining = cert->maxIdx - cert->srcIdx;
|
||||
#ifdef CYASSL_SMALL_STACK
|
||||
byte* keyBlob = NULL;
|
||||
#else
|
||||
byte keyBlob[MAX_NTRU_KEY_SZ];
|
||||
#endif
|
||||
uint32_t remaining = (uint32_t)cert->maxIdx - cert->srcIdx;
|
||||
|
||||
rc = ntru_crypto_ntru_encrypt_subjectPublicKeyInfo2PublicKey(key,
|
||||
&keyLen, NULL, &next, &remaining);
|
||||
|
||||
if (rc != NTRU_OK)
|
||||
return ASN_NTRU_KEY_E;
|
||||
if (keyLen > MAX_NTRU_KEY_SZ)
|
||||
|
Loading…
Reference in New Issue
Block a user