Commit Graph

103 Commits (fc511714d37e8052a089e602ddaaf6b8c4af5ce7)

Author SHA1 Message Date
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
Mark Atwood c895891164 feat: add make sbom target
Adds sbom, install-sbom, and uninstall-sbom targets.
Runs gen-sbom to produce CDX and SPDX outputs.
Requires WOLFSSL_DIR pointing to a wolfssl tree with
the feat/sbom-embedded branch (includes gen-sbom).
2026-06-22 18:39:23 -07:00
aidan garske ad08b88d6e Add fine-grained PQC build macros to trim v1.85 ML-DSA/ML-KEM by algorithm and operation 2026-06-15 15:49:34 -07:00
Aidan Garske eb21c17a7a Add fwtpm SPDM support 2026-06-03 10:28:54 -07:00
Tobias Frauenschläger 77e31c0ebb ML-DSA renaming 2026-05-20 13:09:26 -07:00
Aidan Garske 182230c933 PR #501: enforce wolfSSL >= v5.8.0 floor for PQC + add nightly upstream-drift CI
configure.ac: add LIBWOLFSSL_VERSION_HEX check so --enable-v185/--enable-pqc
fails fast against unsupported wolfSSL releases (kyber.h era), instead of
relying on transitive header aliasing through wc_mlkem.h.

Add .github/workflows/wolfssl-versions.yml matrix: builds wolfTPM PQC
against wolfSSL v5.8.0-stable, v5.8.4-stable, v5.9.1-stable, and master.
Catches the next upstream rename within the matrix run, not 9 days later.

Add .github/workflows/nightly.yml: cron 02:17 UTC fan-out via
repository_dispatch[nightly-trigger]. 12 workflows opt in (cmake-build,
codespell, fwtpm-test, make-test-swtpm, multi-compiler, pqc-examples,
release-checks, sanitizer, seal-test, win-test, wolfssl-versions, zephyr).
hw-spdm-test deliberately does NOT opt in so the self-hosted Pi runner
cannot be batch-triggered. repository_dispatch is API-only (no UI button)
so only the nightly job can fire these.
2026-05-08 13:10:52 -07:00
Aidan Garske 6f8bae6c58 Fix changes to pqc header file rename 2026-05-08 10:04:01 -07:00
Aidan Garske 539c94b68e fwTPM v185: Fix autodetect 2026-04-29 10:29:51 -07:00
Aidan Garske 9ce41885e0 fwTPM v185: PR review fixes + TCG/security hardening
Build / portability:
  - Drop #pragma message in fwtpm_crypto.c (MSVC-incompatible)
  - Replace non-ASCII section sign with Sec. across all sources/docs

  Configure:
  - Add --enable-pqc alias for --enable-v185 (same WOLFTPM_V185 macro)
  - Auto-detect: when --enable-fwtpm + wolfCrypt has dilithium.h+mlkem.h
    and neither flag is set, configure auto-enables PQC; --disable-pqc
    opts out
  - Both flags probe the wolfSSL PQC headers and fail at configure time
    with a clear hint when missing

  Spec / security hardening:
  - VerifySequenceComplete now emits TPM_ST_DIGEST_VERIFIED (with hashAlg
    metadata) for Hash-ML-DSA tickets, MESSAGE_VERIFIED for Pure ML-DSA
    (was mis-tagging digests as messages, breaking PolicyTicket consumers)
  - Sign/VerifySequenceComplete: free the slot on TPM_RC_SIGN_CONTEXT_KEY
    too, so wrong-key Complete cannot exhaust FWTPM_MAX_SIGN_SEQ slots
    (CWE-772 DoS)
  - TestParms PQC arms return TPM_RC_PARMS (spec-correct) instead of
    TPM_RC_VALUE; reject MLDSA/MLKEM parameter sets not actually compiled
    in; parse TPMS_MLKEM_PARMS.symmetric via TPM2_Packet_ParseSymmetric
  - GetCapability TPMA_ML_PARAMETER_SETS gates each MLDSA/MLKEM bit on the
    per-set wolfCrypt availability macro (subset builds advertise truth)
  - TPM2_VerifySignature client parser now defensive: only consume the
    v1.85 metaAlg when tag==DIGEST_VERIFIED && hierarchy!=RH_NULL
  - VerifyDigestSignature: hard-fail on keyName overflow instead of
    silently emitting a ticket missing the name binding
  - TPM_GENERATED_VALUE prefix check guarded with rc==0
  - Drop dead (void)cmdSize casts in Sign/VerifySequenceStart
  - wolfTPM2_EncryptSecret_MLKEM: track wc_InitRng_ex/wc_MlKemKey_Init
    success flags so Free is only called on initialized state
  - UBSan-v185 sanitizer cflags: explicitly disable signed-integer-overflow
    and shift checks (matches the comment about wolfSSL Hash_df 440<<24)

  Embedded RAM:
  - FWTPM_NV_PUBAREA_EST derives from FWTPM_MAX_MLDSA_PUB_SIZE /
    FWTPM_MAX_MLKEM_PUB_SIZE auto-shrink macros (subset builds save NV)
  - tpm2_types.h MAX_MLDSA_*/MAX_MLKEM_* stay at worst-case (ABI floor
    for TPM2B wire buffers) with comment

  Tests:
  - Negative test for Hash-MLDSA VerifySeqComplete ticket tag
  - Negative test exposing sign-seq slot leak on TPM_RC_SIGN_CONTEXT_KEY
  - Roundtrip test for wolfTPM2_SignDigest + VerifyDigestSignature

  Documentation:
  - README, FWTPM.md, fwtpm/README.md, examples/pqc/README.md mention
    both --enable-pqc and --enable-v185 + auto-detect
  - README wolfSSL line: --enable-pkcallbacks + WC_RSA_NO_PADDING
  - fwtpm/README.md: drop FWTPM_SPEC_* labels (macros never existed),
    remove v1.85 Additions table (all 8 commands implemented), update
    coverage table to 137/113/24 (82%); note remaining gaps are
    inherited v1.59/v1.84 commands, not PQC
  - fwtpm_nv.h:52: clarify 2592 vs 2720 math (PQC pub key + header slack)
2026-04-29 10:29:51 -07:00
Aidan Garske 552032d357 fwTPM PQC: mssim E2E test + output formatting
Cross-process PQC validation: new examples/pqc/pqc_mssim_e2e exercises
  wolfTPM2_* client wrappers against a running fwtpm_server over the
  mssim (SWTPM) socket transport. Two round-trips in one binary:

  - MLKEM-768 Encap/Decap: asserts ciphertext = 1088 bytes and the two
    derived shared secrets are byte-identical.
  - HashMLDSA-65 SignDigest/Verify: asserts signature = 3309 bytes and
    the validation ticket carries TPM_ST_DIGEST_VERIFIED.

  tests/pqc_mssim_e2e.sh spawns fwtpm_server, waits for TCP readiness,
  runs the client, and cleans up. Proves client marshaling + mssim
  framing + fwtpm_server unmarshaling + PQC handler dispatch agree over
  a real socket between two separately-compiled processes — orthogonal
  to the in-process fwtpm_unit.test suite.

  Infrastructure:
  - configure.ac: new AM_CONDITIONAL BUILD_V185 so the example only
    builds when --enable-v185 is passed (matches the pattern of
    BUILD_SWTPM, BUILD_DEVTPM, etc.).
  - examples/include.am, examples/pqc/include.am: register the example.

  Output polish: replaced 85 inconsistent calls with a
  fwtpm_pass(name, is_pqc) helper that produces aligned
  columns. PQC tests are tagged [PQC] so they're visually distinct
  from the classical suite at a glance. All 86 existing tests still pass.
2026-04-29 10:27:50 -07:00
Aidan Garske cf6a140ab8 Phase 2: v185 types, marshaling fixes, fwTPM buffer lifts, stub dispatch
Client side (wolftpm, src/tpm2*.c):
  - Add missing v185 RCs: TPM_RC_PARMS, TPM_RC_ONE_SHOT_SIGNATURE,
    TPM_RC_SIGN_CONTEXT_KEY (Part 2 Table 17)
  - Add capability props: TPM_PT_FIRMWARE_SVN, TPM_PT_FIRMWARE_MAX_SVN,
    TPM_PT_ML_PARAMETER_SETS (Part 2 Table 27)
  - Add TPMA_ML_PARAMETER_SET bitfield (Part 2 Table 46)
  - Add TPM2B_SIGNATURE_HINT type + MAX_SIGNATURE_HINT_SIZE (Part 2 Table 221)
  - M-1: split TPMU_SIGNATURE.mldsa (TPM2B, no hash) from .hash_mldsa
    (TPMS, hash + sig) per Part 2 Table 217 note; split Append/ParseSignature
    switch cases in tpm2_packet.c; update 4 call sites in tpm2_wrap.c
  - M-2, M-3: add missing auth and hint params to SignSequenceStart /
    VerifySequenceStart (Part 3 Tables 87, 89)
  - M-4: add [tag]metadata field to TPMT_TK_VERIFIED (Part 2 Table 112);
    update the 3 validation-ticket parsers in tpm2.c
  - M-6: SignDigest was missing validation (TPMT_TK_HASHCHECK) and had
    wrong parameter order; fixed to context, digest, validation (Part 3
    Table 126)
  - M-7: VerifyDigestSignature had wrong parameter order; fixed to
    context, digest, signature (Part 3 Table 120)

  fwTPM side (src/fwtpm/, wolftpm/fwtpm/):
  - Lift FWTPM_MAX_COMMAND_SIZE, FWTPM_MAX_PUB_BUF, FWTPM_MAX_DER_SIG_BUF
    and FWTPM_TIS_FIFO_SIZE under WOLFTPM_V185 to fit MLDSA-87 sig (4627 B)
    and pub (2592 B); add FWTPM_MAX_KEM_CT_BUF (1600 B) for MLKEM-1024 ct
  - Add 8 PQC command stubs + dispatch table entries (return
    TPM_RC_COMMAND_CODE until Phase 4/5 handlers land)

  Build system:
  - Sharpen --enable-v185 help text to reflect full v1.85 scope (not
    PQC-only; also covers new RCs, sequence/digest commands, cap props)

  Builds clean with --enable-wolfcrypt --enable-fwtpm --enable-v185.
  Layer C fixture harness still loads 8/8 structurally.
2026-04-29 10:26:00 -07:00
aidan garske 487387d349 Add v185 rc4 tpm2.0 PQC MLDSA MLKEM Support 2026-04-29 10:26:00 -07:00
David Garske 0f87ce183b Build, portability, and CI fixes for v4.0.0
- configure.ac: switch wolfCrypt link probe to AC_LINK_IFELSE with real
  headers so CC=g++ builds don't fail on name-mangling; gate fwTPM/swTPM
  autodetect on ENABLED_WOLFCRYPT=yes (fwTPM requires wolfCrypt)
- wolftpm/fwtpm/fwtpm.h: hoist FWTPM_NV_HAL_S and FWTPM_CLOCK_HAL_S out
  of the FWTPM_CTX nested scope so C++ consumers can reference them
- src/fwtpm/fwtpm_command.c, fwtpm_crypto.c: add explicit TPMI_ALG_HASH
  and enum wc_HashType casts to silence strict C++ warnings; drop stale
  KEYEDHASH hashAlg initializer
- src/tpm2_wrap.c: move rc = TPM_RC_SUCCESS into the correct #else branch
  so Linux/winapi paths propagate TPM2_Startup errors
- examples/endorsement/get_ek_certs.c: drop redundant indexType default
- examples/endorsement/verify_ek_cert.c: initialize curveName on the
  WOLFTPM2_NO_WOLFCRYPT/no-ECC path
- examples/native/native_test.c: stop masking TPM2_ZGen_2Phase and
  TPM2_EC_Ephemeral 'command unavailable' as success
- tests/fwtpm_unit_tests.c: use cmdSz (not hardcoded 14) on FlushContext
- CI: add no-examples and st33ktpm2-i2c compile-only matrix entries to
  make-test-swtpm; add release-checks workflow (CC=g++ + scan-build)
2026-04-22 09:27:48 -07: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
Aidan Garske b7ad7d8db8 Fix SPI and I2C behavior with SWTPM or FWTPM 2026-04-17 14:41:43 -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 5a2fee018a File Reorginization and review feedback
- Moved spdm/src/*.c src/spdm/*.c (11 source files)
  - Moved spdm/wolfspdm/*.h wolftpm/spdm/*.h (7 public headers)
  - Moved spdm/src/spdm_internal.h src/spdm/spdm_internal.h
  - Moved spdm/test/unit_test.c src/spdm/unit_test.c
  - Moved spdm/README.md src/spdm/README.md
  - Deleted spdm/include.am, created src/spdm/include.am
  - Renamed all #include <wolfspdm/...> #include <wolftpm/spdm/...> across all files
  - Added SPDM headers to wolftpm/include.am (as nobase_include_HEADERS)
  - Updated Makefile.am: include spdm/include.am include src/spdm/include.am
  - Removed -I/spdm from configure.ac and examples/spdm/include.am (no longer needed
2026-03-24 23:32:08 +00:00
Aidan Garske 49c767432f Add Nuvoton NPCT75x and NSING NS350 SPDM support for wolfTPM 2026-03-24 18:15:38 +00:00
aidan garske d6ba3812a9 Upgrade wolfTPM CI testing 2026-02-16 11:06:33 -08:00
Aidan Garske 0b50f632ae Add stm33ktpm support LMS and non-LMS 2026-01-27 15:57:09 -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 3120dac297 Add new `make cppcheck` option. Fixes for cppcheck. Added missing `wolfssl-v4.7.0.patch` 2025-11-21 13:26:47 -08:00
David Garske 7f37399aea Support for swtpm port arguments 2025-11-20 15:51:05 -08:00
David Garske 1d1a0bd819 Fix for TPM2_VerifySignature not using the correct hash algorithm (ZD 20296) 2025-08-25 09:34:23 -07:00
David Garske 1402d0d132 wolfTPM Release v3.9.2 prep. Migrating to GPLv3. 2025-07-30 07:29:31 -07:00
Andrew Hutchings 54155d7ccf Fix bug in configure.ac which breaks in Alpine
Brace usage is incorrect which leads to compile failure in Alpine.
2025-06-30 16:47:11 +01: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 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 5bd553a6a3 wolfTPM v3.8.0 release. 2025-01-06 11:46:49 -08:00
David Garske d986ec73ba wolfTPM Release v3.6.0 prep. 2024-11-05 11:18:43 -08:00
David Garske 462c4e01cb Move PTHREAD definition from options.h to config.h. Avoids possible redeclaration issue. 2024-09-19 11:54:09 -07:00
David Garske a6d7ed8695 Added example for `TPM2_Certify`:
* Added new build option for TPM provisioning (`--enable-provisioning` on by default).
* Added new `wolfTPM2_CreatePrimaryKey_ex` and `WOLFTPM2_PKEY` that supports returning creation ticket/hash.
* Added key templates for initial device (IDevID) and attestation keys (IAK).
* Extended `create_primary` example to support creation or IDevID and IAK.
* Added new policy hash helper API `wolfTPM2_PolicyHash`
* Switch handle/nvIndex string parsing to use `strtoul`.

ZD 18347
2024-08-22 10:38:01 -07:00
David Garske 026c82f799 Fixes and new tests for building wolfCrypt/wolfTPM without ECC or RSA. Fixes ZD 18470. Improved smallstack (eliminated `WOLFTPM2_MAX_BUFFER`). Fixes for building with NO_ASN. 2024-08-19 09:55:15 -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 c98ee9a71e Update copyright date. 2024-04-24 10:42:27 -07:00
David Garske 4157ed5689 Release v3.2.0 prep. 2024-04-24 10:42:25 -07:00
David Garske 892726e6b5 Added support for Infineon SLB9672/SLB9673 Firmware upgrade (see examples/firmware/README.md)
Added Infineon Modus Toolbox support. See `wolfssl/IDE/Infineon/README.md` for setup instructions.
Added support for Infineon CyHal I2C support.
Added Firmware extraction tool
Added Firmware update example application `examples/firmware/ifx_fw_update`.
Added support for vendor capabilities `TPM_CAP_VENDOR_PROPERTY`.
Added `XSLEEP_MS` macro for firmware update delay.
Added support for getting key group id, operational mode and update counts.
Added support for abandoning an update.
Added support for firmware update done, but not finalized
Fix auto-detect to not define SLB9672/SLB9673.
2024-04-01 17:21:18 -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 d9f51da00e wolfTPM v3.1 release prep 2023-12-29 10:55:30 -08:00
David Garske a10a10db5d Added v3.0 release notes and updated version. 2023-10-30 12:02:28 -07:00
David Garske f35dbbbb30 Fixes for using Windows TBS API. The `wolfTPM2_NVStoreKey` should return `TPM_RC_COMMAND_CODE` or `TPM_E_COMMAND_BLOCKED` for the `WOLFTPM_IS_COMMAND_UNAVAILABLE` macro. Add better enable option name `--enable-wintbs` (currently is `--enable-winapi`. 2023-10-30 10:06:17 -07:00
David Garske 23a5d2595b Fixes for small stack. 2023-08-31 13:37:22 -07:00
David Garske 8968d89f90 More CI fixes. 2023-08-31 12:29:13 -07:00
David Garske 2e72da7d75 Fixes for autoconf to have a clean `./autogen.sh`. 2023-07-10 14:45:14 -07:00
David Garske 21638b065a Improve MMIO support to utilize the HAL framework. 2023-06-28 13:39:47 -07:00
Marco Oliverio f8c1ff6075 tis: support memory mapped tpm 2023-05-30 16:58:46 +00:00
David Garske f2a95f3902 Fix for Microchip Harmony build settings. Rename to `WOLFTPM_MICROCHIP_HARMONY`. Avoids confusion with the TPM 2.0 module ATTPM from Microchip. Now enabled with `WOLFTPM_MICROCHIP` and provides backwards compatibility for `WOLFTPM_MCHP`. The new `WOLFTPM_MICROCHIP` has not been released (was added in PR #251). 2023-02-03 10:49:29 -08: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