Skip to content

fix(ntt): cross-validate against PQClean reference, add citation provenance#86

Open
erfanjazebnikoo wants to merge 1 commit into
devfrom
ntt/pqclean-reference-validation
Open

fix(ntt): cross-validate against PQClean reference, add citation provenance#86
erfanjazebnikoo wants to merge 1 commit into
devfrom
ntt/pqclean-reference-validation

Conversation

@erfanjazebnikoo

Copy link
Copy Markdown
Member

Summary

Closes a real gap flagged by outside review: the NTT module's known-answer
tests validated the fast NTT against a naive reference multiplication
written for this project, not an independent ground truth. A shared
systematic error (wrong root of unity, wrong modulus constant) in both the
fast and "reference" path would have passed every test.

  • numx_ntt_forward and numx_ntt_polymul are now additionally
    cross-validated bit-for-bit against PQClean's ml-kem-512 (FIPS 203,
    formerly CRYSTALS-Kyber-512) reference implementation. See
    validation/reference/ntt/README.md for the pinned commit, the
    Montgomery-domain reasoning, and regeneration steps. The generator is
    validation tooling only; PQClean is never a build or runtime dependency.
  • Every public function in include/numx/ntt.h (and priv_barrett in
    src/ntt.c) now cites its scientific source inline in the docstring, not
    only in the docs page.
  • docs/algorithms/ntt.md's formula sections now carry inline [n]
    citation markers next to each formula; added the missing Cooley & Tukey
    1965 citation (the Forward NTT section was titled "Cooley-Tukey" but
    never cited them).
  • CONTRIBUTING.md: tightened the L1 test-level definition (crypto/
    security-critical modules need an external, independently-citable
    reference, not an internally-written one) and added a "Citing sources"
    convention covering docstring citations and the
    validation/reference/<module>/ regression-script pattern for future
    modules.

Test plan

  • cmake --build build --target numx_tests clean, zero warnings
    (-Wall -Wextra -Wpedantic -Werror)
  • ctest passes: 339/339 tests, 0 failures
  • New tests test_ntt_forward_vs_pqclean_reference and
    test_ntt_polymul_vs_pqclean_reference confirmed exercising the
    fixture, not skipped

…enance

Closes a self-consistency-only gap: the NTT known-answer tests previously
checked the fast NTT against a naive reference multiplication written for
this project, not an independent ground truth. numx_ntt_forward and
numx_ntt_polymul are now additionally cross-validated bit-for-bit against
PQClean's ml-kem-512 (FIPS 203) reference implementation.

Also adds inline scientific-source citations to every public NTT function's
docstring and to each formula section in docs/algorithms/ntt.md, and
tightens CONTRIBUTING.md's L1 test-level definition and citation
conventions so this is a repeatable practice, not a one-off.
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