Test larger variable data size if available

This commit is contained in:
Sean Parkinson 2018-01-30 12:21:25 +10:00
parent e82e3d3d6e
commit 3d3b9f69a6
1 changed files with 25 additions and 1 deletions

View File

@ -5923,7 +5923,7 @@ int aesgcm_test(void)
return -4309;
#endif /* BENCH_AESGCM_LARGE */
#if !defined(HAVE_FIPS) && !defined(STM32_CRYPTO)
#ifdef ENABLE_NON_12BYTE_IV_TEST
/* Variable IV length test */
for (ivlen=0; ivlen<(int)sizeof(k1); ivlen++) {
/* AES-GCM encrypt and decrypt both use AES encrypt internally */
@ -5963,6 +5963,29 @@ int aesgcm_test(void)
return -4313;
}
#ifdef BENCH_AESGCM_LARGE
/* Variable plain text length test */
for (plen=1; plen<BENCH_AESGCM_LARGE; plen++) {
/* AES-GCM encrypt and decrypt both use AES encrypt internally */
result = wc_AesGcmEncrypt(&enc, large_output, large_input,
plen, iv1, sizeof(iv1), resultT,
sizeof(resultT), a, sizeof(a));
#if defined(WOLFSSL_ASYNC_CRYPT)
result = wc_AsyncWait(result, &enc.asyncDev, WC_ASYNC_FLAG_NONE);
#endif
if (result != 0)
return -4314;
result = wc_AesGcmDecrypt(&enc, large_outdec, large_output,
plen, iv1, sizeof(iv1), resultT,
sizeof(resultT), a, sizeof(a));
#if defined(WOLFSSL_ASYNC_CRYPT)
result = wc_AsyncWait(result, &enc.asyncDev, WC_ASYNC_FLAG_NONE);
#endif
if (result != 0)
return -4315;
}
#else
/* Variable plain text length test */
for (plen=1; plen<(int)sizeof(p); plen++) {
/* AES-GCM encrypt and decrypt both use AES encrypt internally */
@ -5981,6 +6004,7 @@ int aesgcm_test(void)
if (result != 0)
return -4315;
}
#endif /* BENCH_AESGCM_LARGE */
/* test with IV != 12 bytes */
#ifdef ENABLE_NON_12BYTE_IV_TEST