forked from wolfSSL/wolfssl
rename WC_AES_C_DYNAMIC_FALLBACK to WC_C_DYNAMIC_FALLBACK.
This commit is contained in:
@ -2993,7 +2993,7 @@ then
|
||||
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AESNI"
|
||||
if test "$ENABLED_LINUXKM_DEFAULTS" = "yes"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DWC_AES_C_DYNAMIC_FALLBACK"
|
||||
AM_CFLAGS="$AM_CFLAGS -DWC_C_DYNAMIC_FALLBACK"
|
||||
fi
|
||||
if test "$CC" != "icc"
|
||||
then
|
||||
|
@ -1818,7 +1818,7 @@ static int aes_xts_128_test(void)
|
||||
goto out;
|
||||
}
|
||||
|
||||
#if defined(DEBUG_VECTOR_REGISTER_ACCESS) && defined(WC_AES_C_DYNAMIC_FALLBACK)
|
||||
#if defined(DEBUG_VECTOR_REGISTER_ACCESS) && defined(WC_C_DYNAMIC_FALLBACK)
|
||||
WC_DEBUG_SET_VECTOR_REGISTERS_RETVAL(SYSLIB_FAILED_E);
|
||||
ret = wc_AesXtsEncrypt(aes, buf, p2, sizeof(p2), i2, sizeof(i2));
|
||||
WC_DEBUG_SET_VECTOR_REGISTERS_RETVAL(0);
|
||||
@ -1843,7 +1843,7 @@ static int aes_xts_128_test(void)
|
||||
goto out;
|
||||
}
|
||||
|
||||
#if defined(DEBUG_VECTOR_REGISTER_ACCESS) && defined(WC_AES_C_DYNAMIC_FALLBACK)
|
||||
#if defined(DEBUG_VECTOR_REGISTER_ACCESS) && defined(WC_C_DYNAMIC_FALLBACK)
|
||||
WC_DEBUG_SET_VECTOR_REGISTERS_RETVAL(SYSLIB_FAILED_E);
|
||||
ret = wc_AesXtsEncrypt(aes, buf, p1, sizeof(p1), i1, sizeof(i1));
|
||||
WC_DEBUG_SET_VECTOR_REGISTERS_RETVAL(0);
|
||||
@ -1865,7 +1865,7 @@ static int aes_xts_128_test(void)
|
||||
goto out;
|
||||
}
|
||||
|
||||
#if defined(DEBUG_VECTOR_REGISTER_ACCESS) && defined(WC_AES_C_DYNAMIC_FALLBACK)
|
||||
#if defined(DEBUG_VECTOR_REGISTER_ACCESS) && defined(WC_C_DYNAMIC_FALLBACK)
|
||||
WC_DEBUG_SET_VECTOR_REGISTERS_RETVAL(SYSLIB_FAILED_E);
|
||||
XMEMSET(cipher, 0, AES_XTS_128_TEST_BUF_SIZ);
|
||||
ret = wc_AesXtsEncrypt(aes, cipher, pp, sizeof(pp), i1, sizeof(i1));
|
||||
@ -1891,7 +1891,7 @@ static int aes_xts_128_test(void)
|
||||
goto out;
|
||||
}
|
||||
|
||||
#if defined(DEBUG_VECTOR_REGISTER_ACCESS) && defined(WC_AES_C_DYNAMIC_FALLBACK)
|
||||
#if defined(DEBUG_VECTOR_REGISTER_ACCESS) && defined(WC_C_DYNAMIC_FALLBACK)
|
||||
WC_DEBUG_SET_VECTOR_REGISTERS_RETVAL(SYSLIB_FAILED_E);
|
||||
XMEMSET(buf, 0, AES_XTS_128_TEST_BUF_SIZ);
|
||||
ret = wc_AesXtsDecrypt(aes, buf, cipher, sizeof(pp), i1, sizeof(i1));
|
||||
@ -1914,7 +1914,7 @@ static int aes_xts_128_test(void)
|
||||
goto out;
|
||||
}
|
||||
|
||||
#if defined(DEBUG_VECTOR_REGISTER_ACCESS) && defined(WC_AES_C_DYNAMIC_FALLBACK)
|
||||
#if defined(DEBUG_VECTOR_REGISTER_ACCESS) && defined(WC_C_DYNAMIC_FALLBACK)
|
||||
WC_DEBUG_SET_VECTOR_REGISTERS_RETVAL(SYSLIB_FAILED_E);
|
||||
XMEMSET(buf, 0, AES_XTS_128_TEST_BUF_SIZ);
|
||||
ret = wc_AesXtsDecrypt(aes, buf, c1, sizeof(c1), i1, sizeof(i1));
|
||||
|
@ -1930,7 +1930,7 @@ static void AesEncrypt_C(Aes* aes, const byte* inBlock, byte* outBlock,
|
||||
word32 t0, t1, t2, t3;
|
||||
const word32* rk;
|
||||
|
||||
#ifdef WC_AES_C_DYNAMIC_FALLBACK
|
||||
#ifdef WC_C_DYNAMIC_FALLBACK
|
||||
rk = aes->key_C_fallback;
|
||||
#else
|
||||
rk = aes->key;
|
||||
@ -2945,7 +2945,7 @@ static void AesDecrypt_C(Aes* aes, const byte* inBlock, byte* outBlock,
|
||||
word32 t0, t1, t2, t3;
|
||||
const word32* rk;
|
||||
|
||||
#ifdef WC_AES_C_DYNAMIC_FALLBACK
|
||||
#ifdef WC_C_DYNAMIC_FALLBACK
|
||||
rk = aes->key_C_fallback;
|
||||
#else
|
||||
rk = aes->key;
|
||||
@ -4085,7 +4085,7 @@ static WARN_UNUSED_RESULT int wc_AesDecrypt(
|
||||
*/
|
||||
static void AesSetKey_C(Aes* aes, const byte* key, word32 keySz, int dir)
|
||||
{
|
||||
#ifdef WC_AES_C_DYNAMIC_FALLBACK
|
||||
#ifdef WC_C_DYNAMIC_FALLBACK
|
||||
word32* rk = aes->key_C_fallback;
|
||||
#else
|
||||
word32* rk = aes->key;
|
||||
@ -4246,7 +4246,7 @@ static void AesSetKey_C(Aes* aes, const byte* key, word32 keySz, int dir)
|
||||
if (dir == AES_DECRYPTION) {
|
||||
unsigned int j;
|
||||
|
||||
#ifdef WC_AES_C_DYNAMIC_FALLBACK
|
||||
#ifdef WC_C_DYNAMIC_FALLBACK
|
||||
rk = aes->key_C_fallback;
|
||||
#else
|
||||
rk = aes->key;
|
||||
@ -4455,11 +4455,11 @@ static void AesSetKey_C(Aes* aes, const byte* key, word32 keySz, int dir)
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
#ifdef WC_AES_C_DYNAMIC_FALLBACK
|
||||
#ifdef WC_C_DYNAMIC_FALLBACK
|
||||
#ifdef NEED_AES_TABLES
|
||||
AesSetKey_C(aes, userKey, keylen, dir);
|
||||
#endif /* NEED_AES_TABLES */
|
||||
#endif /* WC_AES_C_DYNAMIC_FALLBACK */
|
||||
#endif /* WC_C_DYNAMIC_FALLBACK */
|
||||
|
||||
#ifdef WOLFSSL_AESNI
|
||||
aes->use_aesni = 0;
|
||||
@ -4488,13 +4488,13 @@ static void AesSetKey_C(Aes* aes, const byte* key, word32 keySz, int dir)
|
||||
if (ret == 0)
|
||||
aes->use_aesni = 1;
|
||||
else {
|
||||
#ifdef WC_AES_C_DYNAMIC_FALLBACK
|
||||
#ifdef WC_C_DYNAMIC_FALLBACK
|
||||
ret = 0;
|
||||
#endif
|
||||
}
|
||||
return ret;
|
||||
} else {
|
||||
#ifdef WC_AES_C_DYNAMIC_FALLBACK
|
||||
#ifdef WC_C_DYNAMIC_FALLBACK
|
||||
return 0;
|
||||
#else
|
||||
return ret;
|
||||
@ -4680,7 +4680,7 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
|
||||
|
||||
#ifdef WOLFSSL_AESNI
|
||||
|
||||
#ifdef WC_AES_C_DYNAMIC_FALLBACK
|
||||
#ifdef WC_C_DYNAMIC_FALLBACK
|
||||
|
||||
#define VECTOR_REGISTERS_PUSH { \
|
||||
int orig_use_aesni = aes->use_aesni; \
|
||||
@ -12369,7 +12369,7 @@ int wc_AesXtsSetKeyNoInit(XtsAes* aes, const byte* key, word32 len, int dir)
|
||||
|
||||
#ifdef WOLFSSL_AESNI
|
||||
if (ret == 0) {
|
||||
/* With WC_AES_C_DYNAMIC_FALLBACK, the main and tweak keys could have
|
||||
/* With WC_C_DYNAMIC_FALLBACK, the main and tweak keys could have
|
||||
* conflicting _aesni status, but the AES-XTS asm implementations need
|
||||
* them to all be AESNI. If any aren't, disable AESNI on all.
|
||||
*/
|
||||
@ -12382,7 +12382,7 @@ int wc_AesXtsSetKeyNoInit(XtsAes* aes, const byte* key, word32 len, int dir)
|
||||
(dir == AES_ENCRYPTION_AND_DECRYPTION))
|
||||
&& (aes->aes_decrypt.use_aesni != aes->tweak.use_aesni)))
|
||||
{
|
||||
#ifdef WC_AES_C_DYNAMIC_FALLBACK
|
||||
#ifdef WC_C_DYNAMIC_FALLBACK
|
||||
aes->aes.use_aesni = 0;
|
||||
aes->aes_decrypt.use_aesni = 0;
|
||||
aes->tweak.use_aesni = 0;
|
||||
@ -12392,7 +12392,7 @@ int wc_AesXtsSetKeyNoInit(XtsAes* aes, const byte* key, word32 len, int dir)
|
||||
}
|
||||
#else /* !WC_AES_XTS_SUPPORT_SIMULTANEOUS_ENC_AND_DEC_KEYS */
|
||||
if (aes->aes.use_aesni != aes->tweak.use_aesni) {
|
||||
#ifdef WC_AES_C_DYNAMIC_FALLBACK
|
||||
#ifdef WC_C_DYNAMIC_FALLBACK
|
||||
aes->aes.use_aesni = 0;
|
||||
aes->tweak.use_aesni = 0;
|
||||
#else
|
||||
|
@ -944,7 +944,7 @@ void AesEncrypt_C(Aes* aes, const byte* inBlock, byte* outBlock,
|
||||
word32* rk_GPU = NULL;
|
||||
cudaError_t ret = cudaSuccess;
|
||||
|
||||
#ifdef WC_AES_C_DYNAMIC_FALLBACK
|
||||
#ifdef WC_C_DYNAMIC_FALLBACK
|
||||
if ( ret == cudaSuccess )
|
||||
ret = cudaMalloc(&rk_GPU, sizeof(aes->key_C_fallback));
|
||||
if ( ret == cudaSuccess )
|
||||
@ -991,7 +991,7 @@ void AesEncryptBlocks_C(Aes* aes, const byte* in, byte* out, word32 sz)
|
||||
word32* rk_GPU = NULL;
|
||||
cudaError_t ret = cudaSuccess;
|
||||
|
||||
#ifdef WC_AES_C_DYNAMIC_FALLBACK
|
||||
#ifdef WC_C_DYNAMIC_FALLBACK
|
||||
if ( ret == cudaSuccess )
|
||||
ret = cudaMalloc(&rk_GPU, sizeof(aes->key_C_fallback));
|
||||
if ( ret == cudaSuccess )
|
||||
|
@ -9976,7 +9976,7 @@ static wc_test_ret_t aes_xts_128_test(void)
|
||||
ERROR_OUT(WC_TEST_RET_ENC_NC, out);
|
||||
|
||||
#if defined(DEBUG_VECTOR_REGISTER_ACCESS_AESXTS) && \
|
||||
defined(WC_AES_C_DYNAMIC_FALLBACK)
|
||||
defined(WC_C_DYNAMIC_FALLBACK)
|
||||
WC_DEBUG_SET_VECTOR_REGISTERS_RETVAL(SYSLIB_FAILED_E);
|
||||
ret = wc_AesXtsEncrypt(aes, buf, p2, sizeof(p2), i2, sizeof(i2));
|
||||
#if defined(WOLFSSL_ASYNC_CRYPT)
|
||||
@ -10004,7 +10004,7 @@ static wc_test_ret_t aes_xts_128_test(void)
|
||||
ERROR_OUT(WC_TEST_RET_ENC_NC, out);
|
||||
|
||||
#if defined(DEBUG_VECTOR_REGISTER_ACCESS_AESXTS) && \
|
||||
defined(WC_AES_C_DYNAMIC_FALLBACK)
|
||||
defined(WC_C_DYNAMIC_FALLBACK)
|
||||
WC_DEBUG_SET_VECTOR_REGISTERS_RETVAL(SYSLIB_FAILED_E);
|
||||
ret = wc_AesXtsEncrypt(aes, buf, p1, sizeof(p1), i1, sizeof(i1));
|
||||
#if defined(WOLFSSL_ASYNC_CRYPT)
|
||||
@ -10029,7 +10029,7 @@ static wc_test_ret_t aes_xts_128_test(void)
|
||||
ERROR_OUT(WC_TEST_RET_ENC_NC, out);
|
||||
|
||||
#if defined(DEBUG_VECTOR_REGISTER_ACCESS_AESXTS) && \
|
||||
defined(WC_AES_C_DYNAMIC_FALLBACK)
|
||||
defined(WC_C_DYNAMIC_FALLBACK)
|
||||
WC_DEBUG_SET_VECTOR_REGISTERS_RETVAL(SYSLIB_FAILED_E);
|
||||
XMEMSET(cipher, 0, sizeof(cipher));
|
||||
ret = wc_AesXtsEncrypt(aes, cipher, pp, sizeof(pp), i1, sizeof(i1));
|
||||
@ -10062,7 +10062,7 @@ static wc_test_ret_t aes_xts_128_test(void)
|
||||
ERROR_OUT(WC_TEST_RET_ENC_NC, out);
|
||||
|
||||
#if defined(DEBUG_VECTOR_REGISTER_ACCESS_AESXTS) && \
|
||||
defined(WC_AES_C_DYNAMIC_FALLBACK)
|
||||
defined(WC_C_DYNAMIC_FALLBACK)
|
||||
WC_DEBUG_SET_VECTOR_REGISTERS_RETVAL(SYSLIB_FAILED_E);
|
||||
XMEMSET(buf, 0, sizeof(buf));
|
||||
ret = wc_AesXtsDecrypt(aes, buf, cipher, sizeof(pp), i1, sizeof(i1));
|
||||
@ -10096,7 +10096,7 @@ static wc_test_ret_t aes_xts_128_test(void)
|
||||
ERROR_OUT(WC_TEST_RET_ENC_NC, out);
|
||||
|
||||
#if defined(DEBUG_VECTOR_REGISTER_ACCESS_AESXTS) && \
|
||||
defined(WC_AES_C_DYNAMIC_FALLBACK)
|
||||
defined(WC_C_DYNAMIC_FALLBACK)
|
||||
WC_DEBUG_SET_VECTOR_REGISTERS_RETVAL(SYSLIB_FAILED_E);
|
||||
XMEMSET(buf, 0, sizeof(buf));
|
||||
ret = wc_AesXtsDecrypt(aes, buf, c1, sizeof(c1), i1, sizeof(i1));
|
||||
@ -10987,7 +10987,7 @@ static wc_test_ret_t aesecb_test(void)
|
||||
if (XMEMCMP(cipher, niCipher, AES_BLOCK_SIZE) != 0)
|
||||
ERROR_OUT(WC_TEST_RET_ENC_NC, out);
|
||||
|
||||
#if defined(DEBUG_VECTOR_REGISTER_ACCESS) && defined(WC_AES_C_DYNAMIC_FALLBACK)
|
||||
#if defined(DEBUG_VECTOR_REGISTER_ACCESS) && defined(WC_C_DYNAMIC_FALLBACK)
|
||||
XMEMSET(cipher, 0, AES_BLOCK_SIZE);
|
||||
WC_DEBUG_SET_VECTOR_REGISTERS_RETVAL(SYSLIB_FAILED_E);
|
||||
ret = wc_AesSetKey(enc, niKey, sizeof(niKey), cipher, AES_ENCRYPTION);
|
||||
@ -11029,7 +11029,7 @@ static wc_test_ret_t aesecb_test(void)
|
||||
if (XMEMCMP(plain, niPlain, AES_BLOCK_SIZE) != 0)
|
||||
ERROR_OUT(WC_TEST_RET_ENC_NC, out);
|
||||
|
||||
#if defined(DEBUG_VECTOR_REGISTER_ACCESS) && defined(WC_AES_C_DYNAMIC_FALLBACK)
|
||||
#if defined(DEBUG_VECTOR_REGISTER_ACCESS) && defined(WC_C_DYNAMIC_FALLBACK)
|
||||
XMEMSET(plain, 0, AES_BLOCK_SIZE);
|
||||
WC_DEBUG_SET_VECTOR_REGISTERS_RETVAL(SYSLIB_FAILED_E);
|
||||
ret = wc_AesSetKey(dec, niKey, sizeof(niKey), plain, AES_DECRYPTION);
|
||||
@ -11694,7 +11694,7 @@ static wc_test_ret_t aesctr_test(Aes* enc, Aes* dec, byte* cipher, byte* plain)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(DEBUG_VECTOR_REGISTER_ACCESS) && defined(WC_AES_C_DYNAMIC_FALLBACK)
|
||||
#if defined(DEBUG_VECTOR_REGISTER_ACCESS) && defined(WC_C_DYNAMIC_FALLBACK)
|
||||
for (i = 0; i < AES_CTR_TEST_LEN; i++) {
|
||||
if (testVec[i].key != NULL) {
|
||||
ret = wc_AesSetKeyDirect(enc, testVec[i].key, testVec[i].keySz,
|
||||
@ -11771,7 +11771,7 @@ static wc_test_ret_t aesctr_test(Aes* enc, Aes* dec, byte* cipher, byte* plain)
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* DEBUG_VECTOR_REGISTER_ACCESS && WC_AES_C_DYNAMIC_FALLBACK */
|
||||
#endif /* DEBUG_VECTOR_REGISTER_ACCESS && WC_C_DYNAMIC_FALLBACK */
|
||||
|
||||
|
||||
out:
|
||||
@ -12036,7 +12036,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t aes_test(void)
|
||||
break;
|
||||
}
|
||||
|
||||
#if defined(DEBUG_VECTOR_REGISTER_ACCESS) && defined(WC_AES_C_DYNAMIC_FALLBACK)
|
||||
#if defined(DEBUG_VECTOR_REGISTER_ACCESS) && defined(WC_C_DYNAMIC_FALLBACK)
|
||||
/* Iterate from one AES_BLOCK_SIZE of bigMsg through the whole
|
||||
* message by AES_BLOCK_SIZE for each size of AES key. */
|
||||
WC_DEBUG_SET_VECTOR_REGISTERS_RETVAL(SYSLIB_FAILED_E);
|
||||
@ -12085,7 +12085,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t aes_test(void)
|
||||
break;
|
||||
}
|
||||
WC_DEBUG_SET_VECTOR_REGISTERS_RETVAL(0);
|
||||
#endif /* DEBUG_VECTOR_REGISTER_ACCESS && WC_AES_C_DYNAMIC_FALLBACK */
|
||||
#endif /* DEBUG_VECTOR_REGISTER_ACCESS && WC_C_DYNAMIC_FALLBACK */
|
||||
|
||||
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
|
||||
XFREE(bigCipher, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
@ -12587,7 +12587,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t aes256_test(void)
|
||||
ERROR_OUT(WC_TEST_RET_ENC_NC, out);
|
||||
#endif
|
||||
|
||||
#if defined(DEBUG_VECTOR_REGISTER_ACCESS) && defined(WC_AES_C_DYNAMIC_FALLBACK)
|
||||
#if defined(DEBUG_VECTOR_REGISTER_ACCESS) && defined(WC_C_DYNAMIC_FALLBACK)
|
||||
ret = wc_AesSetKey(enc, key, keySz, iv, AES_ENCRYPTION);
|
||||
if (ret != 0)
|
||||
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
|
||||
@ -12662,7 +12662,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t aes256_test(void)
|
||||
ERROR_OUT(WC_TEST_RET_ENC_NC, out);
|
||||
#endif
|
||||
|
||||
#endif /* DEBUG_VECTOR_REGISTER_ACCESS && WC_AES_C_DYNAMIC_FALLBACK */
|
||||
#endif /* DEBUG_VECTOR_REGISTER_ACCESS && WC_C_DYNAMIC_FALLBACK */
|
||||
|
||||
out:
|
||||
|
||||
@ -12754,7 +12754,7 @@ static wc_test_ret_t aesgcm_default_test_helper(byte* key, int keySz, byte* iv,
|
||||
if (XMEMCMP(tag, resultT, tagSz))
|
||||
ERROR_OUT(WC_TEST_RET_ENC_NC, out);
|
||||
|
||||
#if defined(DEBUG_VECTOR_REGISTER_ACCESS) && defined(WC_AES_C_DYNAMIC_FALLBACK)
|
||||
#if defined(DEBUG_VECTOR_REGISTER_ACCESS) && defined(WC_C_DYNAMIC_FALLBACK)
|
||||
WC_DEBUG_SET_VECTOR_REGISTERS_RETVAL(SYSLIB_FAILED_E);
|
||||
ret = wc_AesGcmEncrypt(enc, resultC, plain, plainSz, iv, ivSz,
|
||||
resultT, tagSz, aad, aadSz);
|
||||
@ -12789,7 +12789,7 @@ static wc_test_ret_t aesgcm_default_test_helper(byte* key, int keySz, byte* iv,
|
||||
ERROR_OUT(WC_TEST_RET_ENC_NC, out);
|
||||
}
|
||||
|
||||
#if defined(DEBUG_VECTOR_REGISTER_ACCESS) && defined(WC_AES_C_DYNAMIC_FALLBACK)
|
||||
#if defined(DEBUG_VECTOR_REGISTER_ACCESS) && defined(WC_C_DYNAMIC_FALLBACK)
|
||||
WC_DEBUG_SET_VECTOR_REGISTERS_RETVAL(SYSLIB_FAILED_E);
|
||||
ret = wc_AesGcmDecrypt(dec, resultP, resultC, cipherSz,
|
||||
iv, ivSz, resultT, tagSz, aad, aadSz);
|
||||
|
@ -261,7 +261,7 @@ struct Aes {
|
||||
ALIGN16 bs_word bs_key[15 * AES_BLOCK_SIZE * BS_WORD_SIZE];
|
||||
#endif
|
||||
word32 rounds;
|
||||
#ifdef WC_AES_C_DYNAMIC_FALLBACK
|
||||
#ifdef WC_C_DYNAMIC_FALLBACK
|
||||
word32 key_C_fallback[60];
|
||||
#endif
|
||||
int keylen;
|
||||
|
Reference in New Issue
Block a user