Merge pull request #8099 from dgarske/armasm_aes
Fix issue with ARM ASM with AES CFB/OFB not initializing the "left" member
This commit is contained in:
commit
43fe46cf24
@ -3726,8 +3726,8 @@ static WARN_UNUSED_RESULT int wc_AesDecrypt(
|
|||||||
#if !defined(WOLFSSL_STM32_CUBEMX) || defined(STM32_HAL_V2)
|
#if !defined(WOLFSSL_STM32_CUBEMX) || defined(STM32_HAL_V2)
|
||||||
ByteReverseWords(rk, rk, keylen);
|
ByteReverseWords(rk, rk, keylen);
|
||||||
#endif
|
#endif
|
||||||
#if defined(WOLFSSL_AES_CFB) || defined(WOLFSSL_AES_COUNTER) || \
|
#if defined(WOLFSSL_AES_COUNTER) || defined(WOLFSSL_AES_CFB) || \
|
||||||
defined(WOLFSSL_AES_OFB)
|
defined(WOLFSSL_AES_OFB) || defined(WOLFSSL_AES_XTS)
|
||||||
aes->left = 0;
|
aes->left = 0;
|
||||||
#endif
|
#endif
|
||||||
return wc_AesSetIV(aes, iv);
|
return wc_AesSetIV(aes, iv);
|
||||||
@ -3807,8 +3807,8 @@ static WARN_UNUSED_RESULT int wc_AesDecrypt(
|
|||||||
if (iv)
|
if (iv)
|
||||||
XMEMCPY(aes->reg, iv, AES_BLOCK_SIZE);
|
XMEMCPY(aes->reg, iv, AES_BLOCK_SIZE);
|
||||||
|
|
||||||
#if defined(WOLFSSL_AES_CFB) || defined(WOLFSSL_AES_COUNTER) || \
|
#if defined(WOLFSSL_AES_COUNTER) || defined(WOLFSSL_AES_CFB) || \
|
||||||
defined(WOLFSSL_AES_OFB)
|
defined(WOLFSSL_AES_OFB) || defined(WOLFSSL_AES_XTS)
|
||||||
aes->left = 0;
|
aes->left = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -3838,8 +3838,8 @@ static WARN_UNUSED_RESULT int wc_AesDecrypt(
|
|||||||
aes->rounds = keylen/4 + 6;
|
aes->rounds = keylen/4 + 6;
|
||||||
XMEMCPY(aes->key, userKey, keylen);
|
XMEMCPY(aes->key, userKey, keylen);
|
||||||
|
|
||||||
#if defined(WOLFSSL_AES_CFB) || defined(WOLFSSL_AES_COUNTER) || \
|
#if defined(WOLFSSL_AES_COUNTER) || defined(WOLFSSL_AES_CFB) || \
|
||||||
defined(WOLFSSL_AES_OFB)
|
defined(WOLFSSL_AES_OFB) || defined(WOLFSSL_AES_XTS)
|
||||||
aes->left = 0;
|
aes->left = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -3890,8 +3890,8 @@ static WARN_UNUSED_RESULT int wc_AesDecrypt(
|
|||||||
if (rk == NULL)
|
if (rk == NULL)
|
||||||
return BAD_FUNC_ARG;
|
return BAD_FUNC_ARG;
|
||||||
|
|
||||||
#if defined(WOLFSSL_AES_CFB) || defined(WOLFSSL_AES_COUNTER) || \
|
#if defined(WOLFSSL_AES_COUNTER) || defined(WOLFSSL_AES_CFB) || \
|
||||||
defined(WOLFSSL_AES_OFB)
|
defined(WOLFSSL_AES_OFB) || defined(WOLFSSL_AES_XTS)
|
||||||
aes->left = 0;
|
aes->left = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -3971,8 +3971,8 @@ static WARN_UNUSED_RESULT int wc_AesDecrypt(
|
|||||||
XMEMCPY(aes->key, userKey, keylen);
|
XMEMCPY(aes->key, userKey, keylen);
|
||||||
ret = nrf51_aes_set_key(userKey);
|
ret = nrf51_aes_set_key(userKey);
|
||||||
|
|
||||||
#if defined(WOLFSSL_AES_CFB) || defined(WOLFSSL_AES_COUNTER) || \
|
#if defined(WOLFSSL_AES_COUNTER) || defined(WOLFSSL_AES_CFB) || \
|
||||||
defined(WOLFSSL_AES_OFB)
|
defined(WOLFSSL_AES_OFB) || defined(WOLFSSL_AES_XTS)
|
||||||
aes->left = 0;
|
aes->left = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -4028,7 +4028,8 @@ static WARN_UNUSED_RESULT int wc_AesDecrypt(
|
|||||||
aes->rounds = keylen/4 + 6;
|
aes->rounds = keylen/4 + 6;
|
||||||
|
|
||||||
XMEMCPY(aes->key, userKey, keylen);
|
XMEMCPY(aes->key, userKey, keylen);
|
||||||
#if defined(WOLFSSL_AES_COUNTER)
|
#if defined(WOLFSSL_AES_COUNTER) || defined(WOLFSSL_AES_CFB) || \
|
||||||
|
defined(WOLFSSL_AES_OFB) || defined(WOLFSSL_AES_XTS)
|
||||||
aes->left = 0;
|
aes->left = 0;
|
||||||
#endif
|
#endif
|
||||||
return wc_AesSetIV(aes, iv);
|
return wc_AesSetIV(aes, iv);
|
||||||
@ -4520,8 +4521,8 @@ static void AesSetKey_C(Aes* aes, const byte* key, word32 keySz, int dir)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(WOLFSSL_AES_CFB) || defined(WOLFSSL_AES_COUNTER) || \
|
#if defined(WOLFSSL_AES_COUNTER) || defined(WOLFSSL_AES_CFB) || \
|
||||||
defined(WOLFSSL_AES_OFB)
|
defined(WOLFSSL_AES_OFB) || defined(WOLFSSL_AES_XTS)
|
||||||
aes->left = 0;
|
aes->left = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -795,7 +795,8 @@ int wc_AesSetKey(Aes* aes, const byte* userKey, word32 keylen,
|
|||||||
return BAD_FUNC_ARG;
|
return BAD_FUNC_ARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WOLFSSL_AES_COUNTER
|
#if defined(WOLFSSL_AES_COUNTER) || defined(WOLFSSL_AES_CFB) || \
|
||||||
|
defined(WOLFSSL_AES_OFB) || defined(WOLFSSL_AES_XTS)
|
||||||
aes->left = 0;
|
aes->left = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -201,7 +201,8 @@ int wc_AesSetKey(Aes* aes, const byte* userKey, word32 keylen,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WOLFSSL_AES_COUNTER
|
#if defined(WOLFSSL_AES_COUNTER) || defined(WOLFSSL_AES_CFB) || \
|
||||||
|
defined(WOLFSSL_AES_OFB) || defined(WOLFSSL_AES_XTS)
|
||||||
aes->left = 0;
|
aes->left = 0;
|
||||||
#endif /* WOLFSSL_AES_COUNTER */
|
#endif /* WOLFSSL_AES_COUNTER */
|
||||||
|
|
||||||
@ -16581,9 +16582,10 @@ int wc_AesSetKey(Aes* aes, const byte* userKey, word32 keylen,
|
|||||||
XMEMCPY(aes->devKey, userKey, keylen);
|
XMEMCPY(aes->devKey, userKey, keylen);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef WOLFSSL_AES_COUNTER
|
#if defined(WOLFSSL_AES_COUNTER) || defined(WOLFSSL_AES_CFB) || \
|
||||||
|
defined(WOLFSSL_AES_OFB) || defined(WOLFSSL_AES_XTS)
|
||||||
aes->left = 0;
|
aes->left = 0;
|
||||||
#endif /* WOLFSSL_AES_COUNTER */
|
#endif
|
||||||
|
|
||||||
aes->keylen = keylen;
|
aes->keylen = keylen;
|
||||||
aes->rounds = keylen/4 + 6;
|
aes->rounds = keylen/4 + 6;
|
||||||
|
@ -93,7 +93,8 @@ int wc_AesSetKey(Aes* aes, const byte* key, word32 len,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WOLFSSL_AES_COUNTER
|
#if defined(WOLFSSL_AES_COUNTER) || defined(WOLFSSL_AES_CFB) || \
|
||||||
|
defined(WOLFSSL_AES_OFB) || defined(WOLFSSL_AES_XTS)
|
||||||
aes->left = 0;
|
aes->left = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -125,7 +125,8 @@ int wc_AesSetKey(Aes* aes, const byte* userKey, word32 keylen,
|
|||||||
aes->keylen = keylen;
|
aes->keylen = keylen;
|
||||||
aes->rounds = keylen/4 + 6;
|
aes->rounds = keylen/4 + 6;
|
||||||
|
|
||||||
#ifdef WOLFSSL_AES_COUNTER
|
#if defined(WOLFSSL_AES_COUNTER) || defined(WOLFSSL_AES_CFB) || \
|
||||||
|
defined(WOLFSSL_AES_OFB) || defined(WOLFSSL_AES_XTS)
|
||||||
aes->left = 0;
|
aes->left = 0;
|
||||||
#endif
|
#endif
|
||||||
aes->ctx.cfd = -1;
|
aes->ctx.cfd = -1;
|
||||||
|
@ -498,8 +498,8 @@ int wc_AesSetKey(Aes* aes, const byte* key, word32 keyLen, const byte* iv,
|
|||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
/* Finish setting the AES object. */
|
/* Finish setting the AES object. */
|
||||||
aes->keylen = keyLen;
|
aes->keylen = keyLen;
|
||||||
#if defined(WOLFSSL_AES_CFB) || defined(WOLFSSL_AES_COUNTER) || \
|
#if defined(WOLFSSL_AES_COUNTER) || defined(WOLFSSL_AES_CFB) || \
|
||||||
defined(WOLFSSL_AES_OFB)
|
defined(WOLFSSL_AES_OFB) || defined(WOLFSSL_AES_XTS)
|
||||||
aes->left = 0;
|
aes->left = 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -1770,8 +1770,8 @@ int wc_AesSetKey(Aes* aes, const byte* key, word32 keyLen, const byte* iv,
|
|||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
/* Finish setting the AES object. */
|
/* Finish setting the AES object. */
|
||||||
aes->keylen = keyLen;
|
aes->keylen = keyLen;
|
||||||
#if defined(WOLFSSL_AES_CFB) || defined(WOLFSSL_AES_COUNTER) || \
|
#if defined(WOLFSSL_AES_COUNTER) || defined(WOLFSSL_AES_CFB) || \
|
||||||
defined(WOLFSSL_AES_OFB)
|
defined(WOLFSSL_AES_OFB) || defined(WOLFSSL_AES_XTS)
|
||||||
aes->left = 0;
|
aes->left = 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -2978,8 +2978,8 @@ int wc_AesSetKey(Aes* aes, const byte* key, word32 keyLen, const byte* iv,
|
|||||||
|
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
/* Initialize fields. */
|
/* Initialize fields. */
|
||||||
#if defined(WOLFSSL_AES_CFB) || defined(WOLFSSL_AES_COUNTER) || \
|
#if defined(WOLFSSL_AES_COUNTER) || defined(WOLFSSL_AES_CFB) || \
|
||||||
defined(WOLFSSL_AES_OFB)
|
defined(WOLFSSL_AES_OFB) || defined(WOLFSSL_AES_XTS)
|
||||||
aes->left = 0;
|
aes->left = 0;
|
||||||
#endif
|
#endif
|
||||||
aes->keylen = (int)keyLen;
|
aes->keylen = (int)keyLen;
|
||||||
|
@ -99,7 +99,8 @@ int wc_AesSetKey(Aes* aes, const byte* key, word32 len, const byte* iv, int dir)
|
|||||||
aes->rounds = len / 4 + 6;
|
aes->rounds = len / 4 + 6;
|
||||||
|
|
||||||
XMEMCPY(aes->key, key, len);
|
XMEMCPY(aes->key, key, len);
|
||||||
#ifdef WOLFSSL_AES_COUNTER
|
#if defined(WOLFSSL_AES_COUNTER) || defined(WOLFSSL_AES_CFB) || \
|
||||||
|
defined(WOLFSSL_AES_OFB) || defined(WOLFSSL_AES_XTS)
|
||||||
aes->left = 0;
|
aes->left = 0;
|
||||||
#endif
|
#endif
|
||||||
return AesSetIV(aes, iv);
|
return AesSetIV(aes, iv);
|
||||||
|
Loading…
Reference in New Issue
Block a user