Skip to content

Commit bb4c3a4

Browse files
Armv8.1-M: Add clean x4 Keccak code and SLOTHY Makefile
Add the clean (non-optimized) Keccak x4 assembly and Makefile to enable regeneration of the SLOTHY-optimized assembly. Extend autogen --slothy to support new function, and also add --slothy armv81m and --slothy aarch64 group options. Update CI to only run aarch64 SLOTHY targets. Optimization of Armv8.1-M assembly is not currently tested in CI, but has been tested locally. Update SLOTHY to version 0.1.10 as the code requires disabling the address offset fixup which is not supported for Armv8.1-M in the older versionf of SLOTHY. Co-Authored-By: Brendan Moran <brendan.moran@arm.com> Signed-off-by: Matthias J. Kannwischer <matthias@kannwischer.eu>
1 parent 5504212 commit bb4c3a4

5 files changed

Lines changed: 552 additions & 6 deletions

File tree

.github/workflows/ci_ec2_reusable.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ jobs:
199199
nix-cache: true
200200
nix-shell: slothy
201201
script: |
202-
autogen --slothy
202+
autogen --slothy aarch64
203203
tests all --opt opt
204204
# Force testing of SLOTHY-optimized Keccak variants
205205
# We can't run the examples here because some of them also specify the backend

dev/fips202/armv81m/src/Makefile

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Copyright (c) The mlkem-native project authors
2+
# SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
3+
4+
.PHONY: all purge
5+
.DEFAULT_GOAL := all
6+
7+
# ISA to optimize for
8+
TARGET_ISA=Arm_v81M
9+
10+
# MicroArch target to optimize for
11+
TARGET_MICROARCH=Arm_Cortex_M55
12+
13+
keccak_f1600_x4_mve.S: ../../armv81m_symbolic/keccak_f1600_x4_mve_clean.S
14+
$(eval TMP := $(shell mktemp))
15+
slothy-cli $(TARGET_ISA) $(TARGET_MICROARCH) $< -o $(TMP) \
16+
-s keccak_f1600_x4_mve_asm_roundstart \
17+
-e keccak_f1600_x4_mve_asm_roundend_pre \
18+
-c unsafe_address_offset_fixup=False \
19+
-c inputs_are_outputs=True \
20+
-c constraints.functional_only=True \
21+
-c constraints.allow_reordering=True \
22+
-c constraints.max_displacement=0.1
23+
slothy-cli $(TARGET_ISA) $(TARGET_MICROARCH) $(TMP) -o $@ \
24+
-s keccak_f1600_x4_mve_asm_roundstart \
25+
-e keccak_f1600_x4_mve_asm_roundend_pre \
26+
-c constraints.functional_only=False \
27+
-c constraints.allow_reordering=True \
28+
-c variable_size=True \
29+
-c inputs_are_outputs=True \
30+
-c constraints.stalls_first_attempt=64 \
31+
-c constraints.max_displacement=1.0 \
32+
-c constraints.stalls_maximum_attempt=4096 \
33+
-c unsafe_address_offset_fixup=False \
34+
-c split_heuristic=True \
35+
-c split_heuristic_stepsize=0.05 \
36+
-c split_heuristic_factor=26 \
37+
-c split_heuristic_repeat=2 \
38+
-c split_heuristic_estimate_performance=False \
39+
-c split_heuristic_optimize_seam=2
40+
rm -f $(TMP)
41+
42+
ALL=keccak_f1600_x4_mve.S
43+
44+
all: $(ALL)
45+
46+
purge:
47+
rm -rf $(ALL)

0 commit comments

Comments
 (0)