docs: verification timing does show which half failed, harmlessly (QA S-06)

The design doc, VerifyingKey::verify and Error::InvalidSignature claimed
that both halves are always checked so timing does not tell which failed.
Not so: a malformed ML-DSA half is refused at decode without verification,
and verify_strict returns early on a bad R (QA measured 59/187/217 us
against 225 us). The docs now say the error does not name the half, the
timing may, and that is fine because verification uses only public data
(RFC 10073 3.3 allows failing early). The `&` and its comment, which
bought nothing (both booleans were already computed), become a plain `&&`.
No behaviour change.
This commit is contained in:
2026-11-26 03:46:47 +01:00
parent 413dbaa279
commit 274cf37d69
3 changed files with 14 additions and 9 deletions
+5 -2
View File
@@ -104,8 +104,11 @@ pub mod sign {
`AppContext` is a newtype that can only be built with the `domi/arcanum/v2/sig/app/` prefix, so a caller can
never pass an empty or foreign context by accident. The bare RFC interface (any ctx, deterministic ML-DSA)
exists only under `hazmat`, for the known-answer tests. Verification returns one error,
`Error::InvalidSignature`, whichever half failed, and checks both halves before answering, so timing does not
tell which component failed (RFC 10073 §3.2).
`Error::InvalidSignature`, whichever half failed. **Correction (QA S-06):** the timing *does* tell which half
failed: a malformed ML-DSA half is refused at decode without being verified, and `verify_strict` returns early
on an undecodable or small-order R (QA measured 59 µs, 187 µs and 217 µs against 225 µs for a valid signature).
That is harmless: verification handles only public data (the message, the public key, the signature), so its
timing leaks nothing secret, and RFC 10073 §3.3 allows failing early. No dummy work is added.
## Tests (written first)