-
Notifications
You must be signed in to change notification settings - Fork 577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add NIST's ACVP "External" Signature Tests #4581
base: master
Are you sure you want to change the base?
Add NIST's ACVP "External" Signature Tests #4581
Conversation
This allows controlling all details of how signatures are created, without having to stuff values into the single parameters string which was previously available.
Without this patch, clang seemed to miscompile the retrofitting of the PK_Signer() legacy constructor. valgrind complained about uninitialized memory when building with clang in -O2 and -O3 (didn't test -O1).
Thes are converted to Botan's test vector format and stem from https://github.com/usnistgov/ACVP-Server/tree/master/gen-val/json-files. Due to ML-DSA ACVP SigGen tests not providing the SK seed, we cannot generate the corresponding KATs. This is not an issue for SLH-DSA.
It might be better to run these tests in some offline way, eg a Python script that fetches the JSON from NIST's repo and tests the various signatures. Certainly we can't run them all, and I'm not sure we want to directly ship so much additional data. Alternately to #4500 can start thinking about an actual ACVP client but that's a pile of work and really only makes sense if we're doing a FIPS 140 validation, and I don't have 100K$ lying around that I'd like to set on fire. |
That's a possibility but judging from the last NIST repo update the script would need to be updated with any NIST repo update (e.g. that would add SK seeds). We'd like to at least have some of these tests in the CI, also because these are the only vectors with verification failures and non-empty context strings. We can run the Alternatively we could out-source the larger test vector files to another repository that is only checked out and tested in the CI to reduce the size of shipped files. |
This PR adds vectors extracted from NIST's ACVP KATs for ML-DSA and SLH-DSA, which have recently been updated for the "external" interface of signatures. The parsing is in part taken from Markku-Juhani O. Saarinen's
py-acvp-pqc
repo.Before the update, only the "internal" interface was tested in ACVP. Because no data that would be legal by the external interface was covered by the previous test data, we could not add these tests to DSAs previously. (For ML-KEM, this was already added in #3893).
Since the update of NIST's ACVP KATs also covers the "context" signature parameters of the new PQC standards, this PR also adds KATs for the "context" case being introduced in #4567.
With these tests, Botan's test coverage of ML-DSA and SLH-DSA should increase since ACVP covers many different cases of "wrong" signatures (see the test specs for ML-DSA and SLH-DSA).
Limitations
slh_dsa_acvp_sigver.vec
is5.7M
and thus the largest test file... :( we should discuss if we want to remove some test cases (in this PR I already only take one of each verification failure possibility). Hashing is not possible because it is verification data.202
seconds on my machine. Also here we should discuss if we want to remove some cases (in this PR I already only take one of each random/deterministic and context combination).Outlook
py-acvp-pqc
PR dependencies