Skip to content

Commit d883a95

Browse files
committed
ML-KEM SHA-3: fix r
Constant r wasn't being loaded into register in all assembly functions that use it - it just got lucky most of the time.
1 parent 070923a commit d883a95

2 files changed

Lines changed: 80 additions & 64 deletions

File tree

wolfcrypt/src/port/arm/armv8-mlkem-asm.S

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10074,6 +10074,13 @@ _mlkem_shake128_blocksx3_seed_neon:
1007410074
stp d10, d11, [x29, #176]
1007510075
stp d12, d13, [x29, #192]
1007610076
stp d14, d15, [x29, #208]
10077+
#ifndef __APPLE__
10078+
adrp x28, L_sha3_aarch64_r
10079+
add x28, x28, :lo12:L_sha3_aarch64_r
10080+
#else
10081+
adrp x28, L_sha3_aarch64_r@PAGE
10082+
add x28, x28, :lo12:L_sha3_aarch64_r@PAGEOFF
10083+
#endif /* __APPLE__ */
1007710084
str x0, [x29, #40]
1007810085
add x0, x0, #32
1007910086
ld1 {v4.d}[0], [x0]
@@ -10414,6 +10421,13 @@ _mlkem_shake256_blocksx3_seed_neon:
1041410421
stp d10, d11, [x29, #176]
1041510422
stp d12, d13, [x29, #192]
1041610423
stp d14, d15, [x29, #208]
10424+
#ifndef __APPLE__
10425+
adrp x28, L_sha3_aarch64_r
10426+
add x28, x28, :lo12:L_sha3_aarch64_r
10427+
#else
10428+
adrp x28, L_sha3_aarch64_r@PAGE
10429+
add x28, x28, :lo12:L_sha3_aarch64_r@PAGEOFF
10430+
#endif /* __APPLE__ */
1041710431
str x0, [x29, #40]
1041810432
add x0, x0, #32
1041910433
ld1 {v4.d}[0], [x0]

0 commit comments

Comments
 (0)