-
Notifications
You must be signed in to change notification settings - Fork 922
Add CRL generation code #9631
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
base: master
Are you sure you want to change the base?
Add CRL generation code #9631
Conversation
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
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.
Pull request overview
Copilot reviewed 10 out of 11 changed files in this pull request and generated 11 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
575cc9c to
42524ec
Compare
src/crl.c
Outdated
| if (tbsSz < 0) { | ||
| WOLFSSL_MSG("wc_MakeCRL_ex failed"); | ||
| ret = tbsSz; | ||
| goto cleanup; |
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.
I suggest refactoring out goto, as per coding standards unless absolutely necessary.
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.
I see over 600 uses of goto from various developers in the code base, many touched/added within the last year and even a few from 2026. How rigorous should we be here?
I'm guessing do { ... } while(0); is also frowned upon?
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.
I interpret our coding standard rule of "Avoid gotos unless absolutely necessary" to be worded strictly. In my opinion until a day that changes, PR reviewers should be enforcing it when reviewing new code and changes to existing code.
One common practice used instead of goto for us is falling through with ret checks like so:
ret = func_call();
if (ret == 0) {
ret = func2_call();
}
if (ret == 0) {
ret = func3_call();
}
<cleanup logic>
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.
Should we consider a different solution rather than SIGN_CRL_CLEANUP(). That does avoid goto, but also seems error prone in that future devs may forget to go update that macro to free new/needed things if changing that function.
327b4a4 to
21eb421
Compare
cconlon
left a comment
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.
Thanks, just a few more small items
|
|
||
| ret = AddSignature(NULL, tbsSz, &sigDummy, sigSz, sigType); | ||
| if (ret < 0) { | ||
| ret = tbsSz + sigSz + 64; |
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.
Does this + 64 have a meaning or is a known size? Maybe a small comment if so would be helpful.
src/crl.c
Outdated
| entry->lastDate, entry->lastDateFormat, | ||
| entry->nextDate, entry->nextDateFormat, | ||
| entry->certs, entry->totalCerts, | ||
| entry->crlNumberSet ? (const byte*)entry->crlNumber : NULL, |
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.
Please take a pass and shorten/wrap all lines longer than 80 chars, thanks
src/crl.c
Outdated
| } | ||
|
|
||
| /* Build to-be-signed (TBS) portion of the CRL buffer. | ||
| * Note that we pass the fields rather than the CRL_entry struct so |
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.
This and a few other comments in this file needs backing up a few spaces to line up
21eb421 to
4aaf567
Compare
Description
Add ability to generate a certificate revocation list (CRL), in addition to the existing CRL decode logic.
Testing
New unit test in C, and new test script which uses openssl to validate the output.
Checklist