Commit Graph

42 Commits (master)

Author SHA1 Message Date
David Garske d5872221ba Fix `TPM2_ParsePublic` size argument. 2025-06-02 16:33:18 -07:00
David Garske 6fbb49a94f wolfTPM Release v3.9.0. Updated copyright and version. 2025-05-14 15:31:07 -07:00
David Garske 2069ed7976 Fixes for scan-build and g++ warnings. 2025-01-07 10:47:26 -08: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 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 57f12df97b Support for getting TPM EK Certificates. Added `wolfTPM2_GetKeyTemplate_EK` and `wolfTPM2_GetKeyTemplate_EK` API's for getting EK public templates for generating the EK primary key. Fix TLS example build issues with wolfSSL not having crypto callback or PK callback enabled. 2024-07-26 13:02:57 -07:00
David Garske c98ee9a71e Update copyright date. 2024-04-24 10:42:27 -07:00
David Garske b395b65287 Fix for config.h, which should only be included from .c files, not headers. ZD 17473 2024-02-07 14:28:33 -08:00
David Garske f3e1bbbf3d Refactor of the command authentication. If command does not require auth do not supply it. ZD 16689 2023-10-12 13:48:04 -07:00
David Garske 96cd17af1d Improvements/fixes to NV auth and session auth set/unset:
* Fix bug with NV name after first write (only appears when using HMAC session).
* Add new API `wolfTPM2_UnsetAuthSession` to unset auth index for a session and save off the nonce from the TPM. This allows auth to be unset/set again with the same session.
* Cleanup in the NV API's for unsetting of the auth to be handled by caller, not in API.
2023-09-15 14:03:11 -07:00
David Garske 31cd20e645 Added new policy_nv example. 2023-09-11 14:37:12 -07:00
David Garske 027ae8a4e9 Make sure PCR extend has the session auth cleared. Added -nvhandle argument to nvram examples. Cleanups for examples. 2023-09-08 08:14:39 -07:00
David Garske 97d8845c6f Added CI tests for all examples and additional build tests. 2023-08-30 15:11:24 -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 14a331d648 Example for secure boot solution to store root of trust in NV. Provides authentication and tamper protection. Fixed uses of arg= in examples. 2023-08-07 11:08:02 -07:00
David Garske 4242f2f6cf Fixes for building without ASN. Fix for ECC disabled with `WOLFSSL_PUBLIC_MP` set. 2023-05-02 17:27:48 -07:00
David Garske 0ceeebeaf7 Fix for building with no PEM to DER. Fix for building with static library and no debug, due to missing stdio in examples. Fix for TLS examples missing WOLFCRYPT_ONLY check. Fix for building with WC_NO_RNG. Fix for RSA salt with RNG using crypto cb. 2023-05-02 16:18:21 -07:00
John Bland 7a14f45355 update policy sealing code and documentation based on pr comments 2023-04-18 13:05:42 -04:00
John Bland 6678ea7c4b add external nvram policy sealing example, fix wolfTPM2_SealWithAuthSigNV
wolfTPM2_SealWithAuthSigNV needs to have PolicyPCR called as a part of its logic since it uses wolfTPM2_SetAuthPassword, which interferes with the policy digest
2023-04-17 18:29:18 -04:00
John Bland b4a8ba698e
Sealing secrets with PolicyPCR and PolicyAuthorize (#261)
* Support for PCR with policy. Issue #109

* Progress on PCR policy. Work from John Bland.

* add wrapper functions to seal secrets the NVM with policy authorization

fix the seal and unseal with policy functions to work with non trial policies

update policy examples to allow multiple pcr indicies to be used, currently only 2 can be used because TPML_PCR_SELECTION only allows 2 pcr sellections, may need to be refactored but I didn't want to blow that part of the codebase up

* fix TPM2_SetupPCRSel to correctly use hash type banks

* update policy functions and examples based on pr comments

fixed rsa keys not working due to null default signing algorithm, seal_policy_auth can now be called with no arguments and will pick defaults

* update policy examples based on pcr comments

added error codes and htons macro for use when wolfcrypt is not available

* added policySigned logic to policy seal with nv functions

currently the policy seal with auth nv example is broken due to strange session issues

* Improvements to the session authentication for policy sessions.

* update the sealNV functions, add PolicyRestart and manual htnos

wolfTPM2_SealWithAuthSigNV allows for sealing secrets to NV with just the public part of the sealing key and a pre signed signature so that the private part of the key can be kept off the system. PolicyRestart was added to make reseting the policyDigest easy and a manual htnos function was added for use in wolfBoot

* update policy code based on pr comments

* reconfigure wolfTPM after setting up ibm simulator

* define XREWIND in wolfTPM since it is no longer in wolfssl

* fix scan-build warnings

* remove RSA_SIG_SZ

* use signed char in HexCharToByte for strict build options

* update based on pr comments

---------

Co-authored-by: David Garske <david@wolfssl.com>
2023-04-13 11:24:37 -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
David Garske 41e5750ff2 Peer review fixes. Cleanups for return code checking, stdlib functions, unknown args and coding standards. 2022-10-04 13:19:51 -07:00
David Garske fac51233c3 Added example for NV counter increment. Fixes for NV auth handling. 2022-10-04 13:09:05 -07:00
David Garske d491437e08 Use `strcmp` since `argv` is guaranteed to be NULL terminated. Fix keygen example whitespace alignment. 2022-10-04 11:44:16 -07:00
David Garske 3f84b2efbc wolfTPM v2.5.0 release prep 2022-07-22 09:32:57 -07:00
David Garske d035cd239c Fix for a few spelling errors. Whitespace cleanup. 2021-12-07 11:10:50 -08:00
Elms ede184c735 configure: keep example directory strcuture during install 2021-11-18 12:04:41 -08:00
Elms 7f717f506b configure: make all examples not installed (eg `noinst`) 2021-11-18 11:04:03 -08:00
David Garske 2f63aadf02 Revert include.am changes. Use macro magic to include the .c file from tpm_io.c for backwards compatibility and ease for new platforms with automake. 2021-06-07 10:20:51 -07:00
Dimitar Tomov a43797ca9c Update all include.am example files
Signed-off-by: Dimitar Tomov <dimi@wolfssl.com>
2021-06-07 14:32:47 +03:00
David Garske 4e351b16a9 Add support for `--with-wolfcrypt=/dir/`. Fix for build error with `--disable-wolfcrypt`. Fix for unused `auth` in store example. ZD 12204 2021-05-13 09:49:08 -07: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
David Garske 197754b109 Minor cleanups. 2021-03-12 15:10:58 -08:00
Dimitar Tomov f0540d688e Make NVRAM and Keygen examples store the encoded public key part to save space
Before examples were always storing the maximum public key part size,
using sizeof(TPM2B_PUBLIC), with many empty fields. This meant, always
storing 616 bytes of public part, even if the public key part was less.

* writekeyBlob/readKeyBlob use the actual size of public key part
* NVRAM store/read use the actual size of the public key part
* Minor fixes from peer review
* Added comment to nvram/store about Host Endianness, per peer review
* Added public API for appending/parsing TPM2B_PUBLIC to byte streams

Signed-off-by: Dimitar Tomov <dimi@wolfssl.com>
2021-03-12 15:10:58 -08:00
Dimitar Tomov 56db5fe67c Make examples/nvram capable of using only the private/public key part
Signed-off-by: Dimitar Tomov <dimi@wolfssl.com>
2021-03-12 15:10:58 -08:00
Dimitar Tomov db64d9fc29 examples/read: Load the key after it was extracted from NVRAM
Signed-off-by: Dimitar Tomov <dimi@wolfssl.com>
2021-03-12 15:10:58 -08:00
Dimitar Tomov e1d9c661bd Minor fixes for NVRAM examples
Signed-off-by: Dimitar Tomov <dimi@wolfssl.com>
2021-03-01 10:52:02 +02:00
Dimitar Tomov df13479ac7 Added new examples for storing TPM keys in NVRAM, with parameter encryption
* Added examples/nvram/store for storing TPM key in NVRAM
* Added examples/nvram/read for extracting keys from the TPM's NVRAM

Signed-off-by: Dimitar Tomov <dimi@wolfssl.com>
2021-02-26 11:15:54 +02:00