Compare commits
1 Commits
WCv5.2.3-S
...
WCv5.2.3-R
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
064aace824 |
@@ -4395,7 +4395,7 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
return wc_AesSetKey(aes, key, len, iv, dir);
|
||||
return wc_AesSetKeyLocal(aes, key, len, iv, dir, 0);
|
||||
}
|
||||
|
||||
#endif /* NEED_AES_CTR_SOFT */
|
||||
|
||||
@@ -1972,7 +1972,6 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
|
||||
int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
|
||||
{
|
||||
int ret;
|
||||
word32 retVal;
|
||||
RNG_HandleTypeDef hrng;
|
||||
word32 i = 0;
|
||||
(void)os;
|
||||
@@ -2005,9 +2004,7 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
|
||||
}
|
||||
else {
|
||||
/* Use native 32 instruction */
|
||||
retVal = HAL_RNG_GenerateRandomNumber(&hrng,
|
||||
(uint32_t*)&output[i]);
|
||||
if (retVal != HAL_OK) {
|
||||
if (HAL_RNG_GenerateRandomNumber(&hrng, (uint32_t*)&output[i]) != HAL_OK) {
|
||||
wolfSSL_CryptHwMutexUnLock();
|
||||
return RAN_BLOCK_E;
|
||||
}
|
||||
|
||||
@@ -2271,7 +2271,10 @@ static int wc_RsaFunctionSync(const byte* in, word32 inLen, byte* out,
|
||||
#endif
|
||||
#ifndef RSA_LOW_MEM
|
||||
if ((mp_count_bits(&key->p) == 1024) &&
|
||||
(mp_count_bits(&key->q) == 1024)) {
|
||||
(mp_count_bits(&key->q) == 1024) &&
|
||||
(mp_count_bits(&key->dP) > 0) &&
|
||||
(mp_count_bits(&key->dQ) > 0) &&
|
||||
(mp_count_bits(&key->u) > 0)) {
|
||||
return sp_RsaPrivate_2048(in, inLen, &key->d, &key->p, &key->q,
|
||||
&key->dP, &key->dQ, &key->u, &key->n,
|
||||
out, outLen);
|
||||
@@ -2302,7 +2305,10 @@ static int wc_RsaFunctionSync(const byte* in, word32 inLen, byte* out,
|
||||
#endif
|
||||
#ifndef RSA_LOW_MEM
|
||||
if ((mp_count_bits(&key->p) == 1536) &&
|
||||
(mp_count_bits(&key->q) == 1536)) {
|
||||
(mp_count_bits(&key->q) == 1536) &&
|
||||
(mp_count_bits(&key->dP) > 0) &&
|
||||
(mp_count_bits(&key->dQ) > 0) &&
|
||||
(mp_count_bits(&key->u) > 0)) {
|
||||
return sp_RsaPrivate_3072(in, inLen, &key->d, &key->p, &key->q,
|
||||
&key->dP, &key->dQ, &key->u, &key->n,
|
||||
out, outLen);
|
||||
@@ -2333,7 +2339,10 @@ static int wc_RsaFunctionSync(const byte* in, word32 inLen, byte* out,
|
||||
#endif
|
||||
#ifndef RSA_LOW_MEM
|
||||
if ((mp_count_bits(&key->p) == 2048) &&
|
||||
(mp_count_bits(&key->q) == 2048)) {
|
||||
(mp_count_bits(&key->q) == 2048) &&
|
||||
(mp_count_bits(&key->dP) > 0) &&
|
||||
(mp_count_bits(&key->dQ) > 0) &&
|
||||
(mp_count_bits(&key->u) > 0)) {
|
||||
return sp_RsaPrivate_4096(in, inLen, &key->d, &key->p, &key->q,
|
||||
&key->dP, &key->dQ, &key->u, &key->n,
|
||||
out, outLen);
|
||||
@@ -2434,7 +2443,13 @@ static int wc_RsaFunctionSync(const byte* in, word32 inLen, byte* out,
|
||||
if (ret == 0 && mp_exptmod(tmp, &key->d, &key->n, tmp) != MP_OKAY)
|
||||
ret = MP_EXPTMOD_E;
|
||||
#else
|
||||
if (ret == 0) {
|
||||
if (ret == 0 && (mp_iszero(&key->p) || mp_iszero(&key->q) ||
|
||||
mp_iszero(&key->dP) || mp_iszero(&key->dQ))) {
|
||||
if (mp_exptmod(tmp, &key->d, &key->n, tmp) != MP_OKAY) {
|
||||
ret = MP_EXPTMOD_E;
|
||||
}
|
||||
}
|
||||
else if (ret == 0) {
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
mp_int* tmpa;
|
||||
mp_int* tmpb = NULL;
|
||||
|
||||
@@ -137,7 +137,7 @@
|
||||
ret = wolfSSL_CryptHwMutexLock();
|
||||
if (ret == 0) {
|
||||
ret = wc_Stm32_Hash_Update(&sha->stmCtx, HASH_AlgoSelection_SHA1,
|
||||
data, len, WC_SHA_BLOCK_SIZE);
|
||||
data, len);
|
||||
wolfSSL_CryptHwMutexUnLock();
|
||||
}
|
||||
return ret;
|
||||
|
||||
@@ -553,7 +553,7 @@ static int InitSha256(wc_Sha256* sha256)
|
||||
ret = wolfSSL_CryptHwMutexLock();
|
||||
if (ret == 0) {
|
||||
ret = wc_Stm32_Hash_Update(&sha256->stmCtx,
|
||||
HASH_AlgoSelection_SHA256, data, len, WC_SHA256_BLOCK_SIZE);
|
||||
HASH_AlgoSelection_SHA256, data, len);
|
||||
wolfSSL_CryptHwMutexUnLock();
|
||||
}
|
||||
return ret;
|
||||
@@ -1384,7 +1384,7 @@ static int InitSha256(wc_Sha256* sha256)
|
||||
ret = wolfSSL_CryptHwMutexLock();
|
||||
if (ret == 0) {
|
||||
ret = wc_Stm32_Hash_Update(&sha224->stmCtx,
|
||||
HASH_AlgoSelection_SHA224, data, len, WC_SHA224_BLOCK_SIZE);
|
||||
HASH_AlgoSelection_SHA224, data, len);
|
||||
wolfSSL_CryptHwMutexUnLock();
|
||||
}
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user