port: add a wolfCert transport over wolfIP sockets - #171
Conversation
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Pull request overview
Adds a wolfCert WolfCertTransport implementation backed by wolfIP sockets to enable EST/SCEP enrollment on wolfIP targets without BSD sockets.
Changes:
- Introduces
src/port/wolfcert_io.cimplementingconnect/read/write/disconnectoverwolfIP_sock_*plus DNS resolution vianslookup(). - Exposes init/cleanup entry points in
wolfip.hunderWOLFCERT_WOLFIP. - Adds a dedicated
wolfCert-IOunit-test tcase with mocks to exercise the transport glue.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| wolfip.h | Declares wolfCert transport init/cleanup APIs when WOLFCERT_WOLFIP is enabled. |
| src/port/wolfcert_io.c | Implements wolfCert transport callbacks over wolfIP sockets, including DNS polling loops and timeout handling. |
| src/test/unit/unit_tests_wolfcert.c | Adds extensive unit coverage for connect/DNS/read/write/disconnect behaviors. |
| src/test/unit/unit_shared.c | Adds wolfCert IO mocks and includes the port glue to test internal static state. |
| src/test/unit/unit.c | Registers the new wolfCert-IO test case with the unit test suite. |
| src/test/unit/mocks/wolfcert/types.h | Adds minimal mock for WolfCertTransport to keep unit builds free of wolfCert dependency. |
| src/test/unit/mocks/wolfcert/errors.h | Adds minimal mock error codes used by the glue layer. |
| Makefile | Adds wolfCert unit test source(s) (but currently also adds src/port/wolfcert_io.c). |
Suppressed comments (1)
Makefile:1
src/test/unit/unit_shared.cincludes../../port/wolfcert_io.cdirectly (to access internal static state likeio_ctxs). Addingsrc/port/wolfcert_io.ctoUNIT_TEST_SRCScompiles the same translation unit twice, which will cause multiple-definition linker errors forwolfCert_Init_wolfIP/wolfCert_Cleanup_wolfIP.
CC?=gcc
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
5d1c24a to
d5e391d
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #171
Scan targets checked: wolfip-src, wolfip-bugs
Findings: 4
4 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Reported findings require changes before merge.
- src/port/wolfcert_io.c implements WolfCertTransport's connect, read, write and disconnect over wolfIP_sock_*. wolfCert_Init_wolfIP() and wolfCert_Cleanup_wolfIP() take and release a slot in a static context pool holding the stack and a millisecond clock. - connect() resolves through a bounded dotted-quad parser or nslookup(), then pumps wolfIP_poll() until the session is established; disconnect() pumps until the close completes. read() and write() clamp len to INT_MAX, report -WOLFIP_EAGAIN as WANT_READ/WANT_WRITE when timeout_ms is 0 and otherwise pump within a budget, and map -1 to CONN_CLOSED and -WOLFIP_EINVAL to BAD_ARG; read() also maps 0 to CONN_CLOSED. - wolfip.h includes <wolfcert/types.h> and declares both entry points under WOLFCERT_WOLFIP. - unit_shared.c adds scripted wolfIP_sock_*, wolfIP_poll and nslookup mocks over new mocks/wolfcert headers; unit.c registers a wolfCert-IO tcase of 32 tests from unit_tests_wolfcert.c, which the Makefile adds to UNIT_TEST_SRCS alongside wolfcert_io.c. - docs/wolfcert_howto.md documents the integration, listed in docs/API.md and README.md.
d5e391d to
0b65f53
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #171
Scan targets checked: wolfip-src, wolfip-bugs
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.
Background
wolfCert's
WolfCertTransportvtable lets a target without BSD sockets supplyits own transport, but wolfIP had no implementation of it. EST/SCEP enrolment
on wolfIP was therefore impossible: wolfCert's built-in transport calls
close()/send()/recv()on a POSIX fd, while a wolfIP descriptor is anindex into wolfIP's own table — on a hosted build those calls hit an
unrelated file descriptor.
Changes (
src/port/wolfcert_io.c)One glue file implementing the four callbacks over
wolfIP_sock_*, joiningwolfssl_io.c,wolfssh_io.candwolfmqtt_io.c. It carries no TLS code —wolfCert bridges wolfSSL's CBIO onto the same
read/write, so EST overHTTPS, SCEP over HTTPS and SCEP over plain HTTP all ride one transport.
connectresolves a bounded dotted quad locally or vianslookup(),then pumps
wolfIP_poll()aroundwolfIP_sock_connect()until established.read/writecarry the blocking mode intimeout_ms, clamplentoINT_MAX, and never return 0.disconnectpumps until the FIN handshake completes;wolfIP_sock_close()reports
-WOLFIP_EAGAINuntil then, and wolfCert calls it exactly once.> 00(receive only)WOLFCERT_ERR_CONN_CLOSED-1WOLFCERT_ERR_CONN_CLOSED-WOLFIP_EAGAINWANT_READ/WANT_WRITE, or pump and retry-WOLFIP_EINVALWOLFCERT_ERR_BAD_ARGWOLFCERT_ERR_IOwolfip.hdeclares both entry points underWOLFCERT_WOLFIP, anddocs/wolfcert_howto.mddocuments the integration.Tests
32 cases in a
wolfCert-IOtcase. Mockwolfcert/headers keepmake unitfree of any wolfCert dependency, so the glue is compiled and exercised by
every existing CI job.
Verification
-Werror -Wextra -Wdeclaration-after-statement; no libc socket or TLS symbols in the object.wolfcert-server: ESTsimpleenrollissues a certificate, SCEP
GetCACapssucceeds over plain HTTP.Not in this PR
The top-level build target and CI step follow separately. Five limits need
wolfIP API additions rather than glue changes: no connect-status query, so a
refused connection costs the full timeout; no descriptor generation counter,
so a slot reused during a poll is undetectable; no force-release, so a socket
whose peer never completes FIN is abandoned; no DNS cancel; and no per-lookup
DNS context.