forked from wolfSSL/wolfssl
Merge pull request #1342 from SparkiDev/aes_gcm_sb2
Improve performance of AES-GCM for AVX1 and AVX2
This commit is contained in:
5899
wolfcrypt/src/aes.c
5899
wolfcrypt/src/aes.c
File diff suppressed because it is too large
Load Diff
@ -5954,7 +5954,7 @@ int aesgcm_test(void)
|
|||||||
return -4309;
|
return -4309;
|
||||||
#endif /* BENCH_AESGCM_LARGE */
|
#endif /* BENCH_AESGCM_LARGE */
|
||||||
|
|
||||||
#if !defined(HAVE_FIPS) && !defined(STM32_CRYPTO)
|
#ifdef ENABLE_NON_12BYTE_IV_TEST
|
||||||
/* Variable IV length test */
|
/* Variable IV length test */
|
||||||
for (ivlen=0; ivlen<(int)sizeof(k1); ivlen++) {
|
for (ivlen=0; ivlen<(int)sizeof(k1); ivlen++) {
|
||||||
/* AES-GCM encrypt and decrypt both use AES encrypt internally */
|
/* AES-GCM encrypt and decrypt both use AES encrypt internally */
|
||||||
@ -5994,6 +5994,29 @@ int aesgcm_test(void)
|
|||||||
return -4313;
|
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 */
|
/* Variable plain text length test */
|
||||||
for (plen=1; plen<(int)sizeof(p); plen++) {
|
for (plen=1; plen<(int)sizeof(p); plen++) {
|
||||||
/* AES-GCM encrypt and decrypt both use AES encrypt internally */
|
/* AES-GCM encrypt and decrypt both use AES encrypt internally */
|
||||||
@ -6012,6 +6035,7 @@ int aesgcm_test(void)
|
|||||||
if (result != 0)
|
if (result != 0)
|
||||||
return -4315;
|
return -4315;
|
||||||
}
|
}
|
||||||
|
#endif /* BENCH_AESGCM_LARGE */
|
||||||
|
|
||||||
/* test with IV != 12 bytes */
|
/* test with IV != 12 bytes */
|
||||||
#ifdef ENABLE_NON_12BYTE_IV_TEST
|
#ifdef ENABLE_NON_12BYTE_IV_TEST
|
||||||
|
Reference in New Issue
Block a user