ACVP: Allow skipping pre-hash modes unsupported by Python's hashlib#1140
ACVP: Allow skipping pre-hash modes unsupported by Python's hashlib#1140mkannwischer wants to merge 2 commits into
Conversation
CBMC Results (ML-DSA-87, REDUCE-RAM)Full Results (205 proofs)
|
CBMC Results (ML-DSA-65, REDUCE-RAM)Full Results (205 proofs)
|
CBMC Results (ML-DSA-44, REDUCE-RAM)Full Results (205 proofs)
|
CBMC Results (ML-DSA-87)Full Results (205 proofs)
|
CBMC Results (ML-DSA-44)Full Results (205 proofs)
|
CBMC Results (ML-DSA-65)Full Results (205 proofs)
|
jakemas
left a comment
There was a problem hiding this comment.
Looks good to me! Shall we squash the PR into a single commit?
There was a problem hiding this comment.
I think this could be a bit simpler and more generic.
Can we have a single function which takes a filter on tc,tg and trims down promptData and expectedData in one go, based on the filter?
The filter should be configurable and either pass or return a string explaining why the test is dropped. That string is then simply printed out by the overall filter.
This makes it easier to add other sources of unsupported tests in the future (or to deliberately trim down the ACVP test set for other reasons).
WDYT
Some Python/OpenSSL builds lack the truncated SHA-512 variants (SHA2-512/224, SHA2-512/256) needed for pre-hash ACVP test cases. Add --skip-unsupported to drop the affected cases from both prompt and expected results; without it the client errors with guidance on the flag. Expose it through make via ACVP_OPTIONS. Resolves #719 Signed-off-by: Matthias J. Kannwischer <matthias@zerorisc.com>
Their Python 3.7 hashlib lacks sha512_224/256, so run them with ACVP_OPTIONS=--skip-unsupported instead of disabling quickcheck and acvp entirely. See #719. Signed-off-by: Matthias J. Kannwischer <matthias@zerorisc.com>
269563e to
482527d
Compare
I have pushed a new version. I don't think this qualifies as "simpler", but it should be easier to extend. |
| for tg in unwrap_acvts(promptData).get("testGroups", []): | ||
| for tc in tg["tests"]: | ||
| reason = should_drop(tg, tc) | ||
| if reason is not None: | ||
| drop[tg["tgId"], tc["tcId"]] = reason | ||
| for data in (promptData, expectedData): | ||
| if data is None: | ||
| continue | ||
| for tg in unwrap_acvts(data).get("testGroups", []): | ||
| tg["tests"] = [ | ||
| tc for tc in tg["tests"] if (tg["tgId"], tc["tcId"]) not in drop | ||
| ] |
There was a problem hiding this comment.
Why do we need those loops separately? Why can we not just filter directly in the second loop?
| return h.hexdigest() if xof_len is None else h.hexdigest(xof_len) | ||
|
|
||
|
|
||
| def hashlib_can_compute(hashAlg): |
There was a problem hiding this comment.
Nit: Why don't we filter this just once in the beginning rather than with every test?
Some Python/OpenSSL builds lack the truncated SHA-512 variants
(SHA2-512/224, SHA2-512/256) needed for pre-hash ACVP test cases. Add
--skip-unsupported to drop the affected cases from both prompt and
expected results; without it the client errors with guidance on the
flag. Expose it through make via ACVP_OPTIONS.
sha512_224in hashlib #719