Skip to content

Fix SHAKE on big-endian platforms and add aarch64_be CI - #55

Open
mkannwischer wants to merge 5 commits into
mainfrom
fix-shake-big-endian
Open

mkannwischer wants to merge 5 commits into
mainfrom
fix-shake-big-endian

Conversation

@mkannwischer

Copy link
Copy Markdown
Contributor

SHAKE gave wrong results on big-endian targets: the Keccak state was accessed bytewise, but keccak_f1600() works on native-endian lanes. All SHAKE keyGen/sigGen ACVP tests failed on aarch64_be.

  • Add SLH_SYS_{LITTLE,BIG}_ENDIAN detection (from mlkem-native)
  • Port keccakf1600_{xor,extract}_bytes from mlkem-native and use them for all byte access to the Keccak state; portable fallback if endianness is unknown
  • CI: add aarch64_be cross tests under qemu (toolchain from mlkem-native)

Overlaps with #52 in slh_sys.h.

@mkannwischer mkannwischer changed the title Fix SHAKE on big-endian and add aarch64_be CI Fix SHAKE on big-endian platforms and add aarch64_be CI Oct 13, 2026
Signed-off-by: Matthias J. Kannwischer <matthias@zerorisc.com>
Port SLH_SYS_{LITTLE,BIG}_ENDIAN from mlkem-native's sys.h.

Signed-off-by: Matthias J. Kannwischer <matthias@zerorisc.com>
Port keccakf1600_{xor,extract}_bytes from mlkem-native and use them
for all byte access to the Keccak state.

Signed-off-by: Matthias J. Kannwischer <matthias@zerorisc.com>
Port the aarch64_be toolchain from mlkem-native and run the ACVP
tests under qemu-aarch64_be.

Signed-off-by: Matthias J. Kannwischer <matthias@zerorisc.com>
The nix gcc builds fail to run on current macOS runners (duplicate LC_RPATH).

Signed-off-by: Matthias J. Kannwischer <matthias@zerorisc.com>
@mkannwischer

Copy link
Copy Markdown
Contributor Author

@dstebila, could I ask you for a review for this bug fix, please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant