You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In tests only, I would like to be able to inject the randomness so that production Go code can be tested using test vectors for a protocol that builds on top of ML-KEM.
I appreciate how this was done for OAEP, where the library asserts that derandomized OAEP is not happening outside of tests.
If it is acceptable to support derandomized encapsulation, there are a few ways I can think of to do it:
Breaking change to the API (add an optional io.Reader that we read from instead of drbg if not nil, and use boring.UnreachableExceptTests() to ensure that it is only used in tests.
Non-breaking mildly awkward change to the API (add m as a ...byte) that we check is length messageSize and use instead of reading from drbg if not zero-length, and use boring.UnreachableExceptTests() to ensure that it is only not zero-length in tests.
New API (introduce a new EncapsulateWithMyReader (not an actual name suggestion) that reads from an optional io.reader, using drbg if nil, and use boring.UnreachableExceptTests() to ensure that it is only not nil in tests)
The text was updated successfully, but these errors were encountered:
Proposal Details
MLKEM encapsulation takes no arguments and reads
m
fromdrbg
In tests only, I would like to be able to inject the randomness so that production Go code can be tested using test vectors for a protocol that builds on top of ML-KEM.
I appreciate how this was done for OAEP, where the library asserts that derandomized OAEP is not happening outside of tests.
If it is acceptable to support derandomized encapsulation, there are a few ways I can think of to do it:
io.Reader
that we read from instead ofdrbg
if not nil, and useboring.UnreachableExceptTests()
to ensure that it is only used in tests.m
as a...byte
) that we check is lengthmessageSize
and use instead of reading fromdrbg
if not zero-length, and useboring.UnreachableExceptTests()
to ensure that it is only not zero-length in tests.EncapsulateWithMyReader
(not an actual name suggestion) that reads from an optionalio.reader
, usingdrbg
if nil, and useboring.UnreachableExceptTests()
to ensure that it is only not nil in tests)The text was updated successfully, but these errors were encountered: