PK callbacks: add build option to give full data to TLS 1.3 RSA-PSS sign callback instead of hash #7823
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.
Description
This PR adds a new define (
TLS13_RSA_PSS_SIGN_CB_NO_PREHASH
) which changes the behavior of the PK callbacks RSA-PSS sign callback only for TLS 1.3. Instead of passing the callback the pre-hashed data, it passes the data itself and lets the callback do the hashing.Some external sign implementations which users may be calling from this callback expect to hash the data themselves prior to the RSA-PSS sign operation.
In TLS 1.3 the "data" that is normally hashed internally by wolfSSL is created in
src/tls13.c
insideCreateSigData()
, and is a concatenation ofPrefix | Label | Handshake Hash
. In TLS versions prior to TLS 1.3, this data is just the handshake hash. This define only changes the behavior for TLS 1.3, and the RSA-PSS sign callback when called from other TLS protocol versions will still pre-hash the data, since it is a running hash of the handshake messages calculated internal to wolfSSL as the handshake progresses.ZD 18349 - User confirmed this worked (9/4/24)
Testing
Tested using the example client/server:
Checklist