Repository navigation
Conversation
|
Thanks @dgarske, I tested #656 (0d35f1d) against master (d7f73b5) and it resolves #648–#653. #654 is mostly resolved: see the note below. Reproductions. Both servers were built with
End to end. I also ran the tpm2-pkcs11 stack you mention in the PR's notes. That was released tpm2-pkcs11 1.10.1 on tpm2-tss 4.2.0, driven by a C# PKCS#11 suite of 642 cases. It ran on both tpm2-pkcs11 store backends (esysdb and FAPI), and on both the classic and
These results are without any of the local patches I had been applying to fwTPM for #648–#652, so I can drop them. One note on #654. A clear |
|
Hi @AlexLaroche thank you for that feedback! I've pushed updates. Can you take another look? Thanks, David Garske, wolfSSL |
embhorn
left a comment
There was a problem hiding this comment.
Skoll Multi-Scan Review
Modes: review + review-security
Overall recommendation: REQUEST_CHANGES
Findings: 6 total — 6 posted, 0 skipped
6 finding(s) posted as inline comments (see file-level comments below)
Posted findings
- [High] [review] Legacy persistent-object children can no longer be context-saved —
src/fwtpm/fwtpm_command.c:5844-5848 - [High] [review] Any signing failure on a zero digest becomes a parameter error —
src/fwtpm/fwtpm_crypto.c:3990-3995 - [High] [review] RSA SHA-3 schemes silently use MGF1-SHA256 —
src/fwtpm/fwtpm_crypto.c:94-107 - [Medium] [review-security] Fresh TPM reports Clock as unsafe for its first update interval —
src/fwtpm/fwtpm.c:41-47 - [Medium] [review-security] OAEP now selects MGF1 from the scheme hash —
src/fwtpm/fwtpm_crypto.c:85-88 - [Medium] [review-security] SHA-3 RSA falls back to MGF1-SHA256 when its selector is unavailable —
src/fwtpm/fwtpm_crypto.c:94-108
Review generated by Skoll
Thanks @dgarske! I retested #656 at ad2e978, again with no local patches. Everything still holds, and #654 is now fully resolved. Reproductions. As before:
Thanks for the End to end. The C# PKCS#11 suite (642 cases) ran through tpm2-pkcs11, now at master a5156c5, on tpm2-tss 4.2.0. It covered both store backends (esysdb and FAPI) and both the classic and One small note on the new digest-size check in |
|
One more finding on ad2e978, in the same area as #653: object creation with a key size or curve the build doesn't support.
From the code, |
|
Hi @AlexLaroche , thanks for the feedback! Can you review the latest work? Thanks, David Garske, wolfSSL |
embhorn
left a comment
There was a problem hiding this comment.
Skoll Code Review
Scan type: review
Overall recommendation: REQUEST_CHANGES
Findings: 3 total — 3 posted, 0 skipped
3 finding(s) posted as inline comments (see file-level comments below)
Posted findings
- [High] No-NV power cycle reports a rolled-back Clock as safe —
src/fwtpm/fwtpm.c:265-268 - [High] RSA seed operations accept a parent with no usable MGF1 —
src/fwtpm/fwtpm_crypto.c:105-108 - [High] Clock compaction can replace the durable checkpoint with a different RAM value —
src/fwtpm/fwtpm_nv.c:2968-2976
Review generated by Skoll
embhorn
left a comment
There was a problem hiding this comment.
Skoll Code Review
Scan type: review
Overall recommendation: REQUEST_CHANGES
Findings: 2 total — 2 posted, 0 skipped
2 finding(s) posted as inline comments (see file-level comments below)
Posted findings
- [High] Socket polling timeout disconnects valid slow clients —
src/fwtpm/fwtpm_io.c:100-103 - [Medium] HMAC sweep accepts unrelated command errors as proof —
tests/fwtpm_unit_tests.c:17308-17312
Review generated by Skoll
embhorn
left a comment
There was a problem hiding this comment.
Skoll Code Review
Scan type: review
Overall recommendation: REQUEST_CHANGES
Findings: 2 total — 2 posted, 0 skipped
2 finding(s) posted as inline comments (see file-level comments below)
Posted findings
- [High] Reset the server Time epoch on platform power-on —
src/fwtpm/fwtpm_main.c:340-341 - [Medium] Correct the Clock rollback claim in the new API documentation —
wolftpm/fwtpm/fwtpm.h:1094-1096
Review generated by Skoll
embhorn
left a comment
There was a problem hiding this comment.
Skoll Code Review
Scan type: review
Overall recommendation: REQUEST_CHANGES
Findings: 1 total — 1 posted, 0 skipped
1 finding(s) posted as inline comments (see file-level comments below)
Posted findings
- [High] Fresh initialization discards the committed Clock checkpoint —
src/fwtpm/fwtpm.c:181
Review generated by Skoll
There was a problem hiding this comment.
🟡 Changes recommended
The new CI job installs system packages at runtime rather than baking them into the versioned CI image as required, introducing a dependency on live package repositories.
1 open issue
What changed in this PR
This PR addresses fwTPM compatibility issues #648–#654 and related session, clock, and signature defects, improving interoperability with tpm2-pkcs11 and resource managers.
Changes:
- Corrects authorization-session handling, signature encoding, RSA hash selection, capability reporting, and parameter validation.
- Adds restorable object snapshots and durable Clock and orderly-counter recovery.
- Adds signature and socket regression tests, PKCS#11 integration coverage, and updated configuration documentation.
| File | Description |
|---|---|
wolftpm/tpm2_wrap.h |
Documents fixed-width ECC signatures. |
wolftpm/tpm2_types.h |
Increases context capacity for larger keys. |
wolftpm/fwtpm/fwtpm.h |
Adds Clock persistence state and APIs. |
wolftpm/fwtpm/fwtpm_tis.h |
Documents bounded transport waits. |
tests/signature_padding_tests.c |
Tests ECC padding and output bounds. |
tests/include.am |
Adds the signature test target. |
tests/fwtpm_hal_unit_tests.c |
Stubs Clock updates for transport tests. |
tests/fwtpm_check.sh |
Tests clients pausing mid-command. |
src/tpm2_wrap.c |
Shares fixed-width ECC signature extraction. |
src/fwtpm/README.md |
Documents Clock recovery and journal compatibility. |
src/fwtpm/include.am |
Applies server-specific build flags. |
src/fwtpm/fwtpm.c |
Implements Clock power-on recovery and checkpoint scheduling. |
src/fwtpm/fwtpm_tis.c |
Checkpoints Clock in the TIS loop. |
src/fwtpm/fwtpm_tis_shm.c |
Bounds shared-memory semaphore waits. |
src/fwtpm/fwtpm_nv.c |
Persists Clock checkpoints and orderly safety state. |
src/fwtpm/fwtpm_main.c |
Registers a monotonic host clock. |
src/fwtpm/fwtpm_io.c |
Polls Clock during socket waits and handles power-on recovery. |
src/fwtpm/fwtpm_crypto.c |
Corrects RSA hash mappings and ECDSA output handling. |
src/fwtpm/fwtpm_command.c |
Updates sessions, contexts, capabilities, validation, and orderly counters. |
scripts/tpm2_pkcs11_test.sh |
Adds PKCS#11 interoperability tests. |
docs/ja/fwtpm/building.md |
Documents the server object-slot default in Japanese. |
docs/fwtpm/building.md |
Documents the server object-slot default. |
configure.ac |
Defaults the server to seven object slots. |
.gitignore |
Ignores signature-test artifacts. |
.github/workflows/fwtpm-test.yml |
Adds direct and resource-managed PKCS#11 CI coverage. |
Review effort: Balanced
| apt-get update | ||
| DEBIAN_FRONTEND=noninteractive apt-get install -y \ | ||
| libtpm2-pkcs11-1 libtpm2-pkcs11-tools tpm2-abrmd \ | ||
| libtss2-tcti-tabrmd0 opensc dbus |

This PR fixes the fwTPM issues #648-#654, plus related defects in the same code paths. Each fix is its own commit with a regression test:
WC_ALLOW_ECC_ZERO_HASH), as the reference TPM does; otherwise returnTPM_RC_VALUEon the digest parameter instead ofTPM_RC_FAILURE(fwTPM: TPM2_Sign answers TPM_RC_FAILURE for an all-zero ECDSA digest #654).fwtpm_serverbuild defaults to 7 transient object slots for tools that run without a resource manager. An object loaded from a legacy persistent record, whose hierarchy is unknown, saves with a proof bound to both the owner and endorsement seeds.Related fixes:
TPM_CAP_HANDLESincludes hash, HMAC, event, sign and verify sequence handles.wolfTPM2_SignDigestandwolfTPM2_SignSequenceCompletenormalize ECDSA scalars to the curve width, aswolfTPM2_SignHashSchemealready does.Notes:
FWTPM_Clock_PowerOn()for hosts that power cycle within oneFWTPM_CTX. Embedded hosts must callFWTPM_Clock_Update()at least everyFWTPM_CLOCK_POLL_MS.MAX_CONTEXT_SIZEdefaults to 4096 whenMAX_RSA_KEY_BITSexceeds 2048 and to 8192 with PQC, since an object context now carries the private key. Define it to keep a fixed size.fwtpm_server, directly and through tpm2-abrmd, for the classic and v1.85 builds.Fixes #648, Fixes #649, Fixes #650, Fixes #651, Fixes #652, Fixes #653, Fixes #654