feat(sig): add derandomized keypair generation for ML-DSA (OQS_SIG_keypair_derand)#2476
Open
systemslibrarian wants to merge 2 commits into
Open
Conversation
Add OQS_SIG_keypair_derand, mirroring the existing OQS_KEM derand API: a
keypair_derand function pointer and length_keypair_seed field on OQS_SIG,
a top-level OQS_SIG_keypair_derand wrapper, and per-scheme
OQS_SIG_ml_dsa_{44,65,87}_keypair_derand backed by FIPS-204
ML-DSA.KeyGen_internal over a 32-byte seed.
- copy_from_upstream: propagate the family-level derandomized_keypair flag
into SIG scheme scope and derive the per-impl derand symbol as
<signature_keypair>_internal (upstream mldsa-native META exposes no
separate derand symbol); guard the whole keypair_derand definition on
derandomized_keypair so non-derand schemes emit neither decl nor def.
- docs: add "Keypair seed size (bytes)" to the SIG parameter-set tables.
- tests: sig_test_derand verifies determinism (same seed -> identical
pk/sk), seed-dependence (different seed -> different keypair), a
sign/verify round-trip on the derived key, and the NULL/unsupported
contract for schemes without derandomized keygen.
Implements open-quantum-safe#2475
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Paul Clark <paul@systemslibrarian.dev>
- fuzz_test_sig: exercise OQS_SIG_keypair_derand under libFuzzer/ASAN - vectors_sig: cross-check derand keygen against FIPS-204 ACVP keyGen known answers (the ACVP seed is xi), proving KeyGen_internal(xi) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Paul Clark <paul@systemslibrarian.dev>
9fe9fe9 to
c729851
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2475.
Summary
Exposes deterministic / derandomized keypair generation for the
OQS_SIGfamily, mirroring the existingOQS_KEMderand API:keypair_derand(pk, sk, seed)function pointer and alength_keypair_seedfield toOQS_SIG, plus a top-levelOQS_SIG_keypair_derand(...)wrapper — the same shapeOQS_KEMalready has.OQS_SIG_ml_dsa_{44,65,87}_keypair_derandover FIPS-204's seed-based keygen (ML-DSA.KeyGen_internal(ξ), a 32-byte seed). For schemes without seed-based keygen,keypair_derandisNULL,length_keypair_seedis0, and the wrapper returnsOQS_ERROR.derandomized_keypairflag throughcopy_from_upstreamso the per-scheme symbol and the decl/def guards are generated, and regenerates the SIG docs (adds the "Keypair seed size (bytes)" column already present on the KEM docs).This unblocks seed/passphrase-recoverable post-quantum signing keys (e.g. deriving an ML-DSA signing key from a BIP-39 mnemonic), which the KEM side already supports via
keypair_derand.Testing (all in CI)
tests/test_sig.c— verifies determinism (same seed → identical pk/sk) and that the derived keypair is functional (sign/verify), plus the NULL-contract for schemes without derand.tests/vectors_sig.c— the ACVP keyGen vector'sseedis exactly FIPS-204's ξ, so this now also feeds it toOQS_SIG_keypair_derandand requires the result to match NIST's known-answer pk/sk — proving the public API really computesKeyGen_internal(ξ). Runs undertests/test_acvp_vectors.py.tests/fuzz_test_sig.c— exercisesOQS_SIG_keypair_derandunder libFuzzer/ASAN where supported.Locally: ACVP keyGen KAT green for ML-DSA-44/65/87 (with a negative control), libFuzzer/ASAN clean,
astyleclean on changed files, andtest_code_conventions.pypasses (265).Version / API checklist
OQS_SIGand a newOQS_SIG_keypair_derandsymbol, mirroringOQS_KEM. No algorithms are added/removed/renamed. Flagging for maintainer judgment on whether oqs-provider / benchmarking-list updates are wanted, given the change is purely additive.Generative AI disclosure
Portions of the test scaffolding and this description were drafted with the help of generative AI (Claude). The contributor has reviewed and verified the changes — including running the ACVP KAT, fuzzer, and convention checks — and affirms them.