-
Notifications
You must be signed in to change notification settings - Fork 396
Refactor rsa/add modern hashs in OAEP encrypt-decrypt #833
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
noiser7
wants to merge
29
commits into
softhsm:main
Choose a base branch
from
noiser7:Refactor-RSA/Add-modern-hash-on-OAEP
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
36c5c16
Add OAEP parameter passing
5bd133f
Add Asymmetric encrypt/decrypt parameter
73e5fe2
Refactor RSA/ add OAEP encrypt/decrypt parameters
31b359a
Fix RSA encrypt-decrypt tests
9edab6c
Fix memory leaks and messages
9a03665
Add BuildRSAOAEPParam fuction
eb02aa2
Add OpenSSL 1 support
bb16236
Remove legacy code
69d3118
Fix RSA_set_method call
6c1e1d0
Add PSS salt length setting in VerifyFinal
530cba7
Add salt length setting in one-stage verify
65c0423
Add OAEP encrypt-decrypt parameters for Botan
dd25216
Add asymmetric encrypt-decrypt parameters passing
2f850fc
Fix sourceData pointer check
51450ed
Fix maximum length validation for RSA encryption
49df263
Revert codestyle changes
477e16d
Revert code style changes
e3f93b7
Merge branch 'main' into Refactor-RSA/Add-modern-hash-on-OAEP
noiser7 dfddb57
fix pointer calculation
80f9daa
Fix memory leak on *parameters
deadbc1
Fix OSSL_PARAM_BLD_to_param calling on error
139e2c2
Fix inRSA NULL check before dereference
c7bbcf7
Fix bug wth pointer check
f85d283
Fix maximum key length checking
934ce4d
Check OAEP label length to prevent buffer overflow
65ec656
Check input parameter in setFromOSSL
bc008af
Fix BN free if RSA_new fails
1574ae4
Text format changed
8c8f9a3
Text format changed, debug artifacts removed
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: softhsm/SoftHSMv2
Length of output: 126
🏁 Script executed:
Repository: softhsm/SoftHSMv2
Length of output: 310
🏁 Script executed:
Repository: softhsm/SoftHSMv2
Length of output: 3515
🏁 Script executed:
Repository: softhsm/SoftHSMv2
Length of output: 1895
🏁 Script executed:
Repository: softhsm/SoftHSMv2
Length of output: 450
🏁 Script executed:
Repository: softhsm/SoftHSMv2
Length of output: 826
🏁 Script executed:
Repository: softhsm/SoftHSMv2
Length of output: 2358
🏁 Script executed:
Repository: softhsm/SoftHSMv2
Length of output: 43
🏁 Script executed:
Repository: softhsm/SoftHSMv2
Length of output: 2398
🏁 Script executed:
Repository: softhsm/SoftHSMv2
Length of output: 756
🏁 Script executed:
Repository: softhsm/SoftHSMv2
Length of output: 133
🏁 Script executed:
Repository: softhsm/SoftHSMv2
Length of output: 224
🏁 Script executed:
Repository: softhsm/SoftHSMv2
Length of output: 1319
🏁 Script executed:
Repository: softhsm/SoftHSMv2
Length of output: 875
🏁 Script executed:
Repository: softhsm/SoftHSMv2
Length of output: 139
🏁 Script executed:
Repository: softhsm/SoftHSMv2
Length of output: 22501
🏁 Script executed:
Repository: softhsm/SoftHSMv2
Length of output: 142
🏁 Script executed:
Repository: softhsm/SoftHSMv2
Length of output: 914
Fix pointer arithmetic in
BuildRSAOAEPParam: useparamBufinstead ofparameters.Line 13355 computes
oaep_param.sourceData = (char *)parameters + sizeof(RSA_PKCS_OAEP_PARAMS);, butparametersis avoid **(output parameter). This causessourceDatato reference garbage memory. WhenSession::setParametersdeep-copies this struct and laterOSSLRSA::encryptcallsOPENSSL_memdup(oaepParam->sourceData, ...), it attempts to read from the invalid address, resulting in use-after-free or crash.Change to:
oaep_param.sourceData = (char *)paramBuf + sizeof(RSA_PKCS_OAEP_PARAMS);Also affects lines 3275–3299 (decrypt) and wrap/unwrap operations.
🤖 Prompt for AI Agents