fix to free CRL reason extension#9974
Open
JacobBarthelmeh wants to merge 1 commit intowolfSSL:masterfrom
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a memory leak reported by OSS-Fuzz when parsing CRLs that contain per-revoked-entry reason extensions, and adds a regression test plus test fixtures to exercise the affected cleanup path.
Changes:
- Free revoked-entry extensions during
FreeDecodedCRL()teardown underOPENSSL_EXTRA. - Add an API test that loads a CRL containing a revoked-entry reason extension to validate cleanup.
- Add/generate and distribute a new CRL fixture (
crl_reason.pem) used by the test.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| wolfcrypt/src/asn.c | Frees revoked certificate extensions during CRL decode cleanup to address a leak. |
| tests/api/test_certman.h | Registers a new CRL cleanup regression test in the certman test group. |
| tests/api/test_certman.c | Adds a regression test that loads a CRL with reason-code entry extensions. |
| certs/renewcerts.sh | Documents the newly added CRL fixture in the cert renewal script header comment. |
| certs/crl/include.am | Distributes the new CRL fixture as part of EXTRA_DIST. |
| certs/crl/gencrls.sh | Adds steps to generate the new “reason extension” CRL fixture. |
| certs/crl/crl_reason.pem | Adds the CRL fixture used by the new regression test. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+1
to
+4
| Certificate Revocation List (CRL): | ||
| Version 2 (0x1) | ||
| Signature Algorithm: sha256WithRSAEncryption | ||
| Issuer: C=US, ST=Montana, L=Bozeman, O=Sawtooth, OU=Consulting, CN=www.wolfssl.com, emailAddress=info@wolfssl.com |
Comment on lines
+284
to
+297
| echo "Step 37 reason-extension CRL revoke" | ||
| openssl ca -config ../renewcerts/wolfssl.cnf -revoke ../server-cert.pem \ | ||
| -crl_reason keyCompromise -keyfile ../ca-key.pem -cert ../ca-cert.pem | ||
| check_result $? | ||
|
|
||
| echo "Step 38 reason-extension CRL" | ||
| openssl ca -config ../renewcerts/wolfssl.cnf -gencrl -crldays 3650 \ | ||
| -out crl_reason.pem -keyfile ../ca-key.pem -cert ../ca-cert.pem | ||
| check_result $? | ||
|
|
||
| # metadata | ||
| echo "Step 39" | ||
| openssl crl -in crl_reason.pem -text > tmp | ||
| check_result $? |
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.
Fix for oss-fuzz leak report https://oss-fuzz.com/testcase-detail/5890885517901824