Commit Graph

314 Commits (1d8ea0cfd2df6188701f6fd8c0aba9ad3bc1b743)

Author SHA1 Message Date
Aidan Garske a1b08dbd8f Phase 10: dual-source NIST ACVP + wolfSSL KAT testing
tests/pqc_kat_vectors.h (new, 802 LoC of hex arrays):
  - 4 NIST ACVP vectors (authoritative spec-truth):
    - ML-DSA-44 sigVer (pk + msg + ctx + sig, valid signature)
      from usnistgov/ACVP-Server ML-DSA-sigVer-FIPS204 tgId=1 tcId=6
    - ML-KEM-512 encap (ek + m -> expected (c, k))
      from usnistgov/ACVP-Server ML-KEM-encapDecap-FIPS203 tgId=1 tcId=1
  - 4 wolfSSL internal vectors (regression lock):
    - ML-DSA-44 keygen (seed -> pk) from tests/api/test_mldsa.c:3111
    - ML-KEM-512 keygen (seed -> ek) from tests/api/test_mlkem.c:48

  tests/fwtpm_unit_tests.c (+173 LoC):
  - test_fwtpm_mldsa_nist_kat_verify: wolfCrypt-layer verify against NIST
    pinned vector; proves wc_dilithium_verify_ctx_msg is FIPS 204 correct.
  - test_fwtpm_mldsa_wolfssl_keygen_kat: seed -> expected pk byte match.
  - test_fwtpm_mlkem_nist_kat_encap: EncapsulateWithRandom with pinned
    randomness produces NIST expected (c, k); proves FIPS 203 correct.
  - test_fwtpm_mlkem_wolfssl_keygen_kat: seed -> expected ek byte match.
  - test_fwtpm_mldsa_loadexternal_verify: loads NIST MLDSA-44 pub into
    fwTPM via TPM2_LoadExternal (public-only, hierarchy NULL), proves
    the handler accepts PQC pub areas end-to-end.

  All 10 PQC tests pass alongside existing suite. No fwTPM handler
  changes needed — Phase 2 marshaling and the existing LoadExternal
  inPrivSize==0 path handle PQC public-only load natively.
2026-04-29 10:26:00 -07:00
Aidan Garske ef31aa8f79 Phase 8a: add PQC end-to-end tests; fix FIPS 204 hedged-sign RNG
tests/fwtpm_unit_tests.c:
  - Extend BuildCreatePrimaryCmd to emit MLKEM-768, MLDSA-65, and
    Hash-MLDSA-65/SHA-256 TPMT_PUBLIC templates per Part 2 Table 232.
  - test_fwtpm_create_primary_mlkem: sanity-check MLKEM keygen path.
  - test_fwtpm_create_primary_mldsa: sanity-check MLDSA keygen path.
  - test_fwtpm_mlkem_roundtrip: CreatePrimary MLKEM-768 → Encapsulate →
    Decapsulate, asserts both shared secrets are 32 bytes and identical.
    Proves Phase 3 KDFa derivation + Phase 4 encap/decap crypto + wire
    format for TPM2B_SHARED_SECRET and TPM2B_KEM_CIPHERTEXT.
  - test_fwtpm_mldsa_digest_roundtrip: CreatePrimary Hash-MLDSA-65 →
    SignDigest → VerifyDigestSignature, asserts TPM_ST_DIGEST_VERIFIED
    ticket. Proves Phase 5 digest handlers and Bug M-4 metadata format.
  - test_fwtpm_mldsa_sequence_roundtrip: CreatePrimary Pure MLDSA-65 →
    SignSequenceStart → SignSequenceComplete → VerifySequenceStart →
    SequenceUpdate → VerifySequenceComplete, asserts TPM_ST_MESSAGE_
    VERIFIED. Proves Phase 5 sign path, Phase 5b one-shot semantics and
    message accumulator, and Bug M-1 Pure-MLDSA wire format.

  Wired into main(); all five tests pass on --enable-v185.

  src/fwtpm/fwtpm_crypto.c, wolftpm/fwtpm/fwtpm_crypto.h:
  - Fix: FwSignMldsaMessage and FwSignMldsaHash now take a WC_RNG*.
    wolfCrypt wc_dilithium_sign_ctx_msg / sign_ctx_hash require a
    non-NULL RNG to source the 32-byte  value for hedged signing
    (FIPS 204 Algorithm 2 step 7). The Phase 5 code passed NULL and
    returned BAD_FUNC_ARG at runtime. Both hedged and deterministic
    signing are FIPS 204 compliant; wolfCrypt's non-_with_seed API
    chose hedged, matching normal TPM side-channel practice.

  src/fwtpm/fwtpm_command.c:
  - Pass &ctx->rng to the two updated sign helpers from FwCmd_SignDigest
    and FwCmd_SignSequenceComplete.
2026-04-29 10:26:00 -07:00
Aidan Garske 62f336807c Phase 1: Add Fixture tests known posotives 2026-04-29 10:26:00 -07:00
aidan garske feaa06c3d3 Fix PQC code review issues for v185 support
- Add TPM2B_MLDSA_SIGNATURE type with proper 4627-byte buffer for ML-DSA-87
    signatures instead of reusing TPM2B_MAX_BUFFER (1024 bytes)

  - Add bounds checking and byte skipping for MLDSA/MLKEM public key parsing
    in TPM2_Packet_ParsePublic to prevent buffer overflow

  - Add bounds checking for ML-DSA signature parsing in
    TPM2_Packet_ParseSignature with proper wire size tracking

  - Add bounds checking to Encapsulate/Decapsulate response parsing
    (sharedSecret and ciphertext buffers)

  - Add negative size validation for contextSz, digestSz, dataSz parameters
    in wrapper functions: wolfTPM2_SignSequenceStart, wolfTPM2_SignSequenceComplete,
    wolfTPM2_VerifySequenceStart, wolfTPM2_VerifySequenceComplete,
    wolfTPM2_SignDigest, wolfTPM2_VerifyDigestSignature

  - Fix misleading MAX_SIGNATURE_CTX_SIZE comment - this is for domain
    separation context (255 bytes), not signature size

  - Change TPMT_PUBLIC size check from assertion to warning for embedded
    systems compatibility
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
Aidan 2cc208906c F-3274 follow-up - tests/fwtpm_unit_tests: gate ECC sign helper for FWTPM_NO_NV builds too 2026-04-28 13:14:34 -07:00
Aidan 4817e79927 Skoll review fixes 2026-04-28 12:36:21 -07:00
Aidan f66ca1e189 F-3510 - https://fenrir.wolfssl.com/finding/3510 - wolftpm: TPM2_Packet_AppendSignature/ParseSignature explicitly handles TPM_ALG_NULL and warns on unrecognized sigAlg 2026-04-28 10:56:30 -07:00
Aidan 9beaf2f326 F-3501 - https://fenrir.wolfssl.com/finding/3501 - wolfTPM2_GetKeyTemplate_KeyedHash: scheme defaults to TPM_ALG_NULL when neither sign nor decrypt is requested 2026-04-28 10:53:43 -07:00
Aidan 2e00720eb4 F-3509 - https://fenrir.wolfssl.com/finding/3509 - wolftpm: TPM2_Packet_ParsePoint resyncs to outer point->size to prevent inner-size desync drift 2026-04-28 10:37:26 -07:00
Aidan 07bdb82195 F-3508 - https://fenrir.wolfssl.com/finding/3508 - wolftpm: TPM2_Packet_ParsePublic resyncs to outer pub->size to prevent inner-size desync drift 2026-04-28 10:33:52 -07:00
Aidan 3ec5485f19 F-3500 - https://fenrir.wolfssl.com/finding/3500 - wolfTPM2_NVCreateAuthPolicy: derive nameAlg from authPolicySz so SHA-384/SHA-512 policies are satisfiable 2026-04-28 10:28:42 -07:00
Aidan 68bf667c91 F-3499 - https://fenrir.wolfssl.com/finding/3499 - wolfTPM2_SignHashScheme/VerifyHashTicket: reject mismatched digest size for RSA, gate ECDSA
pad/truncate
2026-04-28 10:24:06 -07:00
Aidan ae4ebe764d F-3498 - https://fenrir.wolfssl.com/finding/3498 - wolfTPM2_RsaEncrypt/Decrypt return BUFFER_E for oversized input instead of silently truncating 2026-04-28 10:12:58 -07:00
Aidan b7d52b5810 F-3497 - https://fenrir.wolfssl.com/finding/3497 - wolfTPM2_LoadEccPublicKey_ex: caller-controlled scheme, hashAlg, and objectAttributes for ECDH peer keys 2026-04-28 10:10:31 -07:00
Aidan cae955fa21 F-3504 - https://fenrir.wolfssl.com/finding/3504 - wolftpm: map wolfCrypt Brainpool curves to TPM_ECC_BP_*_R1 (0x003X), not Barreto-Naehrig BN_P256 2026-04-28 09:58:36 -07:00
Aidan d04a78ee6c F-3502 - https://fenrir.wolfssl.com/finding/3502 - wolftpm: TPM2_Packet_ParseAttest decodes TPM_ST_ATTEST_NV_DIGEST as TPMS_NV_DIGEST_CERTIFY_INFO 2026-04-28 09:53:12 -07:00
Aidan 588455fd39 F-3274 - https://fenrir.wolfssl.com/finding/3274 - fwtpm: FwCmd_CertifyCreation consumes ECDAA count field per Part 2 Sec. 11.2.1.5 2026-04-28 09:42:41 -07:00
Aidan aa1957895d F-3273 - https://fenrir.wolfssl.com/finding/3273 - fwtpm: FwCmd_Sign consumes ECDAA count field per Part 2 §11.2.1.5 2026-04-28 09:34:06 -07:00
Aidan 1d7f46093e F-3272 - https://fenrir.wolfssl.com/finding/3272 - fwtpm: FwParseAttestParams consumes ECDAA count field per Part 2 §11.2.1.5 2026-04-28 09:29:10 -07:00
Aidan 3b0147d48a F-3496 - https://fenrir.wolfssl.com/finding/3496 - wolfTPM2_StartSession: enable parameter encryption attrs for salted sessions, not only bind+salt 2026-04-28 09:25:48 -07:00
Aidan f62070ac46 F-3503 - https://fenrir.wolfssl.com/finding/3503 - fwtpm: emit TPM_ST_ATTEST_NV_DIGEST when NV_Certify size and offset are both zero 2026-04-28 09:03:10 -07:00
David Garske f8d06b9589 PR review fixes 2026-04-22 10:09:56 -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 f684ab4a8c F-3251 - https://fenrir.wolfssl.com/finding/3251 - Use TPM2_Packet_ParseEccScheme in TPM2_ECC_Parameters to consume ECDAA count 2026-04-21 14:02:52 -07:00
Aidan Garske c8d51e9693
Merge pull request #486 from dgarske/ciports
Add network namespace isolation, macOS CI, and Windows build support for fwTPM
2026-04-21 09:22:57 -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 adc2713145 F-2533 - https://fenrir.wolfssl.com/finding/2533 - Add TPM2_Packet_ParseSensitive counterpart and roundtrip test 2026-04-20 11:38:07 -07:00
Aidan 31bcbb234f F-3005 - https://fenrir.wolfssl.com/finding/3005 - Handle ECSCHNORR and SM2 signature serialization 2026-04-20 11:38:07 -07:00
Aidan 286a44602c F-3004 - https://fenrir.wolfssl.com/finding/3004 - Add kdf field to TPMT_KEYEDHASH_SCHEME XOR serialization 2026-04-20 11:38:07 -07:00
Aidan b57d352c15 F-2962 - https://fenrir.wolfssl.com/finding/2962 - Add SM3_256 and SHA3 digest sizes to TPM2_GetHashDigestSize
F-2963 - https://fenrir.wolfssl.com/finding/2963
  F-2964 - https://fenrir.wolfssl.com/finding/2964
  F-2965 - https://fenrir.wolfssl.com/finding/2965
  F-3003 - https://fenrir.wolfssl.com/finding/3003
  F-3006 - https://fenrir.wolfssl.com/finding/3006
  F-3007 - https://fenrir.wolfssl.com/finding/3007
  F-3008 - https://fenrir.wolfssl.com/finding/3008
2026-04-20 11:38:07 -07:00
Aidan 4588c27203 F-3000 - https://fenrir.wolfssl.com/finding/3000 - Add unit test for wolfTPM2_UnloadHandle persistent handle guard 2026-04-20 11:38:07 -07:00
Aidan 1e65a8fece F-2999 - https://fenrir.wolfssl.com/finding/2999 - Add unit test for wolfTPM2_NVDeleteKey persistent handle range checks 2026-04-20 11:38:07 -07:00
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 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
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 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 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
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
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
Aidan Garske 06dbea62eb Address peer review 2026-04-14 15:47:42 -07:00
Aidan Garske da460036b3 Address review feedback 2026-04-14 14:31:24 -07:00
Aidan Garske b14973b0ef F-2956 - https://fenrir.wolfssl.com/finding/2956 - Fix wolfTPM2_PolicyHash boundary check from cc > TPM_CC_FIRST to cc >= TPM_CC_FIRST and add unit test covering cc=0, cc=TPM_CC_FIRST, and cc=TPM_CC_PolicyPCR 2026-04-14 10:32:49 -07:00
Aidan Garske d7c98eb3aa F-2958 - https://fenrir.wolfssl.com/finding/2958 - Add unit test for wolfTPM2_SetAuthHandle policyAuth branch verifying auth placed at authDigestSz offset
F-2959 - https://fenrir.wolfssl.com/finding/2959 - Add unit test for wolfTPM2_SetAuthHandleName policyAuth branch verifying auth placed at authDigestSz offset
2026-04-14 10:11:11 -07:00
Aidan Garske 3faeba6e3c F-2953 - https://fenrir.wolfssl.com/finding/2953 - Add KDFa test vectors for ATH, SECRET, and DUPLICATE labels pinning TPM 2.0 spec-mandated session key derivation labels
F-2954 - https://fenrir.wolfssl.com/finding/2954 - Add KDFa test vector for SECRET label
F-2955 - https://fenrir.wolfssl.com/finding/2955 - Add KDFa test vector for DUPLICATE label
2026-04-14 09:55:00 -07:00
Aidan Garske 23394e6de3 F-2952 - https://fenrir.wolfssl.com/finding/2952 - Add unit test for wolfTPM2_PolicyAuthValue verifying auth placed at authDigestSz offset preserving HMAC key slot 2026-04-14 09:50:05 -07:00
Aidan Garske f26d494c03 F-2951 - https://fenrir.wolfssl.com/finding/2951 - Add unit test for SensitiveToPrivate pinning KDFa STORAGE and INTEGRITY labels with test vector 2026-04-14 09:46:22 -07:00
David Garske 48d16449cd Fenrir fixes: F-2513, F-2514, F-2529, F-2534, F-2522, F-2515, F-2516, F-2520, F-2521 2026-04-09 17:14: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 49c767432f Add Nuvoton NPCT75x and NSING NS350 SPDM support for wolfTPM 2026-03-24 18:15:38 +00:00
Paul Adelsbach 383bdb4887 Add test case for early returns from test_wolfTPM2_EncryptSecret 2026-03-08 22:16:12 -07:00
aidan garske e50586d232 Fix Fenrir Issues in wolfTPM 2026-02-24 17:44:46 -08:00
Aidan Garske 492906a6aa Fix for stm33KTPM support pr deadcode 2026-01-27 16:41:55 -08:00
Aidan Garske 0b50f632ae Add stm33ktpm support LMS and non-LMS 2026-01-27 15:57:09 -08:00
David Garske 8c5c6cbcc8 Fix AddressSanitizer warning with overlapping memcpy (need to use memmove). Fix test case with `WOLFTPM2_USE_SW_ECDHE`. 2025-12-10 17:37:51 -08:00
David Garske ce229628b2 Fix for wolfTPM2_SignHash to return padded r/s. Improves handling of ECDSA with P521. Adds tests for ECDSA with crypto callbacks. ZD20777 2025-12-10 15:10:41 -08:00
David Garske 1402d0d132 wolfTPM Release v3.9.2 prep. Migrating to GPLv3. 2025-07-30 07:29:31 -07:00
David Garske 932499f742 Implement an address sanitizer test. Fix some of the configurable limit defaults. 2025-07-17 15:54:33 -07:00
David Garske e84f990447 Improve the detection of maximum HASH_COUNT. ZD 20193. 2025-07-11 13:15:59 -07:00
David Garske a45f922c6d Fix for older TPM's that don't support ECC384/SHA384. 2025-06-02 08:11:09 -07:00
David Garske f1507c697b Minor cleanups. Fixed `test_TPM2_PCRSel` test. 2025-06-02 08:11:09 -07:00
David Garske 592210f321 Expose `TPM2_ASN_TrimZeros`. 2025-06-02 08:11:08 -07:00
David Garske 3e3038854c Improve input digest size logic for TPM2_Sign and TPM2_Verify. Added test case with interop. 2025-06-02 08:11:08 -07:00
David Garske 6fbb49a94f wolfTPM Release v3.9.0. Updated copyright and version. 2025-05-14 15:31:07 -07:00
David Garske 985abb5eae Updated docs. Add test case for `TPM2_GetAlgId`. 2025-05-06 16:52:28 -07:00
David Garske a98d0b0d3c Improve the unit test for PCR select with HASH_COUNT. 2024-08-22 07:39:32 -07:00
David Garske a012348fe9 Fixes for `TPM2_SetupPCRSel`. Added test cases. Fixes ZD 18492 2024-08-21 11:29:08 -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 c98ee9a71e Update copyright date. 2024-04-24 10:42:27 -07:00
David Garske ada472113c Fix for two missed files for config.h. Found using `git grep -L "HAVE_CONFIG_H" -- **/*.c`. 2024-02-08 17:11:36 -08:00
Eric Blankenhorn 88bff510bb
Merge pull request #312 from dgarske/tls_pkcb
Added support for TLS PK callbacks with ECC and RSA Sign using PKCSv1.5 and PSS padding
2023-12-08 15:10:32 -06:00
David Garske 53b043dafa Tests for keyblob buffer export/import. Added support for getting the keyblob sizes. 2023-12-06 11:20:18 -08:00
David Garske e601803f1b Added support for PK callbacks with RSA Sign using PKCSv1.5 and PSS.
Fixes for building wolfTPM without crypto callbacks.
Fixes for building/running with FIPS.
2023-12-01 08:25:53 -08:00
David Garske 249f9d4942 Fixes for building wolfCrypt without PEM to DER support. 2023-11-15 21:53:50 -08:00
David Garske a33ed5b9ae Allow import of wolf ECC marked as private only (`ECC_PRIVATEKEY_ONLY`). 2023-11-15 21:52:49 -08:00
David Garske 0c7254d7c0 Fixes for building with C++. 2023-10-11 15:56:04 -07:00
David Garske a15260342f wolfTPM Support for sealing/unsealing based on a PCR that is signed externally. Use an external key to sign a PCR digest. Allows a new signed policy to be sent with updates to continue allowing a sealed secret to be unsealed when PCR's change. This resolves the issue with PCR brittleness. 2023-08-29 18:47:18 -07:00
David Garske c05bf659c2 Fix broken paths with HAL refactor. Update TLS examples to use latest TLS version (allowing downgrade). 2023-01-20 08:29:53 -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
John Bland b49be0e0aa add thread local storage test to the unit tests 2023-01-16 17:04:49 -05:00
Anthony Hu d7b76cdee5
Merge pull request #233 from dgarske/release_v2.5.0
wolfTPM v2.5.0 release
2022-07-22 12:50:55 -04:00
David Garske ff250dde8a Added unit tests for CSR distinguished name parsing. Cleanup the unit test "Passed". 2022-07-22 09:44:22 -07:00
David Garske 3f84b2efbc wolfTPM v2.5.0 release prep 2022-07-22 09:32:57 -07:00
Elms a787dab931 Fix tests and wrapper example with no wolfcrypt 2022-05-06 21:43:15 -07:00
David Garske d035cd239c Fix for a few spelling errors. Whitespace cleanup. 2021-12-07 11:10:50 -08:00
David Garske 2b8cfb8692 wolfTPM Release v2.1.0 preparation.
* Updated copyright
* Fixed minor cast warning.
* Fixed minor scan-build warnings.
* Cleanup print public and fix possible print of uninitialized field.
2021-03-17 10:13:50 -07:00
Elms ba75a0b438 tests: Pass test with ibmswtpm2
RC handle number modifier is added to response code.
2021-03-04 15:24:59 -08:00
Elms 52f3972d3f test: flush before abort to get errors to log 2021-03-04 11:10:44 -08:00
Elms e0d4aba037 Prevent potential buffer overrun in KDFa
found by running `CFLAGS="-fsanitize=address" ./configure
--enable-swtpm` and and running `./scripts/swtpm_sim.test`
2021-03-04 11:10:28 -08:00
David Garske 8087afaf27 Fixes from peer review. Resolve issue with make check. Removed the TPM Simulator for make check (does not build out of the box on all platforms). Make dist was not including the new tpm2_socket.h. 2020-12-01 07:45:04 -08:00
Dimitar Tomov 24a49de385 Added AES CFB parameter support, salted TPM session, fixed KDFa and examples
* Added key generation example with parameter encryption
* Fixes and cleanups for KDFa
* Added KDFa unit test (passes)
* Added AES CFB support
* Fix for nonceTPM
* Added support for encrypted RSA salt and salted-unbounded session
* Removed unsalted-unbounded specific code for authValueKDF from KDFa
* Add innerWrap support
* Add missing wolfcrypt header for AES CFB
* Fixes for casting when calling KDFa for AES CFB parameter encryption
* Add outerWrap support

Signed-off-by: Dimitar Tomov <dimi@wolfssl.com>
2020-11-19 15:08:30 +02:00
Elms 3a1ef5a0a4 Add winapi for Windows TBS support (with minGW build)
TESTED:

  `./configure --host=i686 CC=i686-w64-mingw32-gcc CFLAGS="-DWIN32 \
  -DMINGW -D_WIN32_WINNT=0x0600" LIBS="-lws2_32 -ltbs" \
  --enable-winapi`
2020-10-07 13:22:19 -07:00
Elms e93c47c11b `make check` runs with simulator for `--enable-swtpm` 2020-09-30 13:11:24 -07:00
Elms 9617dab37e swtpm: Rename SOCKET option to SWTPM 2020-09-24 08:37:06 -07:00
Elms 63736417b2 Add socket connection option for using with TPM2 simulator
This is largely based on and tested against http://ibmswtpm.sourceforge.net/
2020-09-23 10:39:38 -07:00
Dimitar Tomov 816272bf6a Update unit testing for wolfTPM2_Init to reflect Linux TIS driver support
Signed-off-by: Dimitar Tomov <dimi@designfirst.ee>
2020-05-13 15:51:37 +03:00
Chris Conlon 91ef0b0e6e update copyright to 2020 2020-01-03 15:31:27 -08:00
David Garske c3bc039876 Fix for building unit tests with `./configure --disable-wolfcrypt`. Missing stdlib. 2019-08-02 06:48:12 -07:00
David Garske 6ee1cee883 Added more API unit tests. Cleanup of the argument checking return codes. 2019-07-23 14:43:40 -07:00
David Garske c6e45dc580 Added new wrapper API `wolfTPM2_OpenExisting` for accessing device that's already started. Added unit test framework. 2019-07-23 14:43:40 -07:00