kem/hybrid: ensure X25519 hybrids fails with low order points #541
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
X25519 public keys with low order points result in an all-zeroes shared secret. Ensure that hybrids with X25519 and X448 fail during Encapsulate and Decapsulate when the peer provides such a garbage public key.
I discovered this while rebasing our Go fork on Go 1.24 which upgraded the BoGo test suite as part of implementing X25519MLKEM768: golang/go@4b7f7cd#diff-db7320adf5b82005863ef324a30e91235d0268afe79856722226022f3afc2611
That upgrade pulled in this change that adds extra tests for key shares: google/boringssl@ed95627
Without this fix, these
crypto/tls
tests would fail as the TLS handshake continues instead of aborting:I don't think this is a security issue, garbage in, garbage out. Nevertheless, it doesn't hurt to add the extra checks.