Check SLHDSA_SHA2_128S_sign return value in SLH-DSA sign#14
Open
mohammadmseet-hue wants to merge 1 commit into
Open
Check SLHDSA_SHA2_128S_sign return value in SLH-DSA sign#14mohammadmseet-hue wants to merge 1 commit into
mohammadmseet-hue wants to merge 1 commit into
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. |
mohammadmseet-hue
force-pushed
the
fix/slh-dsa-sign-missing-return-check
branch
from
March 30, 2026 12:04
598a86f to
7ad12a8
Compare
The refactored Sign() dispatches through a SignFunc (int (*)(...)) function pointer but ignores its return value, so a signing failure would return an uninitialized/partial signature buffer as success. Propagate an InternalError when the sign function returns 0.
mohammadmseet-hue
force-pushed
the
fix/slh-dsa-sign-missing-return-check
branch
from
July 24, 2026 13:52
7ad12a8 to
9c61987
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