scep: name the issuing CA in the GetCertInitial IssuerAndSubject - #21
Open
yosuke-wolfssl wants to merge 1 commit into
Open
scep: name the issuing CA in the GetCertInitial IssuerAndSubject#21yosuke-wolfssl wants to merge 1 commit into
yosuke-wolfssl wants to merge 1 commit into
Conversation
- wolfcert_scep_issuer_and_subject selects the issuer Name from the envelope-target certificate: its own subject when it sets basic constraints CA, otherwise the name of its issuer. The SEQUENCE length, allocation and copy all use the selected Name, and the parameter is renamed ra_cert_der/ra_cert_len. - The function and its internal.h declaration are WOLFCERT_TEST_VIS, and both doc comments state the selection rule. - tests: make_signed_cert issues a certificate under the make_ca CA with its own subject and an optional CA flag; test_issuer_and_subject_issuer_name checks the built structure for an RA certificate, the CA itself and a sub-CA, comparing both Names byte for byte. Issue: F-8022
There was a problem hiding this comment.
Pull request overview
This PR fixes SCEP GetCertInitial polling in split RA/CA deployments by ensuring the RFC 8894 IssuerAndSubject “issuer” Name identifies the issuing CA (not the RA end-entity), and adds unit coverage for issuer≠subject scenarios.
Changes:
- Update
wolfcert_scep_issuer_and_subject()to select the issuer Name from eithersubjectRaw(CA) orissuerRaw(RA end-entity). - Expose
wolfcert_scep_issuer_and_subject()to in-tree tests viaWOLFCERT_TEST_VISand clarify its contract in comments. - Add new unit-test helpers to create CA-signed certificates (issuer ≠ subject) and validate issuer/subject Name bytes for split-RA, self-signed CA, and sub-CA cases.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/scep/scep_msg.c |
Corrects IssuerAndSubject issuer Name selection (CA vs RA certificate). |
src/internal.h |
Updates internal/test-visible prototype and documentation for IssuerAndSubject builder. |
tests/unit/test_scep_msg.c |
Adds certificate-issuing helper and new unit test covering issuer-name selection across deployment shapes. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
wolfSSL-Fenrir-bot
approved these changes
Aug 21, 2026
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #21
Scan targets checked: wolfcert-bugs, wolfcert-src
No new issues found in the changed files. ✅
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.
Problem
wolfcert_scep_issuer_and_subjectcopied the subject Name out of the certificate it was handed into theissuerfield of the RFC 8894 section 3.3.2IssuerAndSubject, and both call sites passra_cert. In a split RA/CA deployment — Microsoft NDES, or any RA-fronted CA —ra_certis an end-entity RA certificate, so a GetCertInitial poll named the RA instead of the issuing CA. A server that locates a pending request by DN cannot find it, and one that cross-checks the pair rejects the poll outright.That is the deployment where it matters most: an RA with manual approval is what returns
PENDINGand drives a client into GetCertInitial in the first place. Nothing caught it because every test certificate in the tree is self-signed, which makes subject and issuer indistinguishable.Fix (
src/scep/scep_msg.c)The issuer Name is selected from the certificate itself:
ra_certThe third row is why a blind
subjectRaw→issuerRawswap is not the fix: it would name the root instead of the actual issuer.ca_bundleis not consulted —issuerRawalready is the CA's subject DN, byte for byte, so no signature or public API change is needed. The parameter is renamedra_cert_der/ra_cert_lento match what callers pass, and the function isWOLFCERT_TEST_VISso tests can link it.Closes
f-8022.Tests (
tests/unit/test_scep_msg.c)make_signed_cert()issues a certificate under the existingmake_ca()CA with its own subject and a settable CA flag — the first helper in the tree producing issuer ≠ subject.test_issuer_and_subject_issuer_name()builds the structure for all three targets above and compares both Names byte for byte.Verification
ctestpass, includingscep_poll_roundtrip.