Commit Graph

60 Commits (2b489b66da5f2666025941b6f0d2ebea5ba9559c)

Author SHA1 Message Date
Aidan Garske 2b489b66da Bump version to v4.2.0 and add the 4.2.0 ChangeLog 2026-09-14 11:03:51 -07:00
Aidan Garske a7b1aa6c3b Inline fwTPM TIS atomics and semaphore name helpers 2026-09-02 14:14:59 -07:00
Aidan Garske 95696b36ef F-12736 - Authenticate fwTPM shared-memory endpoints 2026-09-02 14:14:58 -07:00
Aidan Garske 3507da0429 F-12710 - Advertise supported ECC curves 2026-09-02 14:14:28 -07:00
David Garske 2b8e41caf1 Add caller-supplied policy authorization for TPM firmware upgrade
Lets a deployment gate the TPM firmware-update start command behind its own
platform hierarchy policy instead of the vendor default. Previously wolfTPM
always managed that authorization internally: on Infineon it installed and
satisfied a PolicyCommandCode(TPM_CC_FieldUpgradeStartVendor) policy on the
platform primary policy, and on ST33 it used password authorization with an
empty platform password. Both assume default platform auth, which a hardened
deployment will not have.

New _ex entry points take an already-satisfied session:
  wolfTPM2_FirmwareUpgradeHash_ex()
  wolfTPM2_FirmwareUpgrade_ex()
  wolfTPM2_FirmwareUpgradeRecover_ex()
Passing NULL for startSession keeps the existing library-managed behavior, so
the original functions are unchanged wrappers and existing code is unaffected.
With a session supplied, Infineon no longer overwrites the platform primary
policy (the caller provisions it) and ST33 uses the session in place of
TPM_RS_PW.

Supporting wrappers:
  wolfTPM2_PolicyOR()               satisfy a session with a compound OR
  wolfTPM2_PolicyCommandCodeMake()  offline PolicyCommandCode digest
  wolfTPM2_IsAlgSupported()         report whether the TPM implements an alg
PolicyOR is hash-agnostic (each branch carries its own size), so SHA2-256
through SHA2-512 policy branches all work. It requires at least two branches
per TPM 2.0 Part 3 Sec.23.6 and validates each branch size against the digest
buffer. PolicyCommandCodeMake takes digestSz as in/out - input is the output
buffer capacity and BUFFER_E is returned when it is too small, checked before
the buffer is written. IsAlgSupported reports through an out-parameter and
returns TPM_RC, so a capability-query failure cannot be misread as
"supported"; it sets the out-parameter to 0 on every error path.

Session contract: the vendor FieldUpgradeStart commands are hand-marshalled
with an authorization area carrying only the session handle - empty
nonceCaller, zero attributes, empty HMAC. That is correct only for an
unsalted, unbound policy session with no auth value, so the _ex path validates
the caller session up front and rejects anything needing a computed session
HMAC or parameter encryption (PolicyAuthValue/PolicyPassword, attached auth
value, bind, salt, encrypt/decrypt/audit attributes, or a non-policy handle).
Validation runs before any TPM traffic. On a successful start the TPM consumes
the session and the library sets handle.hndl to TPM_RH_NULL; this is now
documented, including that it is not zero and that wolfTPM2_UnloadHandle
no-ops on it.

Examples: ifx_fw_update and st33_fw_update gain --policy, --policyor and
--policytest, backed by a shared examples/firmware/firmware_policy.c. The
--policytest mode is a non-destructive self-test that checks the TPM's running
policy digest against an offline computation at SHA2-256/384/512, skipping any
hash the TPM does not implement or the local wolfCrypt build was not compiled
with (a build mismatch is a skip, not a failure). The provisioned PolicyOR
carries a PolicyCommandCode(TPM_CC_SetPrimaryPolicy) branch so the policy can
authorize its own removal, and cleanup is gated on a FirmwarePolicyCtx that
records what was actually provisioned, so an early failure cannot clear a
policy the deployment installed itself. A failed rollback is reported but
never overwrites the upgrade error that explains the run, and is skipped once
the start has succeeded (the TPM has reset into upgrade mode and will not
service SetPrimaryPolicy).

Because TPM 2.0 offers no way to read a hierarchy authPolicy back, the example
cannot detect or restore one it replaces, so provisioning prints an explicit
warning naming that. The policy modes are also refused where the session could
never be used: any Infineon operational mode other than normal (recovery and
finalize skip the start entirely), and on ST33 when the TPM is already in
firmware-upgrade mode - previously the flags were silently ignored there,
which is the authorization downgrade they exist to prevent. Rollback normally uses platform password
authorization, which an installed authPolicy does not disable (TPM 2.0 Part 1
Sec.19.7); this was confirmed on ST33KTPM2X, SLB9670 and SLB9673 parts.

The firmware examples now require wolfCrypt in their feature guards. They
drive wolfTPM2_FirmwareUpgrade_ex, which hashes the manifest with SHA-384 and
only exists with wolfCrypt, so --enable-firmware with --disable-wolfcrypt
previously failed to compile.

Also converts examples/nvram/extend.c to the new PolicyCommandCodeMake
capacity contract.

Tests: argument validation and known-answer vectors for the new wrappers,
short-buffer and canary coverage for PolicyCommandCodeMake, caller-session
rejection for every unsupported session shape plus an accepted session,
simulator-backed success paths for PolicyOR and IsAlgSupported, and a
regression test that a platform authPolicy remains clearable with password
authorization while a non-matching policy session is refused.
2026-08-13 11:18:25 -07:00
David Garske a85dcc8a42 GPLv2 license exception for Cisco Systems, Inc. use of wolfTPM in U-Boot only. 2026-07-22 07:57:13 -07:00
David Garske cedd57af42 Release v4.1.0: version bump and ChangeLog
Bump version 4.0.0 -> 4.1.0 (configure.ac AC_INIT, libtool 17:0:0 -> 18:0:0,
wolftpm/version.h, CMakeLists.txt) and add the 4.1.0 ChangeLog covering the
merged PRs since v4.0.0 and the in-scope PR 549 (freestanding build).
2026-07-10 14:54:49 -07:00
David Garske e3ffda7641
Merge pull request #536 from MarkAtwood/feat/add-sbom-make-target
feat: add make sbom target
2026-07-10 14:46:36 -07:00
David Garske 7f7aebed45 SBOM: fix cmake artifact discovery, cmake 3.16 compat, and tab regex 2026-07-10 14:02:10 -07:00
Sameeh Jubran fc511714d3 SBOM: adopt shared sbom.am fragment; bring CMake target to parity
Autotools: replace the inline make sbom recipe with the shared
scripts/sbom.am fragment (declare wolftpm identity, LICENSE, wolfSSL
dependency, and wolftpm/options.h as the feature-macro source). Add GIT
discovery + AC_SUBST for reproducible SOURCE_DATE_EPOCH, and revert the
WOLFTPM_LIBRARY_VERSION_{FIRST,SECOND,THIRD} split that only fed the old
hardcoded --lib path (the fragment discovers the artifact by glob).

CMake: pin the SBOM licence to GPL-3.0-or-later (header-accurate; matches
autotools SBOM_LICENSE_OVERRIDE) and record wolfSSL as a dependency via
--dep-wolfssl, capability-gated on gen-sbom --help so older gen-sbom
versions still produce a valid (dependency-less) SBOM.

Pin the license default to GPL-3.0-or-later to match the source headers
("or (at your option) any later version"), fixing the SBOM licence field.

Add a CI workflow that builds wolfSSL + wolfTPM and asserts SBOM identity,
licence, options capture, reproducibility, and the wolfSSL dependency.

Signed-off-by: Sameeh Jubran <sameeh@wolfssl.com>
2026-07-10 14:19:24 +03:00
David Garske b8709b13dd fwTPM: append-only NV journal for write-once flash ports and swtpm UART symlink support 2026-06-29 11:33:19 -07:00
Mark Atwood 9733a12b77 feat: add cmake sbom custom target 2026-06-22 18:59:19 -07:00
JacobBarthelmeh ee41a056f5 fix to limit cmake wolftpm_wolfssl_dep export 2026-04-27 16:06:43 -06:00
David Garske 579ec8cc7f Bump copyright year to 2026 and version to 4.0.0
Release prep for v4.0.0:
- Copyright headers updated 2025 -> 2026 across sources, headers, and examples
- Library version 3.10.0 -> 4.0.0 (libtool 16:8:0 -> 17:0:0)
- configure.ac WOLFSSL_URL http -> https
2026-04-22 09:24:55 -07:00
David Garske 19e648442b Add network namespace isolation, macOS CI, and Windows build support for fwTPM
Use unshare --user --net to isolate fwtpm_check.sh TCP ports in CI, eliminating flaky port conflicts on shared runners. Add macOS CI with socket transport tests. Add Windows socket portability (Winsock2) and build-only CI via CMake.
2026-04-21 09:06:44 -07:00
David Garske 0c52f3be4d Add firmware TPM 2.0 (fwTPM) implementation
Add portable firmware TPM 2.0 implementation (fwTPM) built on wolfCrypt.
Implements 105/113 TPM 2.0 v1.38 commands (93%) as a standalone server
with socket and TIS transports, NV storage, and full CI/fuzz coverage.
2026-04-16 16:57:57 -07:00
Aidan Garske bb6a71c0fa Add seal/unseal examples with PCR, PolicyAuthorize, and NV policies
New examples:
   - seal_pcr: PCR-only policy seal/unseal. Binds secrets to specific PCR
     values without password or signing key. Supports split seal/unseal,
     configurable PCR index, custom blob filenames, XOR/AES param encryption.
   - seal_policy_auth: PolicyAuthorize with TPM-resident signing key (ECC/RSA).
     Signing key can re-authorize PCR policy, allowing secrets to survive
     authorized PCR changes (e.g., OS updates). Supports split seal/unseal,
     XOR/AES param encryption.
   - seal_nv: NV storage with PCR policy. Stores secrets directly in TPM
     non-volatile memory with store/read/delete lifecycle and configurable
     NV index. No external blob files needed.

   Build system:
   - Autotools: Updated include.am for seal and nvram with new build targets
   - CMake: Added add_tpm_example() entries for all three examples
   - Headers: Updated seal.h and nvram.h with new prototypes, removed old
     TPM2_PCR_Seal_With_Policy_Auth_* declarations
   - .gitignore: Added built binaries

   Testing:
   - run_examples.sh: Added ~110 lines of integration tests for seal_pcr,
     seal_policy_auth (ECC + RSA), and seal_nv (store/read/delete lifecycle)
   - seal_test.sh: Standalone test script with 28 tests across 3 groups
     including positive, negative, param encryption, and custom path tests
   - seal-test.yml: Dedicated CI workflow with SWTPM, path-filtered to
     seal-related files, follows make-test-swtpm.yml pattern

   Documentation:
   - README.md: Usage examples and policy comparison table for all seal examples
2026-02-26 16:35:12 -08:00
David Garske ae7f4b13d7 Release v3.10.0 prep. Change swtpm port to use number. 2025-12-04 13:49:10 -08:00
David Garske d936b8f551 Fix for cast warning. Fix for WOLFTPM_DEBUG to show verbose/io also. 2025-11-21 14:02:51 -08:00
David Garske 7f37399aea Support for swtpm port arguments 2025-11-20 15:51:05 -08:00
David Garske a2ee75cd53 Further improvement to CMake interfaces and test scripts 2025-11-20 14:30:00 -08:00
David Garske 5217ca54ff Finishing up the CMake options to sync with configure 2025-11-20 13:30:47 -08:00
David Garske 266d86c5d2 Add CMake support for choosing a TPM module 2025-11-20 19:22:07 +00:00
night1rider f68e28b232 Fix backward yes/no logic of WOLFTPM_NO_LOCK_DEFAULT, and if check statement of WOLFTPM_NO_LOCK 2025-08-13 16:00:09 -06:00
night1rider 807ad9bbcf Updating default logic for WOLFTPM_NO_LOCK depending on state of WOLFTPM_SINGLE_THREADED 2025-08-13 15:25:44 -06:00
David Garske 1402d0d132 wolfTPM Release v3.9.2 prep. Migrating to GPLv3. 2025-07-30 07:29:31 -07:00
David Garske 549dcc1c35 Fix for WC_RNG change to add `pid_t`. Add detection of `HAVE_GETPID`. 2025-06-18 14:25:34 -07:00
David Garske 8ce8eaaeba Fix CMake logic for `WOLFTPM_NO_ACTIVE_THREAD_LS`. ZD 19829 2025-06-10 09:31:25 -07:00
David Garske 4214ffa8a5 Improvements to CMake support for single threading, mutex locking and active thread local storage. 2025-05-27 12:36:57 -07:00
David Garske 86fbaf69a9 wolfTPM v3.9.1 release (post release fixes)
- Fixed commercial release bundle (missing `tpm2_asn.h`).
  - Fixed wolfTPM DLL revision (was not updated in v3.9.0).
  - Added `make distcheck` to GitHub CI.
2025-05-21 10:34:52 -07:00
David Garske 6fbb49a94f wolfTPM Release v3.9.0. Updated copyright and version. 2025-05-14 15:31:07 -07:00
David Garske a83f2f89d4 Cleanup to replace memcpy with public area copy function. Add CMake provisioning option (`WOLFTPM_PROVISIONING`) to match configure. 2025-03-06 13:55:14 -08:00
Tesfa Mael ceb2c224d6 Update CMakeLists and move WOLFTPM2_NO_ASN down 2025-03-04 18:55:41 -08:00
David Garske 5bd553a6a3 wolfTPM v3.8.0 release. 2025-01-06 11:46:49 -08:00
David Garske 272eb68340 Update CMake examples. 2025-01-06 11:45:35 -08:00
David Garske d986ec73ba wolfTPM Release v3.6.0 prep. 2024-11-05 11:18:43 -08:00
David Garske 62eff27459 Updated CMake to include new examples. Fixed doxygen issue with `wolfTPM2_GetKeyTemplate_EK` -> `curveID`. Fixed issue with possible create key timeout by always adding `XTPM_WAIT` for Linux. 2024-07-30 13:21:45 -07:00
David Garske 95ae2f7459 wolfTPM v3.4.0 release.
* Fixes for building without wolfCrypt or heap.
* Fix for building wolfTPM DLL (was missing tbs.lib).
* Fix for `wolfTPM2_New` to provide default TPM2 HAL IO callback.
2024-07-30 09:09:24 -07:00
David Garske 4157ed5689 Release v3.2.0 prep. 2024-04-24 10:42:25 -07:00
David Garske 53bf0f4a0f For the TLS examples and SWTPM interface that use POSIX sockets make sure `netdb.h` is included. Previously wolfSSL always included netdb.h, but now it requires `HAVE_NETDB_H`. 2024-02-29 10:43:26 -08:00
David Garske 7f969e47da Fixes for CMake tests. 2024-02-06 10:02:39 -08:00
David Garske d9f51da00e wolfTPM v3.1 release prep 2023-12-29 10:55:30 -08:00
David Garske 310fe7cd5a Fix spelling error. Fix CMake build broken since cryptocb refactor in PR #304. Added CI tests for CMake. 2023-12-29 10:36:42 -08:00
David Garske 65e03e15e6 Added Windows Visual Studio project for wolfTPM. 2023-12-06 15:10:44 -08:00
David Garske a10a10db5d Added v3.0 release notes and updated version. 2023-10-30 12:02:28 -07:00
JacobBarthelmeh f5c6f371ba make link libraries with wolfSSL be PUBLIC 2023-07-26 12:47:58 -07:00
JacobBarthelmeh 914b6890d0 improvement to cmake build 2023-07-24 12:30:02 -07:00
JacobBarthelmeh 64bdfbdfd9 update for cmake after wolfssl added NAMESPACE 2023-07-18 12:46:19 -07:00
David Garske 1ea4a591a8 HAL refactor and documentation improvements. Move example HAL implementations into new `hal` directory. Include the example HAL in the library when building. Updated HAL IO documentation. 2023-01-18 12:38:04 -08:00
David Garske 4160930b48 wolfTPM v2.7.0 release prep. 2022-12-27 16:14:59 -08:00