Commit Graph

1485 Commits (d450a533edd468546efe88fc7f22a79edbdbf9f5)

Author SHA1 Message Date
Aidan d450a533ed F-2998 - https://fenrir.wolfssl.com/finding/2998 - Add unit test for wolfTPM2_NVStoreKey persistent handle range checks 2026-04-20 11:38:07 -07:00
Aidan 9ec97d0046 F-2512 - https://fenrir.wolfssl.com/finding/2512 - Remove session HMAC key and bind key from debug output in tpm2_param_enc.c 2026-04-20 11:38:07 -07:00
Aidan 853b7f6788 F-2508 - https://fenrir.wolfssl.com/finding/2508 - Remove sensitive auth and key material from debug output 2026-04-20 11:38:07 -07:00
Aidan b05c503d71 F-2967 - https://fenrir.wolfssl.com/finding/2967 - Clear ECC private key from stack on error paths in wolfTPM2_ImportEccPrivateKeySeed 2026-04-20 11:38:07 -07:00
Aidan 47aca58edf F-2950 - https://fenrir.wolfssl.com/finding/2950 - Save and restore session[0] in SpdmEnable, SpdmDisable, and SpdmNationsIdentityKeySet 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
David Garske f1afb9ff4a
Merge pull request #487 from aidangarske/spdm-fix-swtpm-autoenable
Fix SPI and I2C behavior with SWTPM or FWTPM
2026-04-17 17:58:30 -07:00
Aidan Garske b7ad7d8db8 Fix SPI and I2C behavior with SWTPM or FWTPM 2026-04-17 14:41:43 -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 a7c3395f72
Merge pull request #481 from aidangarske/fenrir-fixes-7
SPDM and Examples Fixes and Unit Testing
2026-04-17 12:40:40 -07:00
David Garske c8fc133763
Merge pull request #485 from aidangarske/spdm-split-runners-v2
Split hardware SPDM CI across runners
2026-04-17 12:23:01 -07:00
David Garske 34ae62ed09 Coverity fixes for new fwtpm code. 2026-04-17 12:17:36 -07:00
Aidan Garske de47fd541b Split hardware SPDM CI across two self-hosted runners
Each vendor now has a dedicated Pi:
     - wolftpm-nuvoton: NPCT75x on SPI CS 0 (existing runner, relabeled)
     - wolftpm-nations: NS350 on SPI CS 0 (new runner rpi-ns350)

   Changes:
     - runs-on uses matrix.runner_label so each matrix entry routes to
       the correct physical runner.
     - Concurrency moved from workflow-level to job-level with group
       hw-spdm-runner-${{ matrix.vendor }} so nuvoton and nations run in
       parallel rather than serializing on a shared hw-spdm-runner group.
     - Dropped the pre-test caps detect step and its GPIO 4 reset pulse.
       The detect step was unreliable (auto-SPDM in wolfTPM2_Init only
       fires on TPM_RC_DISABLED from Startup, not TPM_RC_FAILURE, so a
       locked chip couldn't self-recover) and pointless now that each
       runner is dedicated to a known chip. spdm_test.sh already handles
       its own vendor-specific reset: gpio_reset for nuvoton, no-reset
       for nations (GPIO 4 isn't routed to NS350 RST on the daughter
       board, per spdm_test.sh:135,159).
     - Nations spi_cs flipped from 1 to 0 since the new Pi has NS350 on
       its own CS 0 rather than sharing a bus with NPCT75x.
2026-04-17 12:01:00 -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
David Garske e9c90995e6
Merge pull request #484 from aidangarske/spdm-runner-caps-reset
Reset on SPDM runner test
2026-04-17 10:20:07 -07:00
Aidan Garske 5c45cfb483 Fix skoll review 2026-04-17 10:02:57 -07:00
Aidan Garske 608e738f00 F-2984 - https://fenrir.wolfssl.com/finding/2984 - Add boundary validation tests for CreateKeySeal_ex and LoadKeyedHashKey 2026-04-17 09:58:38 -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
Aidan Garske f6aa1ed538 F-2976 - https://fenrir.wolfssl.com/finding/2976 - Guard handle auth assignment on success in wolfTPM2_SetIdentityAuth 2026-04-17 09:58:38 -07:00
Aidan Garske 1c378aa230 F-2991 - https://fenrir.wolfssl.com/finding/2991 - Add ForceZero for sensitive stack buffers in SPDM PSK and TCG functions 2026-04-17 09:57:00 -07:00
Aidan Garske 168296d558 F-2987 - https://fenrir.wolfssl.com/finding/2987 - Fix ECC ECDAA scheme serialization missing count field, RSA RSAES spurious hashAlg, and TPM2_Sign ECDAA count 2026-04-17 09:57:00 -07:00
Aidan Garske a34459d92c F-2985 - https://fenrir.wolfssl.com/finding/2985 - Add known-answer unit test for wolfTPM2_ComputeName 2026-04-17 09:57:00 -07:00
Aidan Garske cd63015325 F-2982 - https://fenrir.wolfssl.com/finding/2982 - Add known-answer unit test for TPM2_HashNvPublic 2026-04-17 09:48:59 -07:00
Aidan Garske 9cec95ffea F-2981 - https://fenrir.wolfssl.com/finding/2981 - Add dispatch-level roundtrip test for TPM2_ParamEnc/Dec_CmdRequest/Response 2026-04-17 09:48:59 -07:00
Aidan Garske 77faffc1b4 F-2977 - https://fenrir.wolfssl.com/finding/2977 - Fix DecodeRsaDer/DecodeEccDer default attributes for private key imports 2026-04-17 09:48:59 -07:00
Aidan Garske df62e8ea6a F-2975 - https://fenrir.wolfssl.com/finding/2975 - Fix NULL pointer dereference in wolfTPM2_LoadRsaPrivateKey_ex and wolfTPM2_LoadEccPrivateKey 2026-04-17 09:48:59 -07:00
Aidan Garske 7bf45b7608 Reset on SPDM runner test 2026-04-17 09:37:17 -07:00
David Garske 35629e96df
Merge pull request #482 from aidangarske/spdm-runners
Add hardware SPDM CI runner + fix SPDM auto-connect regression
2026-04-17 08:21:03 -07:00
Aidan Garske b8e63ea91b
Merge pull request #474 from dgarske/fwtpm
Add firmware TPM 2.0 (fwTPM) implementation
2026-04-16 17:16:46 -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 3cb1ddb25c Fix SPDM auto-connect and add hardware test CI workflow
- src/tpm2_wrap.c: wolfTPM2_Init auto-SPDM path now calls vendor-specific
     wolfTPM2_SpdmConnectNuvoton/Nations (which sets TIS I/O, mode, and the
     host ephemeral key pair for mutual auth). Previous refactor to the
     generic wolfTPM2_SpdmConnect dropped that setup, so FINISH failed with
     WOLFSPDM_E_PEER_ERROR whenever the TPM was in SPDM-only-locked mode.

   - src/tpm2_spdm.c: wolfSPDM_ParseVendorDefined returns payload dataLen
     (>=0) on success per spdm_tcg.c:72 convention. wolfTPM2_SPDM_SecuredExchange
     was treating any non-zero return as an error, so the first TPM command
     over SPDM (10-byte Startup response) bubbled up as rc=0xa.

   - tests/unit_tests.c: Add test_tpm_alg_supported() helper that queries
     TPM_CAP_ALGS and skip test_wolfTPM2_EccSignVerifyDig iterations when the
     hash isn't supported. Nuvoton NPCT75x lacks SHA512 and returns
     TPM_RC_SIZE parameter 1 (not TPM_RC_HASH), so the prior post-hoc skip
     couldn't catch it.

   - .github/workflows/hw-spdm-test.yml: New workflow targeting a self-hosted
     Raspberry Pi runner. Runs examples/spdm/spdm_test.sh against real Nuvoton
     hardware. Fork-PR gated. Health check soft-fails with a warning if the
     Pi is unhealthy so merging isn't blocked on a flaky runner. Nations
     matrix entry scaffolded (commented) for when the NS350 is wired.

   - scripts/hw-runner-health-check.sh: Pre-flight that verifies /dev/spidev,
     /dev/gpiochip, and gpiod are present+accessible before the build.
2026-04-16 16:15:56 -07:00
David Garske 4556395d25
Merge pull request #480 from aidangarske/fenrir-fixes-5
Test Mutations, Unit tests, ForceZero Unification, and Fixes for wolfTPM
2026-04-14 19:21:07 -07:00
Aidan Garske 06dbea62eb Address peer review 2026-04-14 15:47:42 -07:00
Aidan Garske b5255c3326 F-2504 - https://fenrir.wolfssl.com/finding/2504 - Restore auth zero-padding in wolfTPM2_CreatePrimaryKey_ex and add matching padding to wolfTPM2_CreateKey and wolfTPM2_CreateLoadedKey for consistent auth handling 2026-04-14 15:37:33 -07:00
Aidan Garske da460036b3 Address review feedback 2026-04-14 14:31:24 -07:00
Aidan Garske 5e0f3004d6
Merge pull request #479 from dgarske/openstm32_dep
Deprecating OPENSTM32 support
2026-04-14 13:11:49 -07:00
Aidan Garske 881772c5f3 F-2971 - https://fenrir.wolfssl.com/finding/2971 - Add ForceZero on session auth in wolfTPM2_UnloadHandles before return 2026-04-14 12:23:03 -07:00
Aidan Garske 40dddb064d F-2970 - https://fenrir.wolfssl.com/finding/2970 - Add ForceZero on key material at early return in wolfTPM2_LoadKeyedHashKey 2026-04-14 12:21:39 -07:00
Aidan Garske a251d20e47 F-2968 - https://fenrir.wolfssl.com/finding/2968 - Add ForceZero on auth in wolfTPM2_HmacStart on all exit paths 2026-04-14 12:20:04 -07:00
Aidan Garske de6599bac9 F-2527 - https://fenrir.wolfssl.com/finding/2527 - Add ForceZero on PSS padded buffer in wolfTPM2_PK_RsaPssSign before scope exit 2026-04-14 12:18:38 -07:00
Aidan Garske a779d74f03 F-2966 - https://fenrir.wolfssl.com/finding/2966 - Add ForceZero on ECC private key in wolfTPM2_SpdmConnectNations error path after wc_ecc_export_public_raw failure 2026-04-14 12:17:29 -07:00
Aidan Garske d3df2ec04a F-2168 - https://fenrir.wolfssl.com/finding/2168 - Add ForceZero on auth password in wolfTPM2_CreatePrimaryKey_ex on all exit paths 2026-04-14 12:15:32 -07:00
David Garske 4202868f0c Deprecating OPENSTM32 support 2026-04-14 12:13:33 -07:00
Aidan Garske 0f6ec15e4d F-2167 - https://fenrir.wolfssl.com/finding/2167 - Add ForceZero on auth password in wolfTPM2_CreateKey on all exit paths 2026-04-14 12:13:13 -07:00
Aidan Garske 0c33f4e62f F-2163 - https://fenrir.wolfssl.com/finding/2163 - Add ForceZero on local keyBlob in wolfTPM2_LoadRsaPrivateKey_ex, wolfTPM2_LoadEccPrivateKey, and wolfTPM2_CreateAndLoadKey 2026-04-14 11:59:48 -07:00
Aidan Garske 2ee032f6ad F-2162 - https://fenrir.wolfssl.com/finding/2162 - Add ForceZero on new auth password in wolfTPM2_ChangeAuthKey on all exit paths 2026-04-14 11:26:08 -07:00
Aidan Garske 17c5b03623 F-1763 - https://fenrir.wolfssl.com/finding/1763 - Add ForceZero on derived identity auth digest in wolfTPM2_SetIdentityAuth before return 2026-04-14 11:14:51 -07:00
Aidan Garske acf4e9ebb0 F-2961 - https://fenrir.wolfssl.com/finding/2961 - Use TPM2_Packet_AppendSymmetric and TPM2_Packet_ParseSymmetric for SYMCIPHER case in AppendPublicParms and ParsePublicParms 2026-04-14 11:12:12 -07:00
Aidan Garske ef7c8a197c F-2945 - https://fenrir.wolfssl.com/finding/2945 - Add TPM_ALG_NULL check before serializing inScheme details in TPM2_Certify, TPM2_CertifyCreation, TPM2_Quote, TPM2_GetSessionAuditDigest, TPM2_GetCommandAuditDigest, TPM2_GetTime, and TPM2_NV_Certify 2026-04-14 11:10:12 -07:00
Aidan Garske 376614db01 F-2160 - https://fenrir.wolfssl.com/finding/2160 - Use clamped nonceCaller size in XMEMCPY in wolfTPM2_StartSession instead of original unclamped value 2026-04-14 11:08:51 -07:00