Commit Graph

713 Commits (master)

Author SHA1 Message Date
Aidan Garske f30ce7fadc F-3927 - Hoist mid-block declarations in keyimport and seal_nv examples 2026-05-11 21:50:49 -07:00
Aidan Garske 27386cdb3f F-3922 - Use sizeof(auth.buffer) for -auth length check in keygen 2026-05-11 21:50:49 -07:00
Aidan Garske ca93d9281f F-3709 - Zero-init dev in external_import before alloc-fail goto exit 2026-05-11 21:50:26 -07:00
Aidan Garske 3828deed27 F-3711 - Use WOLFSSL_FATAL_ERROR not WOLFSSL_FAILURE in tls_client_notpm 2026-05-11 21:50:26 -07:00
Aidan Garske e4ac3db7a4 F-3709 - Scope NULL guards to heap build in external_import 2026-05-11 21:17:22 -07:00
Aidan Garske 5f6988d794 F-3918 - Use element-count form for pcrArray bounds check 2026-05-11 20:57:55 -07:00
Aidan Garske 31b8121482 F-3930 - Bound check offsets in ifx_fw_extract extractFW 2026-05-11 20:32:54 -07:00
Aidan Garske c13dc57879 F-3927 - Clamp -password length in keyimport example 2026-05-11 20:18:26 -07:00
Aidan Garske 4e16a160f4 F-3926 - Clamp -ownerauth length in seal_nv example 2026-05-11 20:17:56 -07:00
Aidan Garske 069dd33772 F-3922 - Clamp -auth length in keygen example 2026-05-11 20:17:45 -07:00
Aidan Garske 6d90662cfa F-3921 - Restore goto exit on TPM2_ObjectChangeAuth failure in native_test 2026-05-11 20:16:37 -07:00
Aidan Garske 65e0daa9b6 F-3918 - Bounds check pcrArray writes in secret_unseal and policy_sign 2026-05-11 20:13:17 -07:00
Aidan Garske e9d4f583f8 F-3711 - Set rc on cert/key buffer load failure in tls_client_notpm 2026-05-11 20:12:26 -07:00
Aidan Garske 25ccf1c9da F-3710 - Use goto exit on TPM2_LoadExternal failure in make_credential 2026-05-11 20:11:08 -07:00
Aidan Garske fc87b4b752 F-3709 - NULL check wolfTPM2_NewKeyBlob in external_import 2026-05-11 20:09:57 -07:00
David Garske 3bd3f0a8d1 Add capabilities to properly show FIPS 140-3 2026-05-11 11:35:01 -07:00
Aidan Garske d518bffe97 fwTPM v185: final skoll reivew pass 2026-04-29 10:29:51 -07:00
Aidan Garske 960ba43de1 fwTPM v185: CI fixes for non-PQC builds + Tier 5 server lifetime 2026-04-29 10:29:51 -07:00
Aidan Garske 484df3cdf3 fwTPM v185: Skoll review-cycle fixes (TCG + multi-scan) 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 f568e048bd fwTPM v185: TCG/security review fixes + embedded RAM auto-shrink
Code quality / defensive fixes:
  - TPM2_Encap/Decap: drop bare scope braces, hoist wireSize locals
  - FwCmd_SequenceUpdate: clarify Pure ML-DSA sign accumulation comment
  - FwAllocSignSeq: _Static_assert transient slot range stays valid
  - keygen: drop unused hashMldsaHash local, pass TPM_ALG_SHA256 directly
  - FwCmd_Encapsulate: skip auth area when cmdTag == TPM_ST_SESSIONS
  - writeKeyBlob: restore no-op TPM_RC_SUCCESS in NO_FILESYSTEM build
  - FwCmd_SignDigest restricted-key ticket compare: TPM2_ConstantCompare
  - FwCmd_VerifySequenceComplete: hard-fail if ticket data binding lost
    (no silent fallback that emits a weakened ticket)
  - wolfTPM2_VerifySequenceComplete: validate sigSz before SequenceUpdate
    so BUFFER_E does not leak the TPM-side sequence handle
  - FwCmd_VerifySequenceComplete: heap-allocate ~1KB ticketData via
    FWTPM_DECLARE_BUF / FWTPM_ALLOC_BUF (matches sibling buffers)

  v1.85 capability + scope:
  - GetCapability: report TPM_PT_FIRMWARE_SVN/MAX_SVN = 0
  - Allow Pure ML-DSA streaming via SequenceUpdate per FIPS 204 (SHAKE256
    absorbing is incremental); SignSequenceComplete concatenates msgBuf
    with the trailing complete-time buffer and signs the full message
  - Document v1.85 scope: Encap/Decap is ML-KEM only; Sign/VerifySequence
    and SignDigest/VerifyDigestSignature are ML-DSA / Hash-ML-DSA only
    (classical schemes still go via TPM2_Sign / TPM2_VerifySignature)

  TCG ticket wire-format fixes (security):
  - TPMT_TK_HASHCHECK: SignDigest now validates tag = TPM_ST_HASHCHECK
    unconditionally (TPM_RC_TAG); wolfTPM2_SignDigest wrapper synthesizes
    the NULL Hashcheck instead of sending tag=0/hierarchy=0 from XMEMSET
  - NULL Verified Tickets: FwAppendTicket no longer appends metadata
    bytes when hierarchy == TPM_RH_NULL; client parser conditions
    metaAlg consumption on hierarchy != TPM_RH_NULL (Part 2 §10.6.5)

  Embedded RAM auto-shrink (v1.85):
  - New FWTPM_MAX_MLDSA_{SIG,PUB}_SIZE / FWTPM_MAX_MLKEM_{CT,PUB}_SIZE
    resolve to the largest enabled parameter set via wolfCrypt's
    WOLFSSL_NO_ML_DSA_{44,65,87} / WOLFSSL_NO_KYBER{512,768,1024} gates
  - FWTPM_MAX_DER_SIG_BUF, FWTPM_MAX_PUB_BUF, FWTPM_MAX_KEM_CT_BUF
    derive from those (no per-board override needed)
  - FWTPM_MAX_COMMAND_SIZE / FWTPM_TIS_FIFO_SIZE only lift to 8192 when
    MLDSA-65 or MLDSA-87 is enabled; MLDSA-44-only and MLKEM-only
    v1.85 builds stay at 4096
  - docs/FWTPM.md: per-build size table + override + small-stack notes

  Test coverage:
  - examples/run_examples.sh: invoke pqc/mldsa_sign and pqc/mlkem_encap
    inside the v1.85 block
  - tests/fwtpm_unit_tests.c:
    * SignDigest with malformed HASHCHECK tag rejected (TPM_RC_TAG)
    * FwAppendTicket NULL DIGEST_VERIFIED emits no metadata
    * SignSeqComplete Pure-MLDSA streaming (FIPS 204 §6) — replaces
      obsolete one-shot rejection assertion
  - tests/unit_tests.c:
    * Hash-ML-DSA SignSeqUpdate streaming end-to-end + arg validation
    * TPMT_SIGNATURE round-trip for ML-DSA / Hash-ML-DSA arms
    * TPM2B_PUBLIC round-trip for ML-DSA / Hash-ML-DSA / ML-KEM arms
2026-04-29 10:28:44 -07:00
Aidan Garske 3f7db58943 fix keyload ecc 159 in CI: writeKeyBlob silent write failure 2026-04-29 10:28:44 -07:00
Aidan Garske 8a9be3edff fwTPM v185: MSan-detected uninit reads (4 real bugs) + CI debug 2026-04-29 10:28:44 -07:00
Aidan Garske abe08f56cf fwTPM v1.85: CI fixes + MSan uninit-read in FwCmd_Create
Fixes 5 v1.85 PR CI/build issues:

  1. src/tpm2_wrap.c: add #include <wolfssl/wolfcrypt/mlkem.h> inside the
     v185 MLKEM guard. Builds with --disable-fwtpm against wolfSSL with
     --enable-mlkem failed because the MLKEM symbol declarations were
     only pulled in transitively by src/fwtpm/fwtpm_crypto.c.

  2. src/fwtpm/fwtpm_command.c: switch FWTPM_ALLOC_BUF(privKeyDer) to
     FWTPM_CALLOC_BUF in 4 sites (Create, Load, LoadExternal, Import,
     CreateLoaded). MSan-v185 flagged uninit-value reads in SocketSend
     originating from FwCmd_Create's keyedHash branch — when caller
     supplies undersized inSensitive material, FwComputeUniqueHash hashed
     beyond what was written. Zero-initialising the buffer eliminates the
     class of issue.

  3. examples/keygen/keygen.c: pass allowExternalMu=NO for MLDSA. The
     v1.85 EXT_MU enforcement now correctly rejects allowExternalMu=YES
     at object creation per Part 2 §12.2.3.6.

  4. .github/workflows/make-test-swtpm.yml: convert v185-pqc-swtpm lane
     to build-only. swtpm has no v1.85 PQC, so unit.test PQC blocks fail
     on TPM_RC_SIZE; runtime PQC coverage stays in the fwtpm-v185 lane.

  5. .github/workflows/sanitizer.yml: UBSan-v185 now uses the same
     sanitizer flags as the classical UBSan lane (drops ).
     Pre-existing wolfSSL UB at misc.c:117 (440<<24 in Hash_df) only
     surfaces under -fsanitize=integer.
2026-04-29 10:28:44 -07:00
Aidan Garske d9143e3084 fwTPM v1.85: TCG + Skoll review fixes (round 2)
Closes 13 findings across two reviews of the v1.85 PQC paths.

   Tickets (TPMT_TK_VERIFIED / TPMT_TK_HASHCHECK / TPMT_TK_CREATION):
   - FwAppendTicket binds tag (always) and metadata (DIGEST_VERIFIED only)
     into the HMAC per Part 2 §10.6.5 Eq (5). Streamed via chunked
     wc_HmacUpdate, no temp buffer. All 5 callers updated; the hand-rolled
     VerifyDigestSignature path collapses into FwAppendTicket.
   - FWTPM_Object gains a hierarchy field, captured at every load/create
     site (CreatePrimary, Load, LoadExternal, CreateLoaded). Replaces
     hardcoded TPM_RH_OWNER in VerifySignature, VerifySequenceComplete,
     VerifyDigestSignature, ContextSave, and Create's creation ticket.
   - VerifySequenceComplete snapshots the verified digest before
     wc_HashFinal so Hash-ML-DSA tickets bind (digest || keyName) rather
     than just keyName — pre-fix, two distinct verified digests on the
     same key produced byte-identical tickets (universal reuse).

   Authorization:
   - Sign/VerifySequenceStart split TPM_RC_KEY (non-signing key, e.g.
     ML-KEM) from TPM_RC_SCHEME (signing key, scheme unsupported) using
     TPMA_OBJECT_sign per Part 3 §17.5.1 / §17.6.1.
   - SignDigest restricted-key path validates TPMT_TK_HASHCHECK HMAC
     per Part 3 §20.7.1 instead of blanket-rejecting; x509sign keeps
     the TPM_RC_ATTRIBUTES short-circuit.
   - Decapsulate, SignDigest, SignSequenceComplete reject NO_SESSIONS
     with TPM_RC_AUTH_MISSING (Auth Role: USER, Tables 62/124/126).

   Restricted-key TPM_GENERATED_VALUE check:
   - FWTPM_SignSeq.firstBytes[4] populated by SequenceUpdate covers the
     Hash-ML-DSA path where bytes are otherwise consumed by hashCtx;
     topped-up from the Complete trailing buffer for Pure-MLDSA one-shot.
     Closes the Update-then-empty-Complete bypass.

   Client-side (src/tpm2.c):
   - TPM2_VerifySequenceComplete defensively dispatches on validation.tag
     for TPMU_TK_VERIFIED_META, mirroring TPM2_VerifyDigestSignature.

   Other:
   - TPM2_Packet_AppendSensitive caps mldsa/mlkem .size to buffer length.
   - pqc_mssim_e2e.c zeroizes ss1/ss2 on cleanup.
   - Untrack examples/pqc/pqc_mssim_e2e (libtool wrapper with hardcoded
     /home/aidangarske path; .gitignore already covered it).
   - #pragma message at WOLFTPM_V185 build-time flagging that the PQC
     primary-key KDFa labels are interpretation pending TCG Part 4 v1.85;
     suppressible via -DWOLFTPM_V185_LABELS_ACK.

   Tests: 11 new fixtures in tests/fwtpm_unit_tests.c, 4 existing tests
   updated to assert new spec-mandated RCs. fwtpm_unit.test reports 105
   passing, zero failures.
2026-04-29 10:28:44 -07:00
Aidan Garske 1b909655bf Add Sign + verify examples 2026-04-29 10:28:44 -07:00
Aidan Garske 8311223bee docs: add v1.85 PQC build + usage section to main README and examples
Main README:
   - New ## Post-Quantum Cryptography (v1.85) section between fwTPM and
     TPM 2.0 Overview. Covers supported algorithms (ML-DSA-44/65/87,
     Hash-ML-DSA, ML-KEM-512/768/1024), exact wolfSSL + wolfTPM build
     config (--enable-dilithium --enable-mlkem --enable-experimental ...
     for wolfSSL; --enable-fwtpm --enable-v185 for wolfTPM), and a
     make check pointer.
   - Existing feature-list bullet at line 41 now points to the new
     section instead of directly to docs/FWTPM.md.

   examples/pqc/README.md:
   - Rewrite around three audience splits: (1) build steps, (2) run
     everything with make check, (3) per-example details.
   - New sections for mlkem_encap and the -mldsa/-hash_mldsa/-mlkem
     options on examples/keygen/keygen.
   - Drop stale --enable-swtpm reference (wrong flag; caused reviewer
     confusion).
   - Point users at the existing tests/fwtpm_check.sh and
     tests/pqc_mssim_e2e.sh for targeted reruns without the full classical
     suite.

   Documentation split (no duplication):
   - Top-level README - build + I just want to run it
   - examples/pqc/README.md per-example usage
   - docs/FWTPM.md#tpm-20-v185-post-quantum-support -> server internals
     (commands, primary-key derivation, buffer constants, spec
     interpretation decisions)
2026-04-29 10:28:44 -07:00
Aidan Garske 4491c20caa Add PQC options to examples/keygen + ML-KEM encap example
examples/keygen/keygen:
  - New -mldsa[=44|65|87], -hash_mldsa[=44|65|87], -mlkem[=512|768|1024]
    options alongside existing -rsa/-ecc/-sym/-keyedhash. Dispatches to
    wolfTPM2_GetKeyTemplate_{MLDSA,HASH_MLDSA,MLKEM}, then CreateKey under
    the SRK parent. AIK template path correctly rejects PQC (AIKs are
    RSA/ECC only per TCG).
  - Param-set parser defaults: MLDSA-65, MLKEM-768, SHA-256 pre-hash for
    Hash-ML-DSA.

  examples/pqc/mlkem_encap (new):
  - CreatePrimary MLKEM (512/768/1024) then Encapsulate + Decapsulate,
    asserting the two shared secrets match byte-for-byte. Companion to
    pqc_mssim_e2e but focused on the KEM wrappers alone.

  examples/run_examples.sh:
  - Detects WOLFTPM_V185 from config.h, runs keygen+keyload round-trip
    for all 9 PQC variants (same pattern used by RSA/ECC blocks above).
    All 9 pass against fwtpm_server.
2026-04-29 10:27:50 -07:00
Aidan Garske 4ead816713 fwTPM PQC: finish v1.85 protocol wiring for Sign/Verify over mssim
Server-side handler fixes:
   - FwCmd_SignSequenceStart / VerifySequenceStart: call FwSkipAuthArea when
     cmdTag == TPM_ST_SESSIONS. Without it, the 4-byte authAreaSize prefix
     was mis-parsed as the auth / context TPM2B size fields, producing
     mis-aligned context bytes (ctxSz=9 on sign, 0 on verify) so the μ fed
     into FIPS 204 differed between the two handlers — verify always failed.
   - FwCmd_SignSequenceStart / VerifySequenceStart: emit the output
     sequenceHandle before FwRspParamsBegin, matching TPM 2.0 response
     framing (handles precede the SESSIONS paramSize).
   - FwCmd_CreatePrimary: add MLDSA / HASH_MLDSA / MLKEM arms to the
     hashUnique switch so the unique template actually binds into KDFa
     derivation.
   - FwCmd_TestParms: accept PQC algs (MLKEM / MLDSA / HASH_MLDSA).

   Client-side wrapper fixes:
   - wolfTPM2_CopyPubT: add MLDSA / HASH_MLDSA / MLKEM cases. Previous
     switch fell through, leaving unique.mlkem / .mldsa as zero-filled
     buffers after a successful CreatePrimary (Jay's reported bug).
   - GetKeyTemplateSize: add PQC parameter-set-aware sizes.
   - wolfTPM2_SetKeyTemplate_Unique: add PQC arms.
   - TPM2_SignSequenceComplete: add CMD_FLAG_AUTH_USER2 (Table 124 requires
     USER auth on both @seq and @key handles).
   - TPM2_VerifySequenceComplete: remove extra buffer field (Table 118 has
     no buffer parameter); add CMD_FLAG_AUTH_USER1.

   examples/pqc/pqc_mssim_e2e.c: tighten validation — check_pub_populated
   catches CopyPubT-class regressions, MLKEM-768 Encap/Decap secrets must
   match, HashMLDSA-65 SignDigest emits a DIGEST_VERIFIED ticket.
2026-04-29 10:27:50 -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 e2d1c344ad F-3507 - https://fenrir.wolfssl.com/finding/3507 - examples/attestation/activate_credential: zero-init tpmSession so early-failure cleanup is safe 2026-04-28 10:58:56 -07:00
Aidan 5e50cff6f5 F-3506 - https://fenrir.wolfssl.com/finding/3506 - examples/keygen/keyload: guard primary unload against NULL on early init failure 2026-04-28 10:42:57 -07:00
Aidan d2dc2f726d F-3505 - https://fenrir.wolfssl.com/finding/3505 - examples/attestation/activate_credential: guard primary unload against NULL on early init failure 2026-04-28 10:40:39 -07:00
Aidan e7202aac6c F-3495 - https://fenrir.wolfssl.com/finding/3495 - examples/keygen: guard primary unload against NULL on early init failure 2026-04-28 10:05:48 -07:00
Aidan 1c2c809751 F-3494 - https://fenrir.wolfssl.com/finding/3494 - examples/pkcs7: reset offset and fix loop continuation so detached PKCS7 body actually gets written 2026-04-28 09:14:43 -07:00
Aidan 4437bef244 F-3493 - https://fenrir.wolfssl.com/finding/3493 - examples/management/flush: fix copy-paste so HMAC sessions loop walks 0x02000000-0x02000003 2026-04-28 09:10:08 -07:00
Aidan Garske ebb98f1389 examples/csr: size PEM buffer for RSA-4096 signatures
MAX_PEM_SIZE aliased to MAX_CONTEXT_SIZE (2 KB), which is enough
for an RSA-2048 self-signed cert but overflows at RSA-4096 where
the signature alone is 512 B plus the cert body, ASN.1, and base64
overhead. wc_MakeCertReq / wc_MakeSelfSignedCert then returned
BUFFER_E (0xffffff7c / 0xffffff53).

Gate on MAX_RSA_KEY_BITS so 2048-bit builds keep the exact same
buffer size; 4096-bit builds (Nations NS350, Infineon SLB967x, or
anyone overriding) get 4 KB. Mirrors the fix already applied to
examples/pkcs7/pkcs7.c.
2026-04-25 00:34:17 +01:00
Aidan Garske 52cdcdc159 examples/keygen: align keygen SRK default with keyload/seal
keygen defaulted srkAlg = TPM_ALG_ECC and only switched to RSA for
RSA keys, so SYMCIPHER and KEYEDHASH blobs were created under the
ECC SRK. After the prior keyload fix made keyload default to RSA
(matching seal.c), a sym/keyedhash blob produced by keygen could
not round-trip through keyload without a parent mismatch.

Invert the default to RSA (matching seal.c and keyload.c) and only
switch to the ECC SRK when the stored key itself is ECC. Keeps all
three tools aligned so any blob round-trips without callers having
to specify a parent.
2026-04-25 00:34:05 +01:00
Aidan Garske 34108a865c examples/keygen: pick SRK algorithm from stored key type
keyload defaulted srkAlg = TPM_ALG_ECC and only switched to RSA
  for TPM_ALG_RSA keys. A sealed KEYEDHASH blob (produced by
  examples/seal, which always uses the RSA SRK) therefore tried to
  load under the ECC SRK and failed with TPM_RC_INTEGRITY. SYMCIPHER
  blobs had the same issue.

  Invert the default to RSA (matching seal.c) and only switch to the
  ECC SRK when the stored key itself is ECC.
2026-04-24 22:45:00 +01:00
Aidan Garske eea8741248 examples/nvram: pick SRK algorithm from stored key type
nvram/read hardcoded the RSA SRK, so an ECC child key retrieved
  from NV would be loaded under the RSA parent and fail with
  TPM_RC_INTEGRITY. Switch the SRK selection to mirror the approach
  already used in keygen/keyload: inspect keyBlob.pub.publicArea.type
  and load the matching RSA or ECC SRK.
2026-04-24 22:28:25 +01:00
Aidan Garske 90846ba49f examples/pkcs7: size output buffer for RSA-4096 signatures
MAX_PKCS7_SIZE aliased to MAX_CONTEXT_SIZE (2 KB), which is enough
  for an RSA-2048 signed blob but overflows at RSA-4096 where the
  signature alone is 512 B plus a ~1-1.5 KB cert and ASN.1 overhead.
  wc_PKCS7_EncodeSignedData then returned BUFFER_E (0xffffff7c).

  Gate on MAX_RSA_KEY_BITS so 2048-bit builds keep the exact same
  buffer size; 4096-bit builds (Nations NS350, Infineon SLB967x,
  or anyone overriding) get 4 KB.
2026-04-24 22:24:57 +01:00
Aidan Garske 6942a8eb31 examples/wrap: use modulus size for RSA NULL-pad test message
The RSA encrypt/decrypt test with TPM_ALG_NULL padding hardcoded
  message.size = 256, which is only valid for 2048-bit RSA keys.
  With TPM_ALG_NULL padding the TPM returns a full modulus-sized
  plaintext on decrypt, so with a 4096-bit key the 256-byte message
  never equals the 512-byte plaintext and the test reports
  TPM_RC_TESTING.

  Derive the message size from the key's own keyBits so the test
  passes for any modulus size.

  Reported against wolfTPM 4.0.0 on Nations NS350 hardware (NSING).
2026-04-24 22:18:02 +01:00
David Garske 28c30eedb8 Peer review fixes 2026-04-23 11:11:59 -07:00
David Garske 664ad70336 Enhance the TPM 2 native_test to include additional ECC curves (P384). 2026-04-23 07:25:50 -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
Aidan c5145d88da F-3271 - https://fenrir.wolfssl.com/finding/3271 - Use TPM2_Packet_AppendSensitive in TPM2_LoadExternal and extend roundtrip test coverage 2026-04-21 14:08:40 -07:00
Aidan a3b77ff2dd F-3266 - https://fenrir.wolfssl.com/finding/3266 - Fix off-by-one >= to > in READ_BE16/READ_BE32 and data chunk length checks 2026-04-21 14:02:52 -07:00
Aidan 428bf7bff5 F-3265 - https://fenrir.wolfssl.com/finding/3265 - Route ST33 firmware abandon path through exit label to run cleanup 2026-04-21 14:02:52 -07:00
Aidan 70ec60779f F-3264 - https://fenrir.wolfssl.com/finding/3264 - Validate pcrIndex range after XATOI in quote example 2026-04-21 14:02:52 -07:00
Aidan 6d28982a3d F-3250 - https://fenrir.wolfssl.com/finding/3250 - Route IFX firmware abandon path through exit label to run cleanup 2026-04-21 14:02:52 -07:00
Aidan 55faf11f27 F-3249 - https://fenrir.wolfssl.com/finding/3249 - Check wc_HashGetDigestSize return with signed int before assigning to word32 2026-04-21 14:02:52 -07:00
Aidan Garske d7cc386225 Normalize NS350 chip state at entry/exit of nations SPDM tests
NS350's Nations_IdentityKeySet returns TPM_RC_VALUE when asked to set
  the identity key to its current value. The nations test assumed the
  chip always started at identity-key=1, but self-hosted CI runners
  carry persistent NV state across runs — any prior failure left the
  chip in a state the next run could not recover from. GPIO reset
  clears volatile state but does not reset NV-persistent identity-key
  or PSK provisioning.

  Add normalize_nations_chip(): GPIO reset + idempotent --psk-clear +
  idempotent --identity-key-set. Call at entry of both nations and
  nations-psk blocks, and wire to trap EXIT so the chip is always
  cleaned up on success, failure, or set -e early exit.

  Validated on Pi hardware across five scenarios (identity-key=1,
  identity-key=0, PSK-provisioned, nations-psk clean, nations-psk
  PSK-stuck): all runs now pass and leave the chip at canonical
  identity-key=1.
2026-04-21 18:19:32 +01:00
Aidan 2c02c7fec5 Use mp_to_unsigned_bin_len (not _ct) for portability across wolfSSL builds
Reviewer previously requested always using mp_to_unsigned_bin_len_ct,
  but CI builds with older or minimal wolfSSL configurations do not
  expose that symbol and fail with implicit declaration. Switching
  back to mp_to_unsigned_bin_len still fixes the actual security bug
  (data-dependent wire offset leaking the leading-zero count of ECDH
  shared secrets and ECC signature components) since it writes exactly
  the requested number of bytes with left-zero padding. The constant-
  time property of the _ct variant is a secondary concern that can be
  addressed separately once wolfSSL exposes it universally.
2026-04-20 12:11:47 -07:00
Aidan ed2e6a718d Add WOLFTPM_DEBUG_SECRETS macro for opt-in debug printing of sensitive material
Reviewer feedback on F-2508/F-2512: restore the removed TPM2_PrintBin
  debug lines that printed auth values, session keys, bind keys, HMAC
  keys, hierarchy auth, and encryption secrets, but gate them behind a
  new WOLFTPM_DEBUG_SECRETS macro that is never enabled by a configure
  option and must be defined manually. Emit a compile-time #warning
  whenever the macro is defined. Document the flag in README.md and in
  the new banner in wolftpm/tpm2_types.h.

  Reviewer feedback on F-2973/F-2974: always use mp_to_unsigned_bin_len_ct
  (not gated on WOLFSSL_HAVE_SP_ECC) for the ECDH shared-secret export in
  wolfTPM2_EncryptSecret_ECC and for the r/s export in the policy_sign
  example. The _ct variant is available on all wolfSSL math backends via
  macro fallback in integer.h.
2026-04-20 11:38:07 -07:00
Aidan 6c7d2e6af0 F-3015 - https://fenrir.wolfssl.com/finding/3015 - Remove short-circuit OR in FwVerifySignatureCore RSA-PKCS1v1.5 check 2026-04-20 11:38:07 -07:00
Aidan 2973ae05c3 F-2974 - https://fenrir.wolfssl.com/finding/2974 - Use constant-time export for ECC signature r/s in policy_sign example 2026-04-20 11:38:07 -07:00
Aidan bf3a39fb4a F-3001 - https://fenrir.wolfssl.com/finding/3001 - Reject NULL IV for non-ECB modes and oversized IV in wolfTPM2_EncryptDecryptBlock 2026-04-20 11:38:07 -07:00
Aidan Garske 0b2a1c31aa
Merge pull request #483 from dgarske/coverity_20260417
Coverity fixes for new fwtpm code
2026-04-17 12:56:16 -07:00
David Garske 34ae62ed09 Coverity fixes for new fwtpm code. 2026-04-17 12:17:36 -07:00
Aidan Garske 7ef21c0645 Address PR #481 review feedback
- Restore userWithAuth attribute in seal example (intentional for
     password-based unsealing)
   - Restore chained if (rc == TPM_RC_SUCCESS) pattern and the
     release-build authSz mismatch check in TPM2_CommandProcess
   - Restore TPM2_Packet_AppendSymmetric call in TPM2_Duplicate
   - Update ParamEncDec_Dispatch test to use fwtpm raw-pointer
     TPM2_ParamEnc_AESCFB signature
2026-04-17 11:02:58 -07:00
Aidan Garske 5c45cfb483 Fix skoll review 2026-04-17 10:02:57 -07:00
Aidan Garske 73c71217ca F-2978 - https://fenrir.wolfssl.com/finding/2978 - Add userWithAuth to KeySeal template default attributes 2026-04-17 09:58:38 -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 4d39d8b048 Remove bare scope blocks in spdm_ctrl.c and unit_tests.c 2026-04-07 11:45:50 -07:00
Aidan Garske c8dcf5b899 Address feedback copilot x daniele - NOT TESTED YET NEED TO TEST CHANGES
- NATIONS_PSK mode check (tpm2_spdm.c) - Only affects PSK mode which was already broken (raw path instead of VENDOR_DEFINED)
  - END_SESSION (tpm2_wrap.c) - New behavior but only adds an END_SESSION before the existing cleanup. If it fails, cleanup still proceeds.
  - Nations auto-connect (tpm2_wrap.c:279) - Only fires when spdmOnlyDetected is true (TPM locked in SPDM-only mode and TPM2_Startup returned
  TPM_RC_DISABLED). Normal operation never hits this path.
  - VdCode validation (spdm_tcg.c) - This one could theoretically break something if a response VdCode doesn't match. But all callers like
  wolfSPDM_TCG_GetPubKey() already validate VdCode independently (line 316-321), so the existing code was already checking this for specific commands.
  - VCA skip in PSK (spdm_psk.c) - Changes the transcript hash. Needs firmware 0.1.0.16 + NS350 to also skip VCA. Vision confirmed this works.
  - TPM_CMD_Lx defines / comments - No behavioral change.
2026-04-06 11:22:11 -07:00
Aidan Garske ddf990a4c9 Address review feedback
- Renamed spdm_demo to spdm_ctrl: file, binary, internal demo_* functions to ctrl_*, all references in
  include.am, spdm_test.sh, .gitignore, CLAUDE.md, both READMEs
  - README mentions Nations: title updated to Nuvoton NPCT75x and Nations NS350 TPMs, added Nations build section
  - README section header renamed from Demo Commands to Setup/Control Commands
  - README added reset pin control section: documents GPIO reset requirement, Pi-specific example, custom hardware
  design guidance
  - Moved spdm_tcg.c to common build section, no longer conditional on Nuvoton/Nations in src/spdm/include.am
  - Removed redundant wolfSSL options include from spdm_internal.h since tpm2_types.h handles this
  - Added WOLFTPM_SPDM_TCG generic guard as auto-define in spdm_types.h, replaced ~30 occurrences of #if        defined(WOLFSPDM_NUVOTON) || defined(WOLFSPDM_NATIONS) across all files
2026-03-25 18:59:32 +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 c12ea75657 fix CI ecdh curve mismatch 2026-03-20 22:21:45 +00:00
Paul Adelsbach d721f7b8c6 Fix finding 355 2026-03-06 15:07:43 -08:00
David Garske dcb54b34d1
Merge pull request #464 from aidangarske/add-seal-test-ci
Add seal/unseal examples with PCR, PolicyAuthorize, and NV policies
2026-02-28 08:56:21 -08:00
Aidan Garske a9471d1370 use WOLFCRYPT_ENABLE when testing without WC 2026-02-27 11:58:34 -08:00
Aidan Garske c12aa6b10d 1. .github/workflows/seal-test.yml — Pin actions/checkout@master → @v4 for supply-chain safety. Add explicit ref: master for wolfSSL, no ref for ibmswtpm2 (matches other workflows).
2. examples/seal/seal_policy_auth.c — Clarify header comment: no pre-existing key needed, but authkey.bin must be retained for unseal.
  3. examples/seal/seal_test.sh
  - Add || return 1 to setup_pcr/change_pcr extend calls
  - Use grep -F -q -- for fixed-string secret matching
  - Add 6 new param enc tests (3.4a-c XOR, 3.5a-c AES) for seal_nv
  4. examples/nvram/seal_nv.c — Implement real parameter encryption:
  - Add paramEncSession (separate from tpmSession to avoid conflict)
  - Start unsalted HMAC session with XOR/AES-CFB
  - Place on session slot 2 (slot 1 is used internally by NVWriteData for NV handle auth)
  - Clean up session in exit path
  5. examples/run_examples.sh — Add seal_nv XOR param encryption integration test
2026-02-27 11:28:56 -08: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
aidan garske 6768834c5a Add check for dig here 2026-02-26 15:24:31 -08:00
aidan garske 21f1d4926a Add free hash here 2026-02-26 14:47:52 -08:00
Aidan Garske fa3587d5b4 Address minor feedback 2026-02-26 11:23:05 -08:00
Aidan Garske fcde77c2bf Fix coverity scan issues in wolfTPM 2026-02-26 11:12:08 -08:00
David Garske b4b4509109
Merge pull request #460 from aidangarske/fix-issue-457
Improve error logging when wolfTPM2_Init fails
2026-02-24 14:07:43 -08:00
David Garske bdd6277bc0
Merge pull request #450 from jackctj117/cert-callback
Add TPM support for wc_SignCert_cb callback API
2026-02-23 14:09:33 -08:00
jackctj117 69f04630df Address PR review feedback: add WOLFSSL_CERT_SIGN_CB guards, input validation, SKID extension, and -signcb example option 2026-02-20 16:29:41 -07:00
Aidan Garske 38350aa4a0 Remove redundant rc changes 2026-02-20 21:02:10 +00:00
Aidan Garske 978b72fb12 Improve error logging when wolfTPM2_Init fails
Resolves #457. When the SPI device could not be opened (e.g., kernel TPM
  driver owns it), wolfTPM failed silently with no error output. Users had
  no indication of what went wrong or how to fix it.

  Changes:
  - Make TPM2_Init failed message in wolfTPM2_Init_ex always print
    (previously required --enable-debug)
  - Add SPI/I2C open failure logging in hal/tpm_io_linux.c: permission
    denied prints unconditionally, other errors print with DEBUG_WOLFTPM
  - Add autodetect scan exhaustion message (DEBUG_WOLFTPM)
  - Fix examples (caps, wrap_test, bench, pkcs7) that silently returned
    on init failure to print error code and RC string
  - Update 13 other examples to include error code in init failure message
2026-02-20 20:48:25 +00:00
aidan garske 16a28c2bb6 isPolicyDigest only declared in DEBUG_WOLFTPM 2026-02-20 11:52:52 -08:00
aidan garske 9c56801803 Fix coverity DEADCODE CID 900621 2026-02-20 11:44:22 -08:00
David Garske b7e0bf6c2a Peer review fixes 2026-02-19 13:59:36 -08:00
David Garske cfceb4e8b4 Improve get_ek_certs to handle indices 2026-02-19 13:11:50 -08: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
jackctj117 2f4cd41edc Add TPM support for wc_SignCert_cb callback API 2026-01-08 15:20:21 -07:00
David Garske 5a70253d03 A few more minor Coverity fixes. 2025-12-03 15:54:21 -08:00
David Garske 27d1a22144 Various minor coverity fixes 2025-12-03 12:47:21 -08:00
David Garske a88d7ba6e0 Add note about ifx_fw_update tool requirements 2025-11-21 14:32:44 -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 545c6b3df1 Fix for RSA private key import with PKCS8 header 2025-11-21 13:53:17 -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 b042e4da67 Fixes for build and testing with `--enable-infineon=9670`. Additional build tests. 2025-11-21 19:57:58 +00:00
David Garske 5217ca54ff Finishing up the CMake options to sync with configure 2025-11-20 13:30:47 -08:00
David Garske 5604e3d23d Add test case 2025-08-25 09:46:43 -07:00
David Garske bf1d5c7bca Improve the TLS bidirectional shutdown 2025-08-14 23:58:42 +01:00
David Garske 1402d0d132 wolfTPM Release v3.9.2 prep. Migrating to GPLv3. 2025-07-30 07:29:31 -07:00
David Garske 2fbbef40fd Fix using default wolfSSL ./configure. 2025-07-23 15:10:34 -07:00
David Garske 085e486cd8 Helpers for importing an external private key and creating an encrypted key blob. 2025-07-23 14:28:48 -07:00
David Garske 541a85ca5f Improve crypto callback key gen hash algorithm selection. 2025-07-23 13:33:37 -07:00
David Garske fde0571e6f Fix for session index in `hmac -aes` test. 2025-06-26 14:30:06 -07:00
David Garske 2d5a27d238 Example for HMAC with persistent key. ZD 20109. 2025-06-26 11:06:28 -07:00
David Garske 47193894e8 Cleanups for make_credential and `keygen -rsa` test case 2025-06-04 14:45:30 -07:00
David Garske d5872221ba Fix `TPM2_ParsePublic` size argument. 2025-06-02 16:33:18 -07:00
David Garske c364166542 Fix for missing `TPM2_ReleaseLock` in `TPM2_GetProductInfo`. 2025-05-28 16:04:51 -07:00
David Garske 7411bc115f Refactor the TPM2_GetNonce to support a non-locking version for internal use. This avoids all possible recursive mutex calls. 2025-05-27 14:42:43 -07:00
David Garske 32f0ef5107 Static analysis cleanups from scan-build. 2025-05-14 16:14:50 -07:00
David Garske 6fbb49a94f wolfTPM Release v3.9.0. Updated copyright and version. 2025-05-14 15:31:07 -07:00
Aidan Garske 8b8bd479a4 wolfTPM Zephyr Project Port #395 - Work by @aidangarske, @night1rider, and @dgarske 2025-05-14 13:56:08 -07:00
Zackery 33a5f47eaf
Merge pull request #398 from aidangarske/uboot_support
wolfTPM Support For Das U-Boot Bootloader
2025-05-06 18:17:56 -06:00
David Garske 985abb5eae Updated docs. Add test case for `TPM2_GetAlgId`. 2025-05-06 16:52:28 -07:00
David Garske 9c2ada8a7a Fixes for spelling and debug. 2025-05-06 16:41:34 -07:00
David Garske 0c2b0a43ed Fix location for TPM simulator `/tmp`. 2025-05-06 16:29:38 -07:00
Eric Blankenhorn 91ea3684b5
Merge pull request #412 from dgarske/bench_cleanup
Fix issue with possible handle leak in bench example
2025-05-05 15:13:58 -05:00
David Garske 5a5a7e2d25 Fix issue with possible handle leak in bench example. Reported in #411. 2025-05-02 15:31:06 -07:00
Aidan Garske d463f70975 Removed options.h not used, added TPM2_GetHierarchyDesc, and fixed indentation error 2025-04-30 11:22:13 -07:00
Aidan Garske f31929609f Rebase wolfTPM Support For Das U-Boot Bootloader 2025-04-25 13:28:09 -07:00
aidan garske 8e03c40fba removed test, only needs to be tested when actually used in wolfTPM 2025-03-28 14:31:00 -07:00
aidan garske 688ce722d3 Fix typo - default is used.. 2025-03-28 13:57:21 -07:00
aidan garske f10a27bb47 Add keygen test for AIK and defualt 2025-03-28 13:29:43 -07:00
aidan garske 942bbe7f03 removed testing 2025-03-28 13:22:52 -07:00
aidan garske 50c5f10277 Added keygen optional authentication password -auth=<yourpassword> 2025-03-28 12:50:22 -07:00
Tesfa Mael 7400f0f369 Review comment 2025-03-05 11:52:53 -08:00
Tesfa Mael 63385223ca Refactor ASN.1 parsing for RSA cert 2025-03-03 11:31:43 -08:00
David Garske 00749ad551 Fix run_examples.sh run.out location variable. 2025-02-21 16:53:23 -08:00
David Garske c42fff4f7f EK Cert Verification with TPM only (no wolfCrypt). Example assumes ST33KTPM2X. `./configure --disable-wolfcrypt && make && ./examples/endorsement/verify_ek_cert` 2025-01-24 09:54:11 -08:00
David Garske 2069ed7976 Fixes for scan-build and g++ warnings. 2025-01-07 10:47:26 -08:00
Eric Blankenhorn 80da56728c
Merge pull request #389 from dgarske/nv_extend
Fix issue with session binding / add NV extend example
2024-12-17 17:00:58 -06:00
Eric Blankenhorn cb645d3a21
Merge pull request #390 from dgarske/oldcrypt
Support for building wolfTPM against older wolfCrypt (like v4.7.0)
2024-12-17 17:00:50 -06:00
David Garske 15add23dcf Add code for calculating NV extend policies. Fixed issue with `wolfTPM2_PolicyHash` where input digest could be too large. 2024-12-17 11:30:47 -08:00
David Garske 671b702786 Allow extend with RSA or ECC. 2024-12-16 14:17:15 -08:00
David Garske 580b3a779e Fix issue with session binding. Add example for NV extend based on the TCG "bus protection guidance". 2024-12-16 11:53:52 -08:00
David Garske 8177ba8c1d Create separate tool for performing the TPM2_Clear (don't use args to wrap_test). 2024-12-13 14:52:38 -08:00
David Garske 7c48b76548 Support for building wolfTPM against older wolfCrypt (like v4.7.0). 2024-12-13 09:45:52 -08:00
JacobBarthelmeh d0618adaf3
Merge pull request #388 from dgarske/various_20241206
Various cleanups
2024-12-09 10:58:45 -07:00
David Garske 87edf3d840 Cleanup the `SensitiveToPrivate` function stack variables. Switch `wolfTPM2_LoadSymmetricKey` to default to the `WOLFTPM2_WRAP_DIGEST` for hash algorithm and not try to use SHA1. Cleanup comments on EK/SRK. Tab and formatting. 2024-12-06 16:56:03 -08:00
msi-debian 599998d827 Fixing PKCS7 Type delclaration 2024-11-18 10:18:05 -07:00
David Garske 6cb101da14 Remove execute bit on code/header files. 2024-11-11 06:59:10 -08:00
David Garske 3617abca97 Fix warning: `cannot convert argument of incomplete type 'void *' to 'WOLFTPM2_KEY *'`. Fix `extend.c:158:9: warning: Value stored to 'rc' is never read`. Fix `src/tpm2_wrap.c:2193:5: warning: Value stored to 'sensSz' is never read`. 2024-11-05 11:34:54 -08:00
David Garske 53feb3fb96 Add support for TPM2_GetCapability for TPM_CAP_PCRS. ZD 18881
Improve PCR extend to support -alg option.
2024-10-30 12:57:08 -07:00
David Garske 78457bebb7 Tested support for Nations NS350. Added simple capabilities example. 2024-10-04 08:35:35 -07:00
David Garske 034306a49c Fix macros to match. Resolves `error: unused variable 'pubKeySz'` and `examples/pcr/quote.c:336:9: error: use of undeclared identifier 'pubKey'`. 2024-09-20 17:15:08 -07:00
JacobBarthelmeh 388e32912e use XMALLOC/XFREE and update macro guards 2024-09-20 10:02:45 -07:00
JacobBarthelmeh a3beae82ee re-create correct hash before verify attempt 2024-09-13 14:53:56 -06:00
JacobBarthelmeh 4115da0b96 add example manual verification of quote signature with ecc 2024-09-13 12:09:53 -06:00
philljj 6020acfe4e
Merge pull request #376 from dgarske/tls_idevid
Improve the TPM TLS examples for use with `WOLFTPM_MFG_IDENTITY`
2024-09-11 15:35:10 -04:00