Commit Graph

409 Commits (9cad7f4e240fe1a55d64ec5baeefd5442c6d54db)

Author SHA1 Message Date
David Garske 9cad7f4e24 Fix some of the example TODO's. Fixes for seal/unseal example. Fixes for TLS with param enc. Fix signed_timestamp with ECC. 2023-10-30 12:00:37 -07:00
David Garske 2d14cd2297 Fixes for building wolfCrypt with no RSA (--disable-rsa / NO_RSA). 2023-10-23 14:05:10 -07:00
David Garske 1041898120 Compiler warning files with `NO_FILESYSTEM`. 2023-10-23 14:04:44 -07:00
David Garske 7a11cb2213 Fix support for ECC 384-bit only support. Tested with: `./configure --enable-wolftpm CFLAGS="-DECC_USER_CURVES -DNO_ECC256 -DHAVE_ECC384" --disable-examples --disable-crypttests && make` 2023-10-20 15:08:45 -07: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 0c7254d7c0 Fixes for building with C++. 2023-10-11 15:56:04 -07:00
David Garske 49699b08fb Fix for building without public MP. 2023-09-22 11:07:55 -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 23a5d2595b Fixes for small stack. 2023-08-31 13:37:22 -07:00
David Garske 8e1dce2c76 Take run_examples.sh out of make check and run manually in CI test to avoid parallel builds. 2023-08-31 13:04:33 -07:00
David Garske 8968d89f90 More CI fixes. 2023-08-31 12:29:13 -07:00
David Garske e2d502e773 Peer review fixes and getting CI to pass. 2023-08-31 09:53: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 78cd7190be Cleanups from testing. 2023-08-30 11:21:43 -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 d508180ee3 Fix custom -nvIndex= argument. 2023-08-16 08:08:10 -07:00
David Garske 5b6c7c0368 Improvements to the secure_rot example. Add support for manually placing hash. 2023-08-15 14:41:09 -07:00
David Garske 649c257093 Improve SRK ECC support detection / handling. 2023-08-15 10:51:53 -07:00
David Garske 6126d04be3 Support for importing and loading public ECC/RSA keys formatted as PEM or DER. 2023-08-15 08:27:00 -07:00
David Garske 3f29c59e87 Add support for encrypting secret using ECC key. Allows using ECC for parameter encryption and importing ECC keys with custom seed. Requires https://github.com/wolfSSL/wolfssl/pull/6683 2023-08-08 16:15:18 -07:00
David Garske bb18c4c550 Added `wolfTPM2_ChangePlatformAuth` wrapper to help set the platform auth. This is useful from the bootloader to make sure no one can use the platform hierarchy from application. 2023-08-07 11:08:02 -07:00
David Garske 5a20647313 Minor cleanups. Update wolfSSL test certs. Added TPM_TIS_MAX_WAIT. Fix build with WOLFTPM_DEBUG_VERBOSE only. 2023-08-07 11:08:02 -07:00
David Garske c35b532724 Add support for NV lock. 2023-08-07 11:08:02 -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 bb1ec4acc9 Add code to test external import between two TPM's. 2023-08-01 13:12:44 -07:00
David Garske e646c5701e Peer review fixes. Avoid using a struct for the seed. 2023-07-20 12:28:39 -07:00
David Garske 7fcbcab634 Fixes for edge case builds !HAVE_ECC or NO_RSA. 2023-07-20 09:29:45 -07:00
David Garske ae6bac26c5 Added documentation and tests. 2023-07-19 13:28:50 -07:00
John Bland d1cd4eff52 use correct session index for wrap test so parameter encryption works 2023-05-03 19:29:45 -04:00
David Garske 382ff91eb3 Support for disabling ASN.1 (--disable-asn) and still provide parameter encryption support. 2023-05-02 18:11:15 -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 219038639a
Merge pull request #266 from jpbland1/evict-control-example-fix
fix broken evict control example
2023-04-13 08:26:13 -07:00
John Bland c8fd9c6359 fix broken evict control example
evict control had an issue where the default noauth session was being used
alongisde the encrypted section. to fix this wolfTPM2_SetAuthSession needs
to be called with index 0 to override the default session, it's possible we've
made this mistake in many places
2023-04-13 01:13:04 -04:00
David Garske af0668eafd Fix for building with wolfTPM without wolfCrypt `--disable-wolfcrypt`. Added test. 2023-04-12 15:07:46 -07:00
David Garske f2a95f3902 Fix for Microchip Harmony build settings. Rename to `WOLFTPM_MICROCHIP_HARMONY`. Avoids confusion with the TPM 2.0 module ATTPM from Microchip. Now enabled with `WOLFTPM_MICROCHIP` and provides backwards compatibility for `WOLFTPM_MCHP`. The new `WOLFTPM_MICROCHIP` has not been released (was added in PR #251). 2023-02-03 10:49:29 -08:00
David Garske 10ad0399c3 Support for TPM benchmarking with Microchip MPLABX (`WOLFTPM_MICROCHIP`) ZD 15350 2023-02-02 10:56:19 -08:00
John Bland ae280a7e71
fix casting and unused variable problems on windows (#255) 2023-01-27 14:34:02 -08:00
John Bland 3a1ece8da1
Add RSA key import methods to handle PEM and DER encoding directly (#252) 2023-01-27 14:17:19 -08: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 c038cede44 Minor build fixes. 2023-01-18 12:38:04 -08:00
David Garske 7d1a3a31b5 Add support for Microchip Harmony MPLAB X SPI driver in wolfTPM. 2023-01-18 12:38:04 -08:00
David Garske 25dd0d46c0 Fix for using type not available with wolfCrypt only. 2023-01-12 16:59:25 -08:00
David Garske e22fd122d9 Support for Infineon TriCore (TC2XX/TC3XX) using macro `WOLFTPM_INFINEON_TRICORE`. 2022-12-21 16:21:15 -08:00