scep: keep the caps-driven signing hash within the wolfSSL build - #34
Open
yosuke-wolfssl wants to merge 1 commit into
Open
yosuke-wolfssl wants to merge 1 commit into
yosuke-wolfssl wants to merge 1 commit into
Conversation
- pick_hash_oid() returns SHA512h only under WOLFSSL_SHA512 and SHA384h only under WOLFSSL_SHA384; otherwise it falls through to SHA256h. - test_scep_roundtrip enrolls twice more, once with caps.sha512 and once with caps.sha384 set on a copy of the fetched capabilities. Issue: F-8024
There was a problem hiding this comment.
🟢 Approval recommended
The implementation addresses the compatibility issue; the remaining test-coverage feedback is non-blocking.
Pull request overview
Updates SCEP signing-hash selection to use only SHA-384/SHA-512 algorithms compiled into wolfSSL, falling back to SHA-256 otherwise.
Changes:
- Gates SHA-512 and SHA-384 OID selection on build support.
- Adds round-trip enrollment coverage for advertised hash capabilities.
File summaries
| File | Summary | Review note |
|---|---|---|
tests/integration/test_scep_roundtrip.c |
Adds SHA-512 and SHA-384 capability enrollment tests. | Nit: assertions do not distinguish fallback behavior from the pre-change behavior in standard CI configurations. |
src/scep/scep_client.c |
Restricts caps-driven hash selection to supported wolfSSL algorithms. | — |
Review details
Suppressed comments (1)
tests/integration/test_scep_roundtrip.c:1196
- These assertions do not distinguish the fix from the pre-change behavior in the configurations exercised by CI: with both digest macros enabled, the old selector also succeeds, while the CI matrix has no SCEP roundtrip job with SHA-512/SHA-384 disabled. The regression being fixed—falling back to SHA-256 when an advertised digest is unavailable—is therefore not automatically protected. Please either add a constrained SCEP roundtrip variant or assert the generated PKCS#7 digest OID on the wire.
caps_hash.sha512 = 1;
REQUIRE(wolfcert_scep_pkcs_req(&cli, &caps_hash, ca_der->buffer,
ca_der->length, dk, csr.data, csr.len,
&issued_hash) == WOLFCERT_OK);
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
wolfSSL-Fenrir-bot
requested changes
Sep 17, 2026
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #34
Scan targets checked: wolfcert-src, wolfcert-bugs
Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Reported findings require changes before merge.
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
pick_hash_oid()turned the peer'sGetCACapsanswer straight into a PKCS#7hashOIDwithout intersecting it with the digests wolfSSL was actually builtwith. wolfCert hard-requires only SHA-256 (
wolfcert/check_config.h);SHA-512/SHA-384 are optional, and wolfSSL makes them independently selectable.
Against a CA advertising
SHA-512, a wolfSSL built--disable-sha512selectsSHA512h,wc_PKCS7_SignedDataGetEncAlgoId()leavesalgoId == 0, andwc_PKCS7_EncodeSignedData()returnsBAD_FUNC_ARG. Every SCEP enrollmentfails with a cryptic wolfSSL error instead of falling back to the SHA-256 that
RFC 8894 makes mandatory for both ends.
pick_hash_oid()backsscep_prepare(),so this covers all one-shot and session SCEP message construction.
Closes f-8024.
Fix (
src/scep/scep_client.c)A digest this build lacks falls through to the existing
return SHA256h. Thismirrors the AES-128 / 3DES gating already applied to the caps-driven content
cipher a few lines below, which was the one caps-driven selection left ungated.
Tests (
tests/integration/test_scep_roundtrip.c)Two more enrollments in the existing
scep_roundtrip, withsha512and thensha384set on a copy of the fetched capabilities. Caps are a client-sideinput, so no server change is needed —
check_get_fallback()already clearspost_pki_operationon a copy the same way. No new binary, no buildsystem edit.Verification
-Werror.--disable-sha512 --disable-sha384:scep_roundtripfails attest_scep_roundtrip.c:1196before the fix (BAD_FUNC_ARG, nothing POSTed)and passes after.
that class.
Intentionally not in this PR
which stays true if the caps were ignored and SHA-256 chosen — so the default
build exercises the selection branches without verifying their effect. The
fallback branch the fix targets is covered by the constrained build above.
A
check_content_cipher_wire()analogue for the signing hash was weighed anddeclined as disproportionate to a four-line fix.
src/csr.c.ecdsa_sig_for_curve()andsig_type_for_hash()returnCTC_SHA384*/CTC_SHA512*unguarded. That path is caller-driven (the apppicked P-521 or asked for a 512-bit hash) rather than peer-driven, and it is
reachable:
est_csr_attrs_apply_roundtripfails on the SHA-384-less buildboth before and after this change. Tracked separately.