From d31741ec92539e471ee82fce645f88c584ea550a Mon Sep 17 00:00:00 2001 From: Sean Parkinson Date: Wed, 8 Jul 2026 10:42:30 +1000 Subject: [PATCH] FrodoKEM: Initial implementation Supports Fast C code, small C code, small stack and assembly for x86_64, Aarch64, Aarch32, Thumb2. --- .codespellrc | 12 + .github/workflows/pq-all.yml | 42 +- .gitignore | 1 + CMakeLists.txt | 146 + cmake/functions.cmake | 32 + configure.ac | 210 + .../header_files/doxygen_groups.h | 12 + doc/dox_comments/header_files/wc_frodokem.h | 462 + src/include.am | 37 + tests/api.c | 2 + tests/api/include.am | 2 + tests/api/test_frodokem.c | 1472 +++ tests/api/test_frodokem.h | 54 + wolfcrypt/benchmark/benchmark.c | 295 +- wolfcrypt/benchmark/benchmark.h | 1 + wolfcrypt/src/aes_gcm_asm.asm | 194 +- wolfcrypt/src/cpuid.c | 70 +- .../src/port/arm/armv8-32-frodokem-asm.S | 690 ++ .../src/port/arm/armv8-32-frodokem-asm_c.c | 877 ++ wolfcrypt/src/port/arm/armv8-aes-asm.asm | 8229 ++++++++++----- wolfcrypt/src/port/arm/armv8-frodokem-asm.S | 2347 +++++ wolfcrypt/src/port/arm/armv8-frodokem-asm.asm | 1665 ++++ wolfcrypt/src/port/arm/armv8-frodokem-asm_c.c | 1315 +++ wolfcrypt/src/port/arm/thumb2-frodokem-asm.S | 264 + .../src/port/arm/thumb2-frodokem-asm_c.c | 467 + wolfcrypt/src/sha3_asm.S | 8807 +++++++++++++++- wolfcrypt/src/sha3_asm.asm | 8819 ++++++++++++++++- wolfcrypt/src/sp_x86_64_asm.asm | 44 +- wolfcrypt/src/wc_frodokem.c | 1421 +++ wolfcrypt/src/wc_frodokem_asm.S | 1590 +++ wolfcrypt/src/wc_frodokem_asm.asm | 1613 +++ wolfcrypt/src/wc_frodokem_mat.c | 3014 ++++++ wolfcrypt/test/test.c | 163 + wolfssl-VS2022.vcxproj | 16 +- wolfssl.vcxproj | 16 +- wolfssl/wolfcrypt/cpuid.h | 4 + wolfssl/wolfcrypt/include.am | 2 + wolfssl/wolfcrypt/sha3.h | 4 + wolfssl/wolfcrypt/wc_frodokem.h | 328 + wolfssl/wolfcrypt/wc_frodokem_mat.h | 466 + 40 files changed, 42095 insertions(+), 3110 deletions(-) create mode 100644 .codespellrc create mode 100644 doc/dox_comments/header_files/wc_frodokem.h create mode 100644 tests/api/test_frodokem.c create mode 100644 tests/api/test_frodokem.h create mode 100644 wolfcrypt/src/port/arm/armv8-32-frodokem-asm.S create mode 100644 wolfcrypt/src/port/arm/armv8-32-frodokem-asm_c.c create mode 100644 wolfcrypt/src/port/arm/armv8-frodokem-asm.S create mode 100644 wolfcrypt/src/port/arm/armv8-frodokem-asm.asm create mode 100644 wolfcrypt/src/port/arm/armv8-frodokem-asm_c.c create mode 100644 wolfcrypt/src/port/arm/thumb2-frodokem-asm.S create mode 100644 wolfcrypt/src/port/arm/thumb2-frodokem-asm_c.c create mode 100644 wolfcrypt/src/wc_frodokem.c create mode 100644 wolfcrypt/src/wc_frodokem_asm.S create mode 100644 wolfcrypt/src/wc_frodokem_asm.asm create mode 100644 wolfcrypt/src/wc_frodokem_mat.c create mode 100644 wolfssl/wolfcrypt/wc_frodokem.h create mode 100644 wolfssl/wolfcrypt/wc_frodokem_mat.h diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 0000000000..068c4feba6 --- /dev/null +++ b/.codespellrc @@ -0,0 +1,12 @@ +# codespell configuration (read automatically from the repository root). +# +# "SME" is the Arm Scalable Matrix Extension, referenced throughout the +# FrodoKEM Aarch64 code (comments, CPUID_..._SME macros, frodokem_..._sme +# identifiers, "sve2+sme" build strings). codespell's dictionary treats it as +# a misspelling of some/same/sms. The ignore-regex below drops the standalone +# SME token (any case, including "_sme" / "+sme") before spell-checking, while +# still flagging "sme" embedded in a larger alphabetic word - so genuine typos +# are unaffected. Kept out of ignore-words-list so "sme" is not globally +# whitelisted for every file. +[codespell] +ignore-regex = (?i)(? value ("no-