armv8: enable the SHA-3 extension the ML-KEM assembly needs

The ARM64 ML-KEM port emits eor3, which is not in the base ARMv8-A a toolchain
may be invoked with, and the file carries no directive:

  armv8-mlkem-asm.S: Error: selected processor does not support
                            `eor3 v31.16b,v0.16b,v5.16b,v10.16b'

The directive sits inside WOLFSSL_ARMASM_CRYPTO_SHA3, the guard selecting the
variant that needs it, so a build that has not opted in never asks for it.

The same file's sqrdmlsh deliberately gets none. RDMA is opt-out
(WOLFSSL_AARCH64_NO_SQRDMLSH) where SHA-3 is opt-in, and on a target with no
way to read the ID registers cpuid.c reports it present whenever that macro is
unset. A directive there would turn a build the assembler correctly rejects
into an image that traps on the first sqrdmlsh, so the mnemonic is left to
answer to -mcpu.
pull/11401/head
Tobias Frauenschläger 2026-09-09 08:26:24 +02:00
parent 4d9882bf56
commit 70d28ef42e
3 changed files with 5 additions and 0 deletions

View File

@ -9765,6 +9765,7 @@ L_sha3_aarch64_r:
.quad 0x8000000080008081,0x8000000000008080
.quad 0x0000000080000001,0x8000000080008008
#ifdef WOLFSSL_ARMASM_CRYPTO_SHA3
.arch_extension sha3
#ifndef __APPLE__
.text
.globl mlkem_sha3_blocksx3_crypto

View File

@ -9216,6 +9216,7 @@ L_sha3_aarch64_r
DCQ 0x8000000080008081, 0x8000000000008080
DCQ 0x0000000080000001, 0x8000000080008008
IF :DEF:WOLFSSL_ARMASM_CRYPTO_SHA3
; .arch_extension sha3
AREA |.text|, CODE, READONLY
ALIGN 4
EXPORT mlkem_sha3_blocksx3_crypto

View File

@ -9124,6 +9124,7 @@ void mlkem_sha3_blocksx3_crypto(word64* state)
{
const word64* r = L_sha3_aarch64_r;
__asm__ __volatile__ (
".arch_extension sha3\n\t"
"stp x29, x30, [sp, #-64]!\n\t"
"add x29, sp, #0\n\t"
"str %x[state], [x29, #40]\n\t"
@ -9423,6 +9424,7 @@ void mlkem_shake128_blocksx3_seed_crypto(word64* state, byte* seed)
{
const word64* r = L_sha3_aarch64_r;
__asm__ __volatile__ (
".arch_extension sha3\n\t"
"stp x29, x30, [sp, #-64]!\n\t"
"add x29, sp, #0\n\t"
"str %x[state], [x29, #40]\n\t"
@ -9744,6 +9746,7 @@ void mlkem_shake256_blocksx3_seed_crypto(word64* state, byte* seed)
{
const word64* r = L_sha3_aarch64_r;
__asm__ __volatile__ (
".arch_extension sha3\n\t"
"stp x29, x30, [sp, #-64]!\n\t"
"add x29, sp, #0\n\t"
"str %x[state], [x29, #40]\n\t"