Skip to content

[MLDSA] Lax decoding of expanded private keys #10

@romen

Description

@romen

Running wycheproof tests against the bc-rust mldsa implementation I noticed failures in

https://github.com/randombit/wycheproof-rs/blob/master/src/data/mldsa_65_sign_noseed_test.json#L667-L706

(and the analogous ones for MLDSA44/87).

These are about rejecting private keys where the encoded s1/s2 values are out of bounds compared to the legit output of the standardized encode algorithm.

Alg.25 of FIPS 204 has comments about this:

▷ this may lie outside [−𝜂, 𝜂] if input is malformed

I believe the Alg. 25 skDecode function is written without any failure case due to this previous comment:

Note that there exist malformed inputs that can cause skDecode to return values that are not in the correct range. Hence, skDecode should only be run on inputs that come from trusted sources.

But in reality most implementation do try to consider even the encoded secret key material to be input that needs validation: even trusted inputs can be subject to human errors and bit-flips due to cosmic rays :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions