Skip to content

Commit 52e81fa

Browse files
douzzerFrauschi
authored andcommitted
Merge pull request wolfSSL#10311 from dgarske/stm32_gmac
Fix for using STM32 AES hardware crypto with WOLFSSL_ARMASM set
2 parents 1c9555c + e31e158 commit 52e81fa

2 files changed

Lines changed: 41 additions & 19 deletions

File tree

.github/workflows/hostap-vm.yml

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,21 @@ jobs:
7676
with:
7777
path: hostap
7878
key: hostap-repo
79-
lookup-only: true
8079

8180
- name: Checkout hostap
8281
if: steps.cache.outputs.cache-hit != 'true'
8382
run: git clone https://w1.fi/hostap.git hostap
8483

84+
- name: tar hostap
85+
run: tar -zcf hostap.tgz hostap
86+
87+
- name: Upload hostap repo
88+
uses: actions/upload-artifact@v4
89+
with:
90+
name: hostap-repo
91+
path: hostap.tgz
92+
retention-days: 1
93+
8594
build_uml_linux:
8695
name: Build UML (UserMode Linux)
8796
if: github.repository_owner == 'wolfssl'
@@ -96,15 +105,16 @@ jobs:
96105
with:
97106
path: linux/linux
98107
key: hostap-linux-${{ env.LINUX_REF }}
99-
lookup-only: true
100108

101-
- name: Checking if we have hostap in cache
109+
- name: Download hostap repo
102110
if: steps.cache.outputs.cache-hit != 'true'
103-
uses: actions/cache/restore@v4
111+
uses: actions/download-artifact@v4
104112
with:
105-
path: hostap
106-
key: hostap-repo
107-
fail-on-cache-miss: true
113+
name: hostap-repo
114+
115+
- name: untar hostap
116+
if: steps.cache.outputs.cache-hit != 'true'
117+
run: tar -xf hostap.tgz
108118

109119
- name: Checkout linux
110120
if: steps.cache.outputs.cache-hit != 'true'
@@ -122,6 +132,13 @@ jobs:
122132
cd linux
123133
yes "" | ARCH=um make -j $(nproc)
124134
135+
- name: Upload kernel binary
136+
uses: actions/upload-artifact@v4
137+
with:
138+
name: uml-linux-kernel
139+
path: linux/linux
140+
retention-days: 1
141+
125142
hostap_test:
126143
strategy:
127144
fail-fast: false
@@ -170,13 +187,11 @@ jobs:
170187
timeout-minutes: 45
171188
needs: [build_wolfssl, build_uml_linux, checkout_hostap]
172189
steps:
173-
- name: Checking if we have kernel in cache
174-
uses: actions/cache/restore@v4
175-
id: cache
190+
- name: Download kernel binary
191+
uses: actions/download-artifact@v4
176192
with:
177-
path: linux/linux
178-
key: hostap-linux-${{ env.LINUX_REF }}
179-
fail-on-cache-miss: true
193+
name: uml-linux-kernel
194+
path: linux
180195

181196
# No way to view the full strategy in the browser (really weird)
182197
- name: Print strategy
@@ -215,12 +230,13 @@ jobs:
215230
- name: Install pip dependencies
216231
run: sudo pip install pycryptodome
217232

218-
- name: Checking if we have hostap in cache
219-
uses: actions/cache/restore@v4
233+
- name: Download hostap repo
234+
uses: actions/download-artifact@v4
220235
with:
221-
path: hostap
222-
key: hostap-repo
223-
fail-on-cache-miss: true
236+
name: hostap-repo
237+
238+
- name: untar hostap
239+
run: tar -xf hostap.tgz
224240

225241
- name: Checkout correct ref
226242
working-directory: hostap

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)