Repository navigation
Conversation
…ll secret in MLKEMTest In CompositeSignaturesTest.compositeSignaturesTest(), privKey built from the raw sk bytes was overwritten by the key decoded from sk_pkcs8 before signing, leaving the raw-sk signing path untested. Sign and verify with both keys for composite vectors while keeping the single-key path for standalone ML-DSA. In MLKEMTest.testEncapDecap_encapsulation() and testEncapDecapCombinedVectorSet(), replace the prefix-only comparison over secret.length with full-array Arrays.areEqual(k, secret), matching the decapsulation checks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This pull request fixes two test-assertion gaps in the PQC test suite:
CompositeSignaturesTest(prov): IncompositeSignaturesTest(),privKeyis constructed from the rawskbytes, checked for re-encoding, and then overwritten with the key decoded fromsk_pkcs8before signing. As a result, the key built from the rawskencoding is never used to sign. Because all 18 composite test vectors carry the same private key in bothskandsk_pkcs8, this signs and verifies with both keys (privKeyandpkcs8Key) for composite vectors while keeping the single-key path for standalone ML-DSA and leaving the re-encoding check unchanged.MLKEMTest(core): IntestEncapDecap_encapsulation()andtestEncapDecapCombinedVectorSet(), the two encapsulation checks compare the expected shared secretkagainst the generatedsecretonly oversecret.length(Arrays.areEqual(k, 0, secret.length, secret, 0, secret.length)), so an empty or truncatedsecretwith a matching prefix would still pass. This replaces both with full-arrayArrays.areEqual(k, secret), matching the decapsulation checks in the same class.Testing
Compiled
:core:compileTestJavaand:prov:compileTestJavaonmainat6560e91dwith JDK 25 (./gradlew) and ran both test classes againstbc-test-data:org.bouncycastle.pqc.crypto.test.MLKEMTest: 17/17 tests passed (0.308s)org.bouncycastle.jcajce.provider.test.CompositeSignaturesTest: 28/28 tests passed (14.402s)Disclosure
AI tools were used to assist in auditing the test suite and drafting this pull request; all changes were reviewed, compiled, and verified locally.