Repository navigation
CSR/CA/X509 refactor and extension support - #285
aidankeefe2022 wants to merge 5 commits into
Conversation
466704f to
0106d36
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #285
Scan targets checked: wolfclu-bugs, wolfclu-src
Findings: 2
2 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Reported findings require changes before merge.
61f1001 to
57ad09f
Compare
|
retest this please |
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #285
Scan targets checked: wolfclu-bugs, wolfclu-src
Fenrir result: Approved ✅
No new issues found in the changed files.
Advisory only — this automated result does not count as a GitHub approval.
Fenrir's latest completed scan found no issues; clearing the prior automated change request.
57ad09f to
a9907cc
Compare
Rework the req, x509 and ca commands and their extension handling, and
extend the x509 request test suite to cover them.
- req: rework option parsing and the CSR/self-sign/CA-sign paths, add
-serial and -CAkey
- config: parse subjectAltName, authorityKeyIdentifier,
subjectKeyIdentifier, keyUsage, extendedKeyUsage and
basicConstraints, from both -addext and config sections
wolfCLU_GetOpt is rewritten as a left-to-right argv walk rather than a
scan of the option table, which the reworked x509 parsing depends on.
That is cross-cutting, so the commands taking positional arguments
(enc, dsaparam, dhparam, genkey, rand, sign/verify) are adapted to it
and wolfCLU_checkForArg now takes a struct option. Commands that only
take flags are untouched.
-addext remains single-use, as on main.
fixed issues from skoll review
scope reduction
a9907cc to
5593db3
Compare
|
rebase |
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved defects can bypass CA constraint overrides in NO_SHA builds and cause private-key loss when output paths refer to the same file.
4 open issues
What changed in this PR
Refactors wolfCLU’s certificate request and issuance workflows and expands extension handling across req, x509, and ca.
Changes:
- Separates CSR creation, self-signing, and CA-signing paths, with stricter option validation and explicit extension-copying controls.
- Expands extension parsing and updates certificate validity, serial generation, and issuer key-identifier handling.
- Adds regression tests and updates command documentation.
| File | Description |
|---|---|
wolfclu/x509/clu_x509_sign.h |
Exposes the shared certificate validity helper. |
wolfclu/x509/clu_cert.h |
Defines validity limits and random serial width. |
wolfclu/clu_optargs.h |
Adds option identifiers for issuance controls. |
wolfclu/clu_header_main.h |
Adds issuer context to extension handling. |
tests/x509/x509-req-test.py |
Expands signing, extension, and option regression coverage. |
tests/x509/x509-ca-test.py |
Tests CA validity bounds. |
src/x509/clu_x509_sign.c |
Shares validity handling and passes issuer context. |
src/x509/clu_request_setup.c |
Refactors request parsing, signing, verification, and output. |
src/x509/clu_config.c |
Expands extension parsing and validation. |
src/x509/clu_cert_setup.c |
Adds bounded validity options and mutation checks. |
src/x509/clu_ca_setup.c |
Tightens option handling and failure cleanup. |
src/clu_main.c |
Adds a comment explaining exit-status normalization. |
manpages/wolfssl-x509.1 |
Documents validity and extension option restrictions. |
manpages/wolfssl-req.1 |
Documents CA issuance and revised request options. |
manpages/wolfssl-ca.1 |
Documents validity bounds. |
Review effort: Balanced
| !wolfSSL_X509_ext_isSet_by_NID(x509, NID_basic_constraints)) { | ||
| WOLFSSL_X509_EXTENSION *newExt; | ||
| WOLFSSL_ASN1_OBJECT *obj; | ||
| #if defined(WOLFSSL_CERT_EXT) && !defined(NO_SHA) |
| if (outKeyBio != NULL && | ||
| XSTRCMP(outKeyFile, outFile) == 0) { |
| * certificate is only written out when -req makes it re-signed. Checked | ||
| * once for both so the two options do not disagree: without this, | ||
| * -extfile exited 0 having quietly dropped every extension asked for. */ | ||
| if (ret == WOLFCLU_SUCCESS && !reqFlag && (extFile != NULL || days > 0)) { |
| case WOLFCLU_CAFILE: | ||
| caFile = optarg; | ||
| break; | ||
|
|
||
| case WOLFCLU_CAKEY: | ||
| caKeyFile = optarg; | ||
| break; | ||
|
|


Rework the req, x509 and ca commands and their extension handling, and extend the x509 request test suite to cover them.
-addext remains single-use, as on main.
fixed issues from skoll review
scope reduction