mirror of https://github.com/wolfSSL/wolfssl.git
Merge pull request #6289 from jpbland1/nuttx-hw-acel
Nuttx hw acel benchmark with STM32_HW_CLOCK_AUTOpull/6455/head
commit
dcfa410540
|
@ -417,6 +417,7 @@ block cipher mechanism that uses n-bit binary string parameter key with 128-bits
|
||||||
CRYP_Cmd(DISABLE);
|
CRYP_Cmd(DISABLE);
|
||||||
#endif /* WOLFSSL_STM32_CUBEMX */
|
#endif /* WOLFSSL_STM32_CUBEMX */
|
||||||
wolfSSL_CryptHwMutexUnLock();
|
wolfSSL_CryptHwMutexUnLock();
|
||||||
|
wc_Stm32_Aes_Cleanup();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -520,6 +521,7 @@ block cipher mechanism that uses n-bit binary string parameter key with 128-bits
|
||||||
CRYP_Cmd(DISABLE);
|
CRYP_Cmd(DISABLE);
|
||||||
#endif /* WOLFSSL_STM32_CUBEMX */
|
#endif /* WOLFSSL_STM32_CUBEMX */
|
||||||
wolfSSL_CryptHwMutexUnLock();
|
wolfSSL_CryptHwMutexUnLock();
|
||||||
|
wc_Stm32_Aes_Cleanup();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -3562,6 +3564,7 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
|
||||||
HAL_CRYP_DeInit(&hcryp);
|
HAL_CRYP_DeInit(&hcryp);
|
||||||
|
|
||||||
wolfSSL_CryptHwMutexUnLock();
|
wolfSSL_CryptHwMutexUnLock();
|
||||||
|
wc_Stm32_Aes_Cleanup();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -3624,6 +3627,7 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
|
||||||
|
|
||||||
HAL_CRYP_DeInit(&hcryp);
|
HAL_CRYP_DeInit(&hcryp);
|
||||||
wolfSSL_CryptHwMutexUnLock();
|
wolfSSL_CryptHwMutexUnLock();
|
||||||
|
wc_Stm32_Aes_Cleanup();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -3708,6 +3712,7 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
|
||||||
/* disable crypto processor */
|
/* disable crypto processor */
|
||||||
CRYP_Cmd(DISABLE);
|
CRYP_Cmd(DISABLE);
|
||||||
wolfSSL_CryptHwMutexUnLock();
|
wolfSSL_CryptHwMutexUnLock();
|
||||||
|
wc_Stm32_Aes_Cleanup();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -3802,6 +3807,7 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
|
||||||
/* disable crypto processor */
|
/* disable crypto processor */
|
||||||
CRYP_Cmd(DISABLE);
|
CRYP_Cmd(DISABLE);
|
||||||
wolfSSL_CryptHwMutexUnLock();
|
wolfSSL_CryptHwMutexUnLock();
|
||||||
|
wc_Stm32_Aes_Cleanup();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -4562,6 +4568,7 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
|
||||||
#endif /* WOLFSSL_STM32_CUBEMX */
|
#endif /* WOLFSSL_STM32_CUBEMX */
|
||||||
|
|
||||||
wolfSSL_CryptHwMutexUnLock();
|
wolfSSL_CryptHwMutexUnLock();
|
||||||
|
wc_Stm32_Aes_Cleanup();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6708,6 +6715,7 @@ static WARN_UNUSED_RESULT int wc_AesGcmEncrypt_STM32(
|
||||||
ret = AES_GCM_AUTH_E;
|
ret = AES_GCM_AUTH_E;
|
||||||
#endif /* WOLFSSL_STM32_CUBEMX */
|
#endif /* WOLFSSL_STM32_CUBEMX */
|
||||||
wolfSSL_CryptHwMutexUnLock();
|
wolfSSL_CryptHwMutexUnLock();
|
||||||
|
wc_Stm32_Aes_Cleanup();
|
||||||
|
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
/* return authTag */
|
/* return authTag */
|
||||||
|
@ -7242,6 +7250,7 @@ static WARN_UNUSED_RESULT int wc_AesGcmDecrypt_STM32(
|
||||||
XMEMCPY(tag, partialBlock, authTagSz);
|
XMEMCPY(tag, partialBlock, authTagSz);
|
||||||
#endif /* WOLFSSL_STM32_CUBEMX */
|
#endif /* WOLFSSL_STM32_CUBEMX */
|
||||||
wolfSSL_CryptHwMutexUnLock();
|
wolfSSL_CryptHwMutexUnLock();
|
||||||
|
wc_Stm32_Aes_Cleanup();
|
||||||
|
|
||||||
/* Check authentication tag */
|
/* Check authentication tag */
|
||||||
if (ConstantCompare((const byte*)tagExpected, (byte*)tag, authTagSz) != 0) {
|
if (ConstantCompare((const byte*)tagExpected, (byte*)tag, authTagSz) != 0) {
|
||||||
|
|
|
@ -394,6 +394,10 @@ int wc_Stm32_Aes_Init(Aes* aes, CRYP_HandleTypeDef* hcryp)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
word32 keySize;
|
word32 keySize;
|
||||||
|
#ifdef STM32_HW_CLOCK_AUTO
|
||||||
|
/* enable the peripheral clock */
|
||||||
|
__HAL_RCC_CRYP_CLK_ENABLE();
|
||||||
|
#endif
|
||||||
|
|
||||||
ret = wc_AesGetKeySize(aes, &keySize);
|
ret = wc_AesGetKeySize(aes, &keySize);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
|
@ -428,6 +432,13 @@ int wc_Stm32_Aes_Init(Aes* aes, CRYP_HandleTypeDef* hcryp)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wc_Stm32_Aes_Cleanup(void)
|
||||||
|
{
|
||||||
|
#ifdef STM32_HW_CLOCK_AUTO
|
||||||
|
/* disable the peripheral clock */
|
||||||
|
__HAL_RCC_CRYP_CLK_DISABLE();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
#else /* Standard Peripheral Library */
|
#else /* Standard Peripheral Library */
|
||||||
|
|
||||||
int wc_Stm32_Aes_Init(Aes* aes, CRYP_InitTypeDef* cryptInit,
|
int wc_Stm32_Aes_Init(Aes* aes, CRYP_InitTypeDef* cryptInit,
|
||||||
|
@ -486,6 +497,10 @@ int wc_Stm32_Aes_Init(Aes* aes, CRYP_InitTypeDef* cryptInit,
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wc_Stm32_Aes_Cleanup(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
#endif /* WOLFSSL_STM32_CUBEMX */
|
#endif /* WOLFSSL_STM32_CUBEMX */
|
||||||
#endif /* !NO_AES */
|
#endif /* !NO_AES */
|
||||||
#endif /* STM32_CRYPTO */
|
#endif /* STM32_CRYPTO */
|
||||||
|
|
|
@ -168,9 +168,11 @@ int wc_Stm32_Hash_Final(STM32_HASH_Context* stmCtx, word32 algo,
|
||||||
struct Aes;
|
struct Aes;
|
||||||
#ifdef WOLFSSL_STM32_CUBEMX
|
#ifdef WOLFSSL_STM32_CUBEMX
|
||||||
int wc_Stm32_Aes_Init(struct Aes* aes, CRYP_HandleTypeDef* hcryp);
|
int wc_Stm32_Aes_Init(struct Aes* aes, CRYP_HandleTypeDef* hcryp);
|
||||||
|
void wc_Stm32_Aes_Cleanup(void);
|
||||||
#else /* Standard Peripheral Library */
|
#else /* Standard Peripheral Library */
|
||||||
int wc_Stm32_Aes_Init(struct Aes* aes, CRYP_InitTypeDef* cryptInit,
|
int wc_Stm32_Aes_Init(struct Aes* aes, CRYP_InitTypeDef* cryptInit,
|
||||||
CRYP_KeyInitTypeDef* keyInit);
|
CRYP_KeyInitTypeDef* keyInit);
|
||||||
|
void wc_Stm32_Aes_Cleanup(void);
|
||||||
#endif /* WOLFSSL_STM32_CUBEMX */
|
#endif /* WOLFSSL_STM32_CUBEMX */
|
||||||
#endif /* !NO_AES */
|
#endif /* !NO_AES */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue