Skip to content

Conversation

@padelsbach
Copy link
Contributor

@padelsbach padelsbach commented Jan 8, 2026

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

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

Copy link
Contributor

Copilot AI left a 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.

Copy link
Contributor

Copilot AI left a 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.

@padelsbach padelsbach force-pushed the crl-generation branch 21 times, most recently from 575cc9c to 42524ec Compare January 13, 2026 18:18
@padelsbach padelsbach marked this pull request as ready for review January 13, 2026 19:24
@cconlon cconlon self-assigned this Jan 14, 2026
@padelsbach padelsbach force-pushed the crl-generation branch 4 times, most recently from 3757923 to 4926b1b Compare January 20, 2026 00:09
@padelsbach padelsbach requested a review from douzzer January 20, 2026 02:17
@padelsbach
Copy link
Contributor Author

Jenkins retest this please

@padelsbach
Copy link
Contributor Author

jenkins retest this please

@padelsbach
Copy link
Contributor Author

jenkins retest this please

src/crl.c Outdated
if (tbsSz < 0) {
WOLFSSL_MSG("wc_MakeCRL_ex failed");
ret = tbsSz;
goto cleanup;
Copy link
Member

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.

Copy link
Contributor Author

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?

Copy link
Member

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>

}
XMEMSET(entry, 0, sizeof(CRL_Entry));

if (wc_InitMutex(&entry->verifyMutex) != 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to wc_FreeMutex() in error cases below for verifyMutex?

src/crl.c Outdated
int tbsSz;
int totalSz;
byte* buf = NULL;
word32 bufSz = 4096; /* Working buffer for TBS + signature */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a chance that 4096 is not large enough for big CRLs with lots of revoked certs? For example a large CA that has 100's of revoked certs or such. Can we detect/calculate the needed size, or make this a user-overridable option via define if not?

src/crl.c Outdated

XMEMCPY(rc->serialNumber, serial, (size_t)serialSz);
rc->serialSz = serialSz;
XMEMCPY(rc->revDate, revDate, MAX_DATE_SIZE);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure that revDate won't be shorter than MAX_DATE_SIZE, so we don't read out of bounds here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will add some checking for robustness

#define X509_CRL_set_signature_nid wolfSSL_X509_CRL_set_signature_nid
#define X509_CRL_set_signature wolfSSL_X509_CRL_set_signature
#define X509_CRL_add_revoked wolfSSL_X509_CRL_add_revoked
#define X509_CRL_add_revoked_cert wolfSSL_X509_CRL_add_revoked_cert
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to add an OpenSSL compat mapping for #define i2d_X509_CRL wolfSSL_i2d_X509_CRL?

@@ -0,0 +1,92 @@
Certificate:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did these new certs get added to our certs/renewcerts.sh script so we can auto-regenerate them? Typically we regenerate test certs at the end of each year.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants