Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
129b72c
Decode FORS indices similarly to WOTS
bwesterb May 2, 2023
89e783e
Add derandomized variant crypto_sign_signature_derand
bwesterb May 13, 2026
5701cf9
Add libspx.so target to each implementation Makefile
bwesterb May 13, 2026
86f6e78
Add ACVP harness for NIST SLH-DSA (FIPS-205) test vectors
bwesterb May 13, 2026
e13759b
Drop Haraka
bwesterb May 13, 2026
ef1ec67
Drop "robust" thash variant
bwesterb May 13, 2026
1120d9e
Add FIPS-205 context string + domain-separator prefix
bwesterb May 13, 2026
6d00c8d
Run ACVP in CI; default to all CPUs
bwesterb May 13, 2026
2e13dab
Run ACVP CI matrix over ref, sha2-avx2 and shake-avx2
bwesterb May 13, 2026
1337075
Run ACVP for shake-a64 on ubuntu-24.04-arm
bwesterb May 13, 2026
288587d
Implement HashSLH-DSA (FIPS-205 §10.2.2)
bwesterb May 13, 2026
8dd27f5
Regenerate SHA256SUMS for FIPS-205 KAT outputs
bwesterb May 13, 2026
4cb15c3
README: document SLH-DSA / FIPS-205 status and API
bwesterb May 13, 2026
b2613f9
acvp.py: surface build stderr on failure
bwesterb May 13, 2026
9276903
shake-a64/f1600x2.s: use unified ARMv8 mnemonics; export both symbol …
bwesterb May 13, 2026
b1c8781
shake-a64: rename f1600x2.s to .S and switch label per platform
bwesterb May 13, 2026
5e2d51f
shake-a64/f1600x2.S: tell GNU as about FEAT_SHA3 instructions
bwesterb May 13, 2026
1310cd9
CI: only trigger push runs on master
bwesterb May 13, 2026
7328a14
acvp.py: drop unused xfail/xpass bookkeeping
bwesterb May 13, 2026
ef36d20
Allow addrnd=NULL for FIPS-205 deterministic signing
bwesterb May 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/test-acvp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: ACVP SLH-DSA (FIPS-205) test vectors

on:
push:
branches: [master]
pull_request:

jobs:
acvp:
strategy:
matrix:
include:
- impl: ref
runs-on: ubuntu-latest
- impl: sha2-avx2
runs-on: ubuntu-latest
- impl: shake-avx2
runs-on: ubuntu-latest
- impl: shake-a64
runs-on: ubuntu-24.04-arm
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v1
- name: Install cffi
run: pip install --user cffi
- name: Run ACVP harness
run: python3 acvp.py --impl ${{ matrix.impl }}

# vim: set ft=yaml ts=2 sw=2 et :
33 changes: 0 additions & 33 deletions .github/workflows/test-haraka-aesni.yml

This file was deleted.

19 changes: 8 additions & 11 deletions .github/workflows/test-ref.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: Tests for ref implementation

on:
- push
- pull_request
push:
branches: [master]
pull_request:

jobs:
build:
Expand All @@ -12,26 +13,22 @@ jobs:
hash:
- sha2
- shake
- haraka
size:
- 128
- 192
- 256
option:
- s
- f
thash:
- simple
- robust
steps:
- uses: actions/checkout@v1
- name: Run make
run: |
make -C ref HASH=${{ matrix.hash }} THASH=${{ matrix.thash }} clean
make -C ref HASH=${{ matrix.hash }} THASH=${{ matrix.thash }} PARAMS=sphincs-${{ matrix.hash }}-${{ matrix.size }}${{ matrix.option }} tests
make -C ref HASH=${{ matrix.hash }} THASH=${{ matrix.thash }} PARAMS=sphincs-${{ matrix.hash }}-${{ matrix.size }}${{ matrix.option }} test
make -C ref THASH=${{ matrix.thash }} PQCgenKAT_sign
make -C ref HASH=${{ matrix.hash }} clean
make -C ref HASH=${{ matrix.hash }} PARAMS=sphincs-${{ matrix.hash }}-${{ matrix.size }}${{ matrix.option }} tests
make -C ref HASH=${{ matrix.hash }} PARAMS=sphincs-${{ matrix.hash }}-${{ matrix.size }}${{ matrix.option }} test
make -C ref PQCgenKAT_sign
- name: Run PQCgenKAT_sign
run: python3 vectors.py sphincs-${{ matrix.hash }}-${{ matrix.size }}${{ matrix.option }}-${{ matrix.thash }} ref
run: python3 vectors.py sphincs-${{ matrix.hash }}-${{ matrix.size }}${{ matrix.option }}-simple ref

# vim: set ft=yaml ts=2 sw=2 et :
18 changes: 8 additions & 10 deletions .github/workflows/test-sha2-avx2.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: Tests for sha2-avx2 implementation

on:
- push
- pull_request
push:
branches: [master]
pull_request:

jobs:
build:
Expand All @@ -16,18 +17,15 @@ jobs:
option:
- s
- f
thash:
- simple
- robust
steps:
- uses: actions/checkout@v1
- name: Run make
run: |
make -C sha2-avx2 THASH=${{ matrix.thash }} clean
make -C sha2-avx2 THASH=${{ matrix.thash }} PARAMS=sphincs-sha2-${{ matrix.size }}${{ matrix.option }} tests
make -C sha2-avx2 THASH=${{ matrix.thash }} PARAMS=sphincs-sha2-${{ matrix.size }}${{ matrix.option }} test
make -C sha2-avx2 THASH=${{ matrix.thash }} PARAMS=sphincs-sha2-${{ matrix.size }}${{ matrix.option }} PQCgenKAT_sign
make -C sha2-avx2 clean
make -C sha2-avx2 PARAMS=sphincs-sha2-${{ matrix.size }}${{ matrix.option }} tests
make -C sha2-avx2 PARAMS=sphincs-sha2-${{ matrix.size }}${{ matrix.option }} test
make -C sha2-avx2 PARAMS=sphincs-sha2-${{ matrix.size }}${{ matrix.option }} PQCgenKAT_sign
- name: Run PQCgenKAT_sign
run: python3 vectors.py sphincs-sha2-${{ matrix.size }}${{ matrix.option }}-${{ matrix.thash }} sha2-avx2
run: python3 vectors.py sphincs-sha2-${{ matrix.size }}${{ matrix.option }}-simple sha2-avx2

# vim: set ft=yaml ts=2 sw=2 et :
18 changes: 8 additions & 10 deletions .github/workflows/test-shake-avx2.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: Tests for shake-avx2 implementation

on:
- push
- pull_request
push:
branches: [master]
pull_request:

jobs:
build:
Expand All @@ -16,18 +17,15 @@ jobs:
option:
- s
- f
thash:
- simple
- robust
steps:
- uses: actions/checkout@v1
- name: Run make
run: |
make -C shake-avx2 THASH=${{ matrix.thash }} clean
make -C shake-avx2 THASH=${{ matrix.thash }} PARAMS=sphincs-shake-${{ matrix.size }}${{ matrix.option }} tests
make -C shake-avx2 THASH=${{ matrix.thash }} PARAMS=sphincs-shake-${{ matrix.size }}${{ matrix.option }} test
make -C shake-avx2 THASH=${{ matrix.thash }} PARAMS=sphincs-shake-${{ matrix.size }}${{ matrix.option }} PQCgenKAT_sign
make -C shake-avx2 clean
make -C shake-avx2 PARAMS=sphincs-shake-${{ matrix.size }}${{ matrix.option }} tests
make -C shake-avx2 PARAMS=sphincs-shake-${{ matrix.size }}${{ matrix.option }} test
make -C shake-avx2 PARAMS=sphincs-shake-${{ matrix.size }}${{ matrix.option }} PQCgenKAT_sign
- name: Run PQCgenKAT_sign
run: python3 vectors.py sphincs-shake-${{ matrix.size }}${{ matrix.option }}-${{ matrix.thash }} shake-avx2
run: python3 vectors.py sphincs-shake-${{ matrix.size }}${{ matrix.option }}-simple shake-avx2

# vim: set ft=yaml ts=2 sw=2 et :
31 changes: 22 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
## SPHINCS+
## SPHINCS+ / SLH-DSA

This repository contains the software that accompanies the [SPHINCS+ submission](https://sphincs.org/) to [NIST's Post-Quantum Cryptography](https://csrc.nist.gov/Projects/Post-Quantum-Cryptography) project.
This repository contains the software that accompanies the [SPHINCS+ submission](https://sphincs.org/) to [NIST's Post-Quantum Cryptography](https://csrc.nist.gov/Projects/Post-Quantum-Cryptography) project. SPHINCS+ was standardised by NIST as **SLH-DSA in [FIPS-205](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.205.pdf)** (August 2024); this implementation tracks the standard.

![][test-ref]
![][test-sha256-avx2]
![][test-shake256-avx2]
![][test-haraka-aesni]
![][test-acvp]

### API

The public C entry points in [`ref/api.h`](ref/api.h) follow the FIPS-205 §10.2 surface:

- `crypto_sign_keypair`, `crypto_sign_seed_keypair` — key generation.
- `crypto_sign_signature`, `crypto_sign_signature_derand` — pure SLH-DSA (Alg 22). Both take an explicit context string `(ctx, ctxlen)` up to 255 bytes; pass `NULL, 0` for empty. The `_derand` variant accepts caller-supplied `addrnd` instead of drawing it via `randombytes()`.
- `crypto_sign_signature_prehash`, `crypto_sign_signature_prehash_derand` — HashSLH-DSA (Alg 23). Caller supplies the pre-hashed message and the DER-encoded OID of the pre-hash function.
- `crypto_sign_verify`, `crypto_sign_verify_prehash` — corresponding verifiers.
- `crypto_sign_signature_internal`, `crypto_sign_verify_internal` — the FIPS-205 §10.2 internal cores, taking a raw `(pre, prelen)` prefix buffer that the wrappers construct for the pure / pre-hash entry points.

The combined "signed message" form is also available as `crypto_sign` / `crypto_sign_open` and takes the same `(ctx, ctxlen)` arguments.

Conformance against the NIST [ACVP SLH-DSA test vectors](https://github.com/usnistgov/ACVP-Server/tree/master/gen-val/json-files) is checked by [`acvp.py`](acvp.py); see the `test-acvp` workflow.

### Parameters

The [SPHINCS+ specification](https://sphincs.org/data/sphincs+-specification.pdf) proposed a set of 36 named instances, specifying hash functions and concrete parameters for the security level, tree dimensions, WOTS+ and FORS. This reference implementation allows for more flexibility, as parameters can be specified in a `params.h` file. The proposed parameter sets have been predefined in `ref/params/params-*.h`, and the hash function can be varied by linking with the different implementations of `hash.h`, i.e., `hash_haraka.c`, `hash_sha2.c` and `hash_shake.c`, as well as different implementations of `thash.h`, i.e., `*_robust.c` and `*_simple.c`. This is demonstrated in the `Makefile`. See the table below for a summary of the parameter sets. These parameters target the NIST security categories 1, 3 and 5; for each category, there is a parameter set geared towards either small signatures or fast signature generation.
The [SPHINCS+ specification](https://sphincs.org/data/sphincs+-specification.pdf) proposed a set of named instances, specifying hash functions and concrete parameters for the security level, tree dimensions, WOTS+ and FORS. FIPS-205 (SLH-DSA) standardises the SHA2 and SHAKE families using the "simple" tweakable hash. This reference implementation allows for more flexibility, as parameters can be specified in a `params.h` file. The proposed parameter sets have been predefined in `ref/params/params-*.h`, and the hash function can be varied by linking with the different implementations of `hash.h`, i.e., `hash_sha2.c` and `hash_shake.c`, together with the simple `thash.h` instantiations (`thash_sha2_simple.c` / `thash_shake_simple.c`). This is demonstrated in the `Makefile`. See the table below for a summary of the parameter sets. These parameters target the NIST security categories 1, 3 and 5; for each category, there is a parameter set geared towards either small signatures or fast signature generation.

| | n | h | d | log(t) | k | w | bit security | pk bytes | sk bytes | sig bytes |
| :------------ | -: | -: | -: | -----: | -: | --: | -----------: | -------: | -------: | --------: |
Expand All @@ -28,10 +42,9 @@ and is available under various open source licenses
([Creative Commons Zero v1.0 Universal (CC0-1.0)](LICENSES/CC0-1.0.txt),
[BSD Zero Clause License (0BSD)](LICENSES/0BSD.txt), and
[MIT No Attribution (MIT-0)](LICENSES/MIT-0.txt),
see the [LICENSE file](LICENSE) and the licenses in the [LICENSES folder](LICENSES)), with the exception of `rng.c`, `rng.h` and `PQCgenKAT_sign.c`, which were provided by NIST, and parts of `ref/haraka.c`, which are under
[MIT license (MIT)](LICENSES/MIT.txt).
see the [LICENSE file](LICENSE) and the licenses in the [LICENSES folder](LICENSES)), with the exception of `rng.c`, `rng.h` and `PQCgenKAT_sign.c`, which were provided by NIST.

[test-ref]: https://github.com/sphincs/sphincsplus/actions/workflows/test-ref.yml/badge.svg
[test-sha256-avx2]: https://github.com/sphincs/sphincsplus/actions/workflows/test-sha256-avx2.yml/badge.svg
[test-shake256-avx2]: https://github.com/sphincs/sphincsplus/actions/workflows/test-shake256-avx2.yml/badge.svg
[test-haraka-aesni]: https://github.com/sphincs/sphincsplus/actions/workflows/test-haraka-aesni.yml/badge.svg
[test-sha256-avx2]: https://github.com/sphincs/sphincsplus/actions/workflows/test-sha2-avx2.yml/badge.svg
[test-shake256-avx2]: https://github.com/sphincs/sphincsplus/actions/workflows/test-shake-avx2.yml/badge.svg
[test-acvp]: https://github.com/sphincs/sphincsplus/actions/workflows/test-acvp.yml/badge.svg
48 changes: 12 additions & 36 deletions SHA256SUMS
Original file line number Diff line number Diff line change
@@ -1,36 +1,12 @@
9e1b3168520c917b6de676caa7a5799ec972e55caa150090e8452c80c299545e sphincs-haraka-128f-robust
c6a28dcf0667bd91c7bb46814ac7408c0375727fe5fec7d41332149006d3f9d7 sphincs-haraka-128f-simple
f93f4a554322080545a70f85ce936a12acc2fe928a243e3d13546ffe87872a9e sphincs-haraka-128s-robust
3c9b181d3d96c066039b77e9accd926745fe1ecb010039d3579140b877da6f33 sphincs-haraka-128s-simple
8876bfae8924983db27acfeaee6252d37cea86f05fcc4b16ea2c902d717e6a6e sphincs-haraka-192f-robust
df26bd02796f5ad9d6ff412793960e79ec911cbf4521656814895e6ef5a1db83 sphincs-haraka-192f-simple
6cfde6cb5f9ce93eb3f7b0845e1149f661f92000f54e9d340c0bff504920ec7e sphincs-haraka-192s-robust
64037177e1524f2b2d3ea4a79fdaf9352eb39a3aa6e68bc9d3316b7c2b835820 sphincs-haraka-192s-simple
a838509fa6ec49ade2638efc35d9e29fdb56bd9b843d5e1f48210a2cab218332 sphincs-haraka-256f-robust
e1e3258be6b4467bcea81392363f657a58278a5b99fe240f29e388b0fe72f5da sphincs-haraka-256f-simple
b5c5cc535f03789c25c018c009615ac62ba5b64188e4db5e3ede5513e3704dcc sphincs-haraka-256s-robust
9428a566a2c2ee03665fc0eb2dbf208deb1b28716dc8c2d5e7c036a9f83d31da sphincs-haraka-256s-simple
b6c82007bbce794f9fd67de708cd4d959319c744b918ddb28795fd491b713aa9 sphincs-sha2-128f-robust
708f6ab77f8026361e975f7be7b9b5d1cd8aca56e4a3604c85ef3f9fe6618549 sphincs-sha2-128f-simple
f4c2f31082fc8ad15419edc4f24c34a83d909f75eb37ea5ffe53df0fb5ef5306 sphincs-sha2-128s-robust
65942fac8e225fde77dd277d297e68c94c2e25a2a4089f88be4b56fa92b18a84 sphincs-sha2-128s-simple
b8e617db2099e617dfc372ff732eead88872aea791e2fe82628568d75dd03c78 sphincs-sha2-192f-robust
84b1a342683bcad658efb6c65f7367c6b30623e74e3a24c2238d19eaf74722ab sphincs-sha2-192f-simple
50c4b94dc788446077b48af1d8fa0170dc2114b4cb72a19f1d8c7628f9dadfd6 sphincs-sha2-192s-robust
13efa67b9297afa051b9b30e2686266350c8b4000caa49aa432516e2a86d0b68 sphincs-sha2-192s-simple
dc3330f8f19c816f45ee9a1127bf2b8a8c900e05df9a964bb760f0adf8f9b1b3 sphincs-sha2-256f-robust
46e286dc1a20012789c1bf4793a8eb2043dd0c11df729fa36d9f96b0aeffdac6 sphincs-sha2-256f-simple
1f42b407e1e351861ba23e520b1974f399e349fcb66c614d727a38fb4e646634 sphincs-sha2-256s-robust
c816ca365a667e4d6564a95ac576bc9d7be0de7e66eff93e6f05dd4f134a183f sphincs-sha2-256s-simple
4be71430814589ce7c861030c7cdce0aa73f75885b693b41fdb7c34d8f32fa79 sphincs-shake-128f-robust
5167df2ce46f33b76ccf0688f7769217d91878bd7d9b431080a3032eba51da10 sphincs-shake-128f-simple
fbe6c99d6ccc42fc9af5babbac532f28288d4164b182515dffeb1cd47f351d12 sphincs-shake-128s-robust
e7d5caee1941be99b6dfe46a95fc4535a34792f429e61d1cdc7fd3bbafe9ff02 sphincs-shake-128s-simple
243d0e25de08fea547b0beae5f778a48bd55e56066435f9cdb9afc60a722699e sphincs-shake-192f-robust
f204fd1cd5dce187441d104ae7159b64322b6a4afae708d48dc9966fe418ec4e sphincs-shake-192f-simple
cb13eaa2b1c074f53c87f1025e6bb1b356ad8de3bea9388b90a058a6460766bb sphincs-shake-192s-robust
4cc01c4a562d738ac54f5abfead35ecc4f46a1e2531fa12b4bc2819f4560c351 sphincs-shake-192s-simple
5a736aeba47f8d84e3ca47126715affcb4ce6cef13e3c9f6af220827973aa383 sphincs-shake-256f-robust
127f7ab83c740344546fe30777b221e8cb39f30fc4242d07d7608dc31a9835d4 sphincs-shake-256f-simple
4d2ca7d10f2206c3cb9a26c6b00a0361601a1fe2dddf102fbfd6d3dac0be10fe sphincs-shake-256s-robust
4ce4552e2e9b009a9016eb6dbcbefae3da2de151d61e2f392d4b9517eaeab91d sphincs-shake-256s-simple
0a73b71d53e37fd766986aa599302325f03e601f41bba39c04b773e65824b4f2 sphincs-shake-256s-simple
0fd0f1d5ee6246373a11f89ecf3ff06ae68127f10528f3e8dff7647a08de02bb sphincs-sha2-128s-simple
20810dfc60223fa62e87f9674bac7262599f94eb945b51bb7b29d0f0039c718e sphincs-sha2-192s-simple
4a232f6011f2c377ff4e4c98846b2a29f15b4c604094f6a2f660404e4decfcc4 sphincs-shake-192f-simple
5f67d07311dd675d005518b3e9ccf2ece8b5bd0512faeeac11db96f40473803a sphincs-shake-256f-simple
777b5b84f9624ff34f38d51eb5e062c3f82d4c6828d878648dcf64241d8cb328 sphincs-shake-128s-simple
8661266ed8f7a3caa88b11d231a4b32eadda4fa92467b79328d5d50fe7d5558e sphincs-sha2-192f-simple
96ee57659013ec67dcd29fba7b515628bcdc8f254df76e2aeda7c760475dd99b sphincs-sha2-256f-simple
cc0b2919b41a6390dcc9c79c657ca6b32a917313813f5011191d91cc98026790 sphincs-shake-128f-simple
d64d5fb67206df7e7440386ef2de4870bce57ed48d7cc8c0d0cc4c51a90e0227 sphincs-shake-192s-simple
e11f63d4725ebea381aa1e613a4a94c1c4b58826490cd98b18e3e045be4f10bc sphincs-sha2-256s-simple
e89c1b14d39dcfc3bab4180f9b19164517893e77c3235756623d64fa163e5a13 sphincs-sha2-128f-simple
Loading