Check SLHDSA_SHA2_128S_sign return value in SLH-DSA sign#14
Open
mohammadmseet-hue wants to merge 1 commit intotink-crypto:mainfrom
Open
Check SLHDSA_SHA2_128S_sign return value in SLH-DSA sign#14mohammadmseet-hue wants to merge 1 commit intotink-crypto:mainfrom
mohammadmseet-hue wants to merge 1 commit intotink-crypto:mainfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
SLHDSA_SHA2_128S_sign returns int (0 on failure, 1 on success), but SlhDsaSignBoringSsl::Sign ignores this return value. If the signing operation fails, the function returns a buffer of uninitialized memory as the signature (the buffer was allocated with ResizeStringUninitialized on line 74). This is inconsistent with the ML-DSA signing code (ml_dsa_sign_boringssl.cc) which correctly checks the return value of MLDSA65_sign/MLDSA87_sign and returns an error status on failure. It is also the same pattern that was fixed in commit 0f1fe03 ("Add missing status checks to EciesHkdfX25519SendKemBoringSsl::GenerateKey"). This fix follows the ML-DSA sign pattern: capture the CallWithCoreDumpProtection return status, check SLHDSA_SHA2_128S_sign return value inside the lambda, and propagate errors.
598a86f to
7ad12a8
Compare
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.
Summary
SlhDsaSignBoringSsl::Sign(slh_dsa_sign_boringssl.cc:79) does not check the return value ofSLHDSA_SHA2_128S_sign, which returnsint(0 on failure, 1 on success per BoringSSL'sinclude/openssl/slhdsa.h).If the signing operation fails, the function returns a buffer of uninitialized memory as the "signature" — the buffer was allocated with
ResizeStringUninitializedon line 74.This is inconsistent with:
ml_dsa_sign_boringssl.cc:126-133) — correctly checksif (!MLDSA65_sign(...)) { return InternalError; }0f1fe03— fixed the same pattern inEciesHkdfX25519SendKemBoringSsl::GenerateKeyImpact
If
SLHDSA_SHA2_128S_signreturns 0 (e.g., due to RNG failure), Tink returns an uninitialized memory buffer as a validStatusOr<string>. This is:Fix
Follow the ML-DSA sign pattern: capture
CallWithCoreDumpProtectionreturn status, checkSLHDSA_SHA2_128S_signreturn value inside the lambda, propagate errors.Test plan