-
Notifications
You must be signed in to change notification settings - Fork 1k
OpenSSL compat with ML-DSA #10962
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
kojo1
wants to merge
31
commits into
wolfSSL:master
Choose a base branch
from
kojo1:oss_mldsa
base: master
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
OpenSSL compat with ML-DSA #10962
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
8c37dc3
OpenSSL compat with ML-DSA
kojo1 4096b43
Add ML-DSA test coverage for X509_REQ_sign
kojo1 7d55fce
PRIVATE_KEY_UNLOCK to X509 sign/set_pubkey
kojo1 406a297
Dynamic buff size based on expected cert size
kojo1 f9a66fc
Explicit prePopulated flag for d2iTryMlDsaKey
kojo1 bfba0a8
Size X509 gen buffer from subject public key too
kojo1 6edb1b7
Allow NULL md for ML-DSA X509 signing, add test
kojo1 b66ba13
Single gate for ML-DSA X509 signing capability
kojo1 37a54dd
Reset MlDsaKey between decode attempts in X509_set_pubkey
kojo1 0bbb077
PKCS#8 algId check and DER-only typed d2i for ML-DSA
kojo1 429683d
Extend ML-DSA compat test coverage to all levels and untested paths
kojo1 6b81db2
Use mldsa_get_oid_sum for draft-aware OID in X509 signing
kojo1 bff9cfb
Consistency cleanups in new ML-DSA X509 code
kojo1 00a5cf4
Derive WC_MAX_X509_GEN_MLDSA from WC_MAX_X509_GEN
kojo1 d3e3696
Use canonical ML-DSA names in new X509/EVP code
kojo1 55b3214
Test X509_set_pubkey with seed and private-only ML-DSA keys
kojo1 25b1f5e
Guard ML-DSA key/RNG cleanup in tests against Expect short-circuit
kojo1 d21743d
Reset XFILE handle after every close in ML-DSA tests
kojo1 2f84186
Free previous algorithm object when d2i repurposes an EVP_PKEY
kojo1 0fd6544
Do not store failed sigType lookup in sigOID
kojo1 d03be2c
Zeroize pkey.ptr before freeing EVP_PKEY key data
kojo1 59521d5
Note deliberate md tolerance for ML-DSA X509 signing
kojo1 3823ac2
Fix error code check
kojo1 49fbde0
Cover X25519/X448/HKDF/CMAC in d2i_free_prev_key_obj
kojo1 41c760c
Use explicit prePopulated flag in Ed25519/Ed448 d2i helpers
kojo1 525ddda
Move multi-KB test buffers from stack to heap
kojo1 7438353
Use d2i_PUBKEY in Ed25519 reuse regression test
kojo1 359f84a
Use MLDSA_MAX_PUB_KEY_DER_SIZE for SPKI buffers
kojo1 d34c452
Cross-check cached mldsaOID against decoded signing key
kojo1 8a5b56b
Move the description
kojo1 e2681cf
Replace the macro with a small static helper
kojo1 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
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
Oops, something went wrong.
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.
🟡 [Medium] PEM read reuse form leaves the caller's EVP_PKEY pointer dangling on failure
💡 SUGGEST
bugwolfSSL_d2i_PrivateKey->d2i_evp_pkeyunconditionally doeswolfSSL_EVP_PKEY_free(*out); *out = NULL;(wolfcrypt/src/evp_pk.c:1588-1591) before building the replacement. If the subsequent decode fails,d2i_evp_pkeyreturns NULL, andwolfSSL_PEM_read_bio_PrivateKeysets its localpkeyto NULL and skips the*key = pkeywrite becauseerris set. The caller's variable is left pointing at freed memory, and the caller's ownEVP_PKEY_free()is a double free. The mechanism is pre-existing, but this PR is the first to route ML-DSA keys throughwolfSSL_d2i_PrivateKeyfrom the PEM readers, and its newtest_wolfSSL_PEM_PrivateKey_mldsaexplicitly asserts the 'out-parameter reuse form (documented OpenSSL semantics)' while only covering the success path.Suggestion:
Recommendation: Write
*key = NULLon the failure path (or maked2i_evp_pkeynot free*outuntil it has a replacement), and extendtest_wolfSSL_PEM_PrivateKey_mldsawith a negative case: read a valid ML-DSA key intopkey, then a corrupt PEM into the same&pkey, and assert the caller is not left with a freed pointer.