Improvements for AES GCM on STM32. Cleanups for STM32 example.

This commit is contained in:
David Garske
2022-10-26 09:43:22 -07:00
parent 0c79ca1de1
commit e26d4f84fc
5 changed files with 130 additions and 76 deletions

View File

@@ -7419,9 +7419,8 @@ int wc_AesGcmEncrypt(Aes* aes, byte* out, const byte* in, word32 sz,
#ifdef STM32_CRYPTO_AES_GCM
/* this function supports inline encrypt */
/* define STM32_AESGCM_PARTIAL for newer STM Cube HAL's with workaround
for handling partial packets to improve auth tag calculation performance by
using hardware */
/* define STM32_AESGCM_PARTIAL for STM HW that does not support authentication
* on byte multiples (see CRYP_HEADERWIDTHUNIT_BYTE) */
static WARN_UNUSED_RESULT int wc_AesGcmEncrypt_STM32(
Aes* aes, byte* out, const byte* in, word32 sz,
const byte* iv, word32 ivSz,
@@ -7528,9 +7527,6 @@ static WARN_UNUSED_RESULT int wc_AesGcmEncrypt_STM32(
#else
hcryp.Init.HeaderSize = authPadSz/sizeof(word32);
#endif
#ifdef STM32_AESGCM_PARTIAL
hcryp.Init.HeaderPadSize = authPadSz - authInSz;
#endif
#ifdef CRYP_KEYIVCONFIG_ONCE
/* allows repeated calls to HAL_CRYP_Encrypt */
hcryp.Init.KeyIVConfigSkip = CRYP_KEYIVCONFIG_ONCE;
@@ -8055,9 +8051,6 @@ static WARN_UNUSED_RESULT int wc_AesGcmDecrypt_STM32(
#else
hcryp.Init.HeaderSize = authPadSz/sizeof(word32);
#endif
#ifdef STM32_AESGCM_PARTIAL
hcryp.Init.HeaderPadSize = authPadSz - authInSz;
#endif
#ifdef CRYP_KEYIVCONFIG_ONCE
/* allows repeated calls to HAL_CRYP_Decrypt */
hcryp.Init.KeyIVConfigSkip = CRYP_KEYIVCONFIG_ONCE;