Expand description
Loading test vectors that are not in the repository.
An algorithm is registered experimental rather than available when it is
implemented and nothing has checked it against values produced by something
other than itself. That is not a code problem. It is a files problem, and
this crate exists so that closing it needs no code at all: drop a vector
file in the right place and the tests start checking against it.
It has worked for every algorithm that needed it. ML-KEM-768 and ML-DSA-65
were closed by NIST’s ACVP files and AES-GCM-SIV by RFC 8452 appendix C, and
nothing in the registry is experimental now. What remains is the
mechanism, for whatever is added next. Without one they skip,
loudly enough to be visible and quietly enough not to fail a build that was
never promised the file.
§Where the files go
testvectors/<name>.json, relative to the workspace root, or wherever
IC_TEST_VECTORS points. The format is deliberately not raw ACVP:
{
"algorithm": "aes-kw",
"source": "RFC 3394 section 4.1",
"cases": [
{ "key": "000102...", "pt": "001122...", "ct": "1fa68b..." }
]
}Every field is a hex string, and which fields a case needs is up to the test
reading it. ACVP’s own files nest differently per algorithm and carry a
great deal that is irrelevant here, so converting is a few lines of jq
rather than a parser this crate has to keep up with. testvectors/README.md
records the mapping for each algorithm that wants one.
§Why the skip is loud
A test that silently passes when its input is missing is worse than no test:
it reports success for work nobody did. VectorFile::load returns None
and the callers print what they were looking for, so an absent file shows up
in the output rather than in nothing at all.
Structs§
- Vector
File - A loaded vector file.
Functions§
- hex
- Render bytes as lowercase hex, for comparison messages.
- hex_
field - Decode a hex field from a case, panicking with the field name on failure.
- optional_
hex_ field - An optional hex field.
- vectors_
dir - The directory vector files are read from.