Skip to content

Commit e31e158

Browse files
committed
Fix for using STM32 AES hardware crypto with WOLFSSL_ARMASM set (ZD 21262)
1 parent 1c9555c commit e31e158

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

wolfcrypt/src/aes.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7707,7 +7707,13 @@ int wc_AesGcmSetKey(Aes* aes, const byte* key, word32 len)
77077707
return ret;
77087708
#endif /* WOLFSSL_RENESAS_RSIP && WOLFSSL_RENESAS_FSPSM_CRYPTONLY*/
77097709

7710-
#if defined(WOLFSSL_ARMASM)
7710+
/* GCM setup needs one AES block encrypt of the all-zero IV to generate
7711+
* the hash subkey H. STM32_CRYPTO stores only the raw key (no expanded
7712+
* key schedule), so the ARMASM AES_ECB_encrypt helpers used here cannot
7713+
* be used. Excluding STM32_CRYPTO from this block falls back to the
7714+
* non-ARMASM wc_AesEncrypt implementation, which on STM32 routes to
7715+
* CRYP. */
7716+
#if defined(WOLFSSL_ARMASM) && !defined(STM32_CRYPTO)
77117717
if (ret == 0) {
77127718
#ifndef WOLFSSL_ARMASM_NO_HW_CRYPTO
77137719
#if !defined(__aarch64__)

0 commit comments

Comments
 (0)