Conversation
| const uint8_t *EM, int sLen, int min_sLen) { | ||
| // We have to avoid the underlying SHA services updating the indicator | ||
| // state, so we lock the state here. | ||
| FIPS_service_indicator_lock_state(); |
Contributor
There was a problem hiding this comment.
warning: call to undeclared function 'FIPS_service_indicator_lock_state'; ISO C99 and later do not support implicit function declarations [clang-diagnostic-implicit-function-declaration]
FIPS_service_indicator_lock_state();
^
Contributor
|
🔒 Security Review — View Report Please review before merging. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3470 +/- ##
==========================================
- Coverage 78.36% 78.19% -0.17%
==========================================
Files 700 700
Lines 125744 125784 +40
Branches 17388 17388
==========================================
- Hits 98540 98360 -180
- Misses 26332 26554 +222
+ Partials 872 870 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
justsmth
requested review from
WillChilds-Klein,
jakemas and
nebeid
and removed request for
WillChilds-Klein
September 8, 2026 16:55
RSA_PSS_SALTLEN_AUTO on an EVP_PKEY_RSA_PSS key recovered any salt on verify, bypassing the key's minimum. Check the recovered length against min_saltlen, and keep that restriction across EVP_PKEY_CTX_dup.
justsmth
force-pushed
the
fix/RSA_PSS_SALTLEN_AUTO-min-length
branch
from
September 14, 2026 12:54
6887ca7 to
26a6bb1
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.
Context and motivation
An
EVP_PKEY_RSA_PSSkey can restrict the minimum salt length. That minimum was enforced everywhere exceptRSA_PSS_SALTLEN_AUTO, where verify recovered the salt length from the signature and accepted any value, including zero.EVP_PKEY_CTX_dupalso droppedmin_saltlen, so a duplicated context lost the restriction entirely.Description of changes
RSA_PSS_SALTLEN_AUTOremains settable on a restricted key, but verify now checks the recovered salt length against the key's minimum, plumbed through new module-internal variants ofRSA_verify_pss_mgf1andRSA_verify_PKCS1_PSS_mgf1. The public functions pass "no minimum" and are unchanged.pkey_rsa_copynow propagatesmin_saltlen. The rest is readability: a publicRSA_PSS_SALTLEN_AUTO(-2) alongside the existingRSA_PSS_SALTLEN_DIGEST, replacing the bare-2literals and comments.Two non-obvious points:
EVP_PKEY_CTX_set_rsa_pss_saltlentime for a restricted verify; we accept it and enforce the floor on the recovered length instead, keeping AUTO's meaning intact. So we accept any salt at or above the minimum where OpenSSL requires exactly it, and the failure surfaces fromEVP_PKEY_verifyrather than the setter. Documented there.pkey_pss_initalready rejects a key whose minimum exceeds that maximum, so signatures we produce still verify.Testing
New
EVPExtraTest.RestrictedPssAutoSaltlenHonorsMinimumuseskExampleRSAPSSKeyPKCS8, which omitssaltLengthand so carries the RFC 4055 default minimum of 20. It signs at the RSA layer with salt lengths 0, 1, 19, 20 and 24, then verifies each throughEVP_PKEY_verifywith AUTO set, on both the original and a duplicated context: below the minimum must fail, at or above must pass.Each half of the fix was reverted in turn to confirm the test catches it -- disabling the floor check lets the short-salt signatures verify, dropping the
min_saltlencopy breaks the duplicated context, and turning the floor into an equality test breaks the salt-24 case.Review considerations
EVP_PKEY_RSA_PSSkeys verifying with AUTO, where a verify can now fail that previously succeeded. That is the intent, but it is a tightening.crypto/fipsmodule, and service indicator handling is unchanged.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.