Skip to content

Add Infineon PSOC Control C3 on-board TPM demo - #12

Open
dgarske wants to merge 1 commit into
wolfSSL:mainfrom
dgarske:psoc_c3_onboard_demo
Open

dgarske wants to merge 1 commit into
wolfSSL:mainfrom
dgarske:psoc_c3_onboard_demo

Conversation

@dgarske

@dgarske dgarske commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

Description

Runs the whole demonstration on the microcontroller: post-quantum signing, a sealed secret bound to a measurement, PCR and endorsement certificate reads, an SPDM session, and the signature authenticating a post-quantum TLS 1.3 handshake. No host takes part in the cryptography; it supplies a screen.

What it adds

  • Infineon/PSoC_Control_C3_Onboard_Demo/ - one firmware image whose acts are selected by a command byte on the console, emitting newline-delimited JSON
  • tpm_io_i2c_c3.c, rng_seed.c - TPM IO over wolfBoot's I2C driver, and a DRBG seeded from the TPM
  • act_tls_sign.c, host/tls/board_tls.c - a Hash-ML-DSA key derived in the TPM, and a TLS 1.3 peer whose signing is delegated to the board through a wolfCrypt crypto callback
  • host/ - browser front end, a command-line driver for the same acts, and test_host.py
  • wolfboot-demo.config, Makefile, patches/, BUILD.md - partitions for this image, a build that works against either wolfTPM SPDM layout, the wolfSSL patch the TLS tab needs, and the build commands

wolfBoot signs and verifies the application; make factory produces one flashable image. wolfTPM is unmodified. Needs wolfSSL/wolfBoot#915

Testing

Validated end to end on a PSOC Control C3 (C3M6) EVK with an Infineon SLB9678 on mikroBUS, firmware 45.91, and rebuilt from nothing on a clean Windows 11 machine.

The TLS tab needs the patch in patches/, which adds an RFC 8446 private-use signature algorithm for the pre-hash ML-DSA this firmware signs, so it is not interoperable with an unpatched peer. BUILD.md pins the wolfSSL revision: current master enforces FIPS 204 section 5.4 and rejects the SHA-256 pre-hash, which is the only one this part will sign with. patches/ carries the opt-in that lifts it, proposed as wolfSSL/wolfssl#11736. The endorsement tab verifies the key match for the P-256 certificate only.

@dgarske dgarske self-assigned this Oct 5, 2026
Copilot AI balanced review requested due to automatic review settings October 5, 2026 23:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Serial timeout and baud defects, unsafe certificate rendering, and incorrect SPDM success reporting can break or misrepresent core demonstrations.

Review effort: Balanced
Findings: 3 High severity · 5 Medium severity · 6 Low severity

Open (14)
What changed in this PR

Adds a complete PSoC Control C3 firmware and host interface for driving an attached TPM over I2C, including ML-DSA, sealing, PCR, endorsement, and SPDM demonstrations.

Changes:

  • Adds MCU firmware, TPM transport, cryptographic acts, diagnostics, and wolfBoot packaging.
  • Adds a browser UI and serial command-line tooling.
  • Documents building, flashing, operation, and measured performance.
File Description
README.md Links and summarizes the demo.
.../​.gitignore Excludes generated artifacts.
.../​BUILD.md Documents build and flashing.
.../​Makefile Builds, signs, and assembles firmware.
.../​README.md Documents firmware acts and benchmarks.
.../​act_sign.c Implements ML-DSA signing and verification.
.../​act_sign.h Declares the signing act.
.../​act_spdm.c Implements the SPDM act.
.../​act_spdm.h Declares the SPDM act.
.../​console_write.c Routes diagnostic output to UART.
.../​demo_acts.c Dispatches console-selected TPM acts.
.../​demo_util.c Provides board, timing, and output utilities.
.../​demo_util.h Declares shared utilities.
.../​fault_report.c Reports MCU faults over UART.
.../​firmware/​reset-board.jlink Resets the MCU and TPM.
.../​heap.c Provides a fixed embedded heap.
.../​i2c_trace.c Records TPM I2C transfers.
.../​i2c_trace.h Declares optional I2C tracing.
.../​mldsa_bench.c Benchmarks ML-DSA verification.
.../​mldsa_onboard.c Runs the standalone signing demonstration.
.../​rng_seed.c Seeds wolfCrypt from the TPM RNG.
.../​tpm_identity.c Reads TPM identity on-device.
.../​tpm_io_i2c_c3.c Implements wolfTPM I2C transport.
.../​user_settings.h Configures ML-DSA verification.
.../​user_settings_tpm.h Configures wolfTPM and SPDM support.
.../​wolfboot-demo.config Defines the enlarged wolfBoot layout.
.../​host/​README.md Documents host operation.
.../​host/​capture-tabs.sh Automates UI screenshots.
.../​host/​onboard.py Drives firmware over serial.
.../​host/​requirements.txt Lists host dependencies.
.../​host/​shot.py Captures headless browser screenshots.
.../​host/​sse_probe.py Probes streamed demo events.
.../​host/​templates/​index.html Implements the browser interface.
.../​host/​x509_lite.py Parses displayed certificate fields.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread Infineon/PSoC_Control_C3_Onboard_Demo/Makefile Outdated
Comment thread Infineon/PSoC_Control_C3_Onboard_Demo/demo_acts.c Outdated
Comment thread Infineon/PSoC_Control_C3_Onboard_Demo/host/templates/index.html
Comment thread Infineon/PSoC_Control_C3_Onboard_Demo/act_spdm.c
Comment thread Infineon/PSoC_Control_C3_Onboard_Demo/host/onboard.py
Comment thread Infineon/PSoC_Control_C3_Onboard_Demo/README.md
Comment thread Infineon/PSoC_Control_C3_Onboard_Demo/host/README.md Outdated
Comment thread Infineon/PSoC_Control_C3_Onboard_Demo/host/templates/index.html Outdated
Comment thread Infineon/PSoC_Control_C3_Onboard_Demo/host/templates/index.html Outdated
Comment thread Infineon/PSoC_Control_C3_Onboard_Demo/host/templates/index.html Outdated
@dgarske
dgarske force-pushed the psoc_c3_onboard_demo branch 6 times, most recently from 60f1d76 to 729124e Compare October 6, 2026 21:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Comment on lines +42 to +49
char *prev = brk;

if ((brk + incr) > (heap + sizeof(heap))) {
errno = ENOMEM;
return (void *)-1;
}
brk += incr;
return prev;
threading.Thread(target=startup_probe, daemon=True).start()
threading.Thread(target=attract_loop, daemon=True).start()
# threaded=True so SSE streams do not block the run endpoint.
APP.run(host="0.0.0.0", port=HTTP_PORT, threaded=True, debug=False)
Comment on lines +343 to +346
restore:
/* Back to the plain device the other acts expect. */
wolfTPM2_Cleanup(dev);
rc = wolfTPM2_Init(dev, TPM2_IoCb, NULL);
Comment on lines +153 to +155
if (hi < 0) {
tls_sign_end(0, "hex");
return;
Comment on lines +88 to +97
if [ ! -d "$WOLFSSL" ]; then
say "fetching wolfssl (section 1)"
# A full wolfssl clone is over a gigabyte and most of it is history
# this never reads. A blobless clone fetches file contents on demand,
# which for one checkout is a small fraction of that.
git clone --filter=blob:none https://github.com/wolfSSL/wolfssl.git \
"$WOLFSSL" || die "could not clone wolfssl"
git -C "$WOLFSSL" checkout --quiet "$WOLFSSL_REV" \
|| die "no such wolfssl revision: $WOLFSSL_REV"
fi

lines = 0
wedged = False
for line in proc.stdout:
REM show never appears.
set TPM_RESET_CMD=powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0..\firmware\reset-board.ps1"

powershell -NoProfile -Command "Get-CimInstance Win32_Process -Filter \"Name='python.exe'\" | Where-Object { $_.CommandLine -like '*server.py*' } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue }"
Comment thread README.md

Runs the whole demonstration on the microcontroller: the MCU drives a TPM 2.0 over I2C and performs post-quantum signing, a sealed secret bound to a measurement, PCR and endorsement certificate reads, and an SPDM session, with no host involved in any of it. A browser front end in [host](/Infineon/PSoC_Control_C3_Onboard_Demo/host) renders what the board reports.

Needs the wolfBoot PSOC Control C3 target: https://github.com/wolfSSL/wolfBoot/pull/915
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.

2 participants