kem: Scheme.DeriveKeyPair length check too strict
- Dominant language
- Go
- Stars
- 1.7k
- Forks
- 219
- Avg merge
- 15h 45m
- Merged PRs (30d)
- 4
Description
`Scheme.DeriveKeyPair` panics if the length of the seed is different from `Scheme.SeedSize`. However, this is too strict: there are use-cases for passing a seed larger than the hash size, for instance [MLS](https://www.rfc-editor.org/rfc/rfc9420.html) passes a 64-byte value to `KEM_X448_HKDF_SHA512` (which has `SeedSize` of 56).
[RFC 9180 section 7.1.3](https://www.rfc-editor.org/rfc/rfc9180.html#section-7.1.3) says:
> For a given KEM, the ikm parameter given to DeriveKeyPair() SHOULD have length at least Nsk, and SHOULD have at least Nsk bytes of entropy.
Would you accept a patch which changes the `len(seed) == x.SeedSize()` check to `len(seed) >= x.SeedSize()`?
Contributor guide
Assessment
This issue has not been assessed yet.