Commit Graph

627 Commits (fc511714d37e8052a089e602ddaaf6b8c4af5ce7)

Author SHA1 Message Date
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
David Garske 8b5c5fe897 Peer review feedback. Cleanups for code comments, logging and white-space. 2024-09-11 12:12:15 -07:00
David Garske 460e6003c9 Added tests for policy seal/unseal with multiple PCR's. 2024-09-10 11:53:13 -07:00
David Garske 03070dabd7 Improve the TPM TLS examples for use with `WOLFTPM_MFG_IDENTITY`. Tested with ST33KTPM2X SEMI-CUSTOM DEVICE ID. 2024-09-09 10:35:22 -07:00
David Garske 1603cfdaaf More fixes for no filesystem. 2024-08-30 09:58:04 -07:00
David Garske 2a5e74113b Fix and test for no filesystem. 2024-08-30 08:02:39 -07: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 070232104e Fixes for keygen with `-sym=`. 2024-08-21 11:55:17 -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 6951b8d307 Fix for /dev/tpm0 file descriptor check (fixes #365). Added documentation for /dev/tpm0 permissions (fixes #358). Various spelling and documentation cleanups. 2024-07-31 11:21:53 -07:00
David Garske a441646682 Fixes for wolfTPM documentation generation. 2024-07-30 14:52:34 -07:00
David Garske 95ae2f7459 wolfTPM v3.4.0 release.
* Fixes for building without wolfCrypt or heap.
* Fix for building wolfTPM DLL (was missing tbs.lib).
* Fix for `wolfTPM2_New` to provide default TPM2 HAL IO callback.
2024-07-30 09:09:24 -07:00
David Garske 65d0e6aa76 Documentation and minor fixes. Tested with older SLB9670 and ST33TPH. 2024-07-26 14:38:29 -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
Eric Blankenhorn 61abbc1073
Merge pull request #350 from dgarske/policyauth
Improvements in auth handling to support Policy Password and Policy Auth Value
2024-05-24 09:37:37 -05:00
gojimmypi fb19d7a0e1 Initial Infineon I2C TPM support for Espressif ESP32 2024-05-10 14:16:39 -07:00
David Garske 81c837189c Refactor to eliminate confusing cast between TPMS_AUTH_COMMAND and TPM2_AUTH_SESSION. 2024-05-08 15:58:59 -07:00
David Garske a839e8166a Add missing tests for create_primary. 2024-04-25 14:15:13 -07:00
David Garske c98ee9a71e Update copyright date. 2024-04-24 10:42:27 -07:00
David Garske 4157ed5689 Release v3.2.0 prep. 2024-04-24 10:42:25 -07:00
JacobBarthelmeh eede95dcd3
Merge pull request #342 from dgarske/infineon_fw_recovery
Add Infineon firmware update recovery support
2024-04-22 11:00:12 -06:00
David Garske 4a2e2506a4 Add Infineon firmware update recovery support. 2024-04-18 11:02:34 -07:00
Zackery Backman b16a2b133c OPenSSL Coexist 2024-04-05 13:37:06 -06:00
David Garske d9152872d3 Peer review cleanups. 2024-04-02 08:29:04 -07:00
David Garske 892726e6b5 Added support for Infineon SLB9672/SLB9673 Firmware upgrade (see examples/firmware/README.md)
Added Infineon Modus Toolbox support. See `wolfssl/IDE/Infineon/README.md` for setup instructions.
Added support for Infineon CyHal I2C support.
Added Firmware extraction tool
Added Firmware update example application `examples/firmware/ifx_fw_update`.
Added support for vendor capabilities `TPM_CAP_VENDOR_PROPERTY`.
Added `XSLEEP_MS` macro for firmware update delay.
Added support for getting key group id, operational mode and update counts.
Added support for abandoning an update.
Added support for firmware update done, but not finalized
Fix auto-detect to not define SLB9672/SLB9673.
2024-04-01 17:21:18 -07:00
philljj 2cde4102b2
Merge pull request #336 from dgarske/st33_getprodinfo
Added ST33 support for pre-provisioned device identity key and certificate
2024-04-01 13:42:47 -05:00
David Garske eed7803e96 Fixes for building wolfTPM examples with NO_FILESYSTEM. Tested with `./configure --enable-swtpm CFLAGS="-DNO_FILESYSTEM" && make`. 2024-03-22 14:24:18 -07:00
David Garske 626beaf4d7 Fixes for native_test with ST33 and `TPM2_GetRandom2`. 2024-03-20 15:23:44 -07:00
David Garske 551d7da51d Add example for using TPM pre-provisioned device identity to TLS client example. 2024-03-20 15:11:58 -07:00
David Garske 0b60fae993 Fix for netdb.h. 2024-03-01 11:51:27 -08:00
Eric Blankenhorn 46ef684106
Merge pull request #328 from dgarske/cap_handles
Added support for getting handles from capabilities
2024-02-09 09:33:08 -06: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
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 e078e15f56 Added new API `wolfTPM2_GetHandles` to get list of handles from the TPM capabilities. ZD 17328 2024-02-06 10:48:16 -08:00
David Garske c34a0c2786 Fixes and improvements for secret sealing/unsealing:
* Do not set userWithAuth by default when creating sealed objects. That flag allows password auth for the sealed object. Without the flag it only allows policy auth.
* Allow setting policy auth with flags.
* Fix secret_unseal to use policy session and valid sealed name.
* Added expected failure test cases for seal/unseal with policy.
* Improve the run_examples.sh script
2024-02-02 14:45:44 -08:00
JacobBarthelmeh 6fcac417ee
Merge pull request #322 from dgarske/pkcs7_ecc
Added PKCS7 ECC support to example
2024-01-18 14:22:24 -08:00
David Garske 0aa01f4f5a Added PKCS7 ECC support to example. Added wrapper function to export TPM public key as DER/ASN.1 or PEM. Fix for crypto callback ECC sign to handle getting keySz for unknown cases (like PKCS7 without privateKey set). 2024-01-17 15:50:30 -08:00
David Garske 6a32ed43ed Fix mixed variable declaration. 2024-01-09 13:19:31 -08:00
David Garske 310fe7cd5a Fix spelling error. Fix CMake build broken since cryptocb refactor in PR #304. Added CI tests for CMake. 2023-12-29 10:36:42 -08:00
David Garske 93a2493dbf Fixes for attestation with endorsement key. Enable the broken endorsement tests. 2023-12-29 09:32:49 -08:00
David Garske 4c753683c2 Fix native test `TPM2_PolicyPCR`. 2023-12-29 09:21:44 -08:00
David Garske 6322c91e53 Remove the `WOLFTPM2_KEYBLOB.name` (deprecated) and is in `handle.name` now. 2023-12-29 09:20:45 -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
Eric Blankenhorn 233bd33240
Merge pull request #315 from dgarske/keyblob_tests
Added tests for keyblob buffer export/import and support for getting sizes
2023-12-08 15:10:04 -06:00
David Garske a50e4fee6c Add tests for the TLS PK with TPM. 2023-12-08 11:44:00 -08:00
David Garske 65e03e15e6 Added Windows Visual Studio project for wolfTPM. 2023-12-06 15:10:44 -08: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 53acf0bcbf Use localhost 127.0.0.1 for CSR. Add TLS server option `-self` to use the self signed certs. 2023-12-01 14:37:34 -08:00
David Garske 137a348c14 TLS PK callback RSA PSS Padding cleanups. TLS server/client cleanups. Added server `-i` option to keep running unless failure. 2023-12-01 14:12:57 -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 50137547ed Fix for policy_sign issue when r or s is less than key size (needs zero padding). 2023-11-29 13:10:04 -08:00
David Garske 18531274da Fix TLS bidirectional shutdown socket issue. Just use 11111 for all TLS tests, to avoid real random port collision with SWTPM sockets. Resolves TLS issue with "ERROR: failed to bind! errno 98". 2023-11-29 12:34:06 -08:00
David Garske 4b433f24fb Troubleshooting issues with socket `tcp bind failed: Address already in use`. 2023-11-20 15:42:26 -08:00
David Garske 249f9d4942 Fixes for building wolfCrypt without PEM to DER support. 2023-11-15 21:53:50 -08:00
Tesfa Mael df89f497e5 Remove error-ssl.h 2023-11-01 17:17:28 -07:00
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
David Garske 032f10d120 Fix for keyed hash with HMAC. 2022-10-04 13:27:43 -07: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 14a4b00873 Key generation example for Keyed Hash. ZD 14876. 2022-09-28 11:55:05 -05:00
David Garske 94b59d5255 wolfTPM v2.6.0
* Fix CMakeList.txt to fix include order.
* Remove execute bit on code files.
2022-09-01 10:41:42 -07:00
David Garske 3f84b2efbc wolfTPM v2.5.0 release prep 2022-07-22 09:32:57 -07:00
David Garske 9d2483d327 New CSR wrappers to assist with TPM based CSR/Self-Signed-Cert generation including CSharp wrappers. This includes support for subject, key usage, custom request extensions and output as PEM or DER. New structure `WOLFTPM2_CSR`. New API's `wolfTPM2_CSR_*`. New CSharp class `Csr`. 2022-07-12 13:53:04 -07:00
Eric Blankenhorn baae8ee523
Merge pull request #214 from dgarske/slb9672
Infineon SLB9672 support
2022-07-01 11:24:23 -05:00
Eric Blankenhorn de7f1d6d30 Fix keygen example compiler error on possible NULL string in printf 2022-07-01 08:40:07 -05:00
David Garske f0c2f02a20 Peer review cleanups. 2022-06-29 14:40:39 -07:00
David Garske b41a14689f Add create primary key example. Add support for using a unique template with create and create primary. 2022-06-28 16:40:46 -07:00
David Garske a22277a07d Infineon SLB9672 support. 2022-06-28 16:07:30 -07:00
David Garske 9cb60b14ad Improve the inline code comments for loading the public key using the `wolfSSL_CTX_use_PrivateKey_buffer` API. 2022-06-27 10:29:38 -07:00
David Garske c7b28c1445 TPM support for using the public key with TLS. 2022-06-24 16:21:47 -07:00
Elms a787dab931 Fix tests and wrapper example with no wolfcrypt 2022-05-06 21:43:15 -07:00
Elms b4ddd7e736 fix unseal: Unload handles on exit 2022-04-07 17:02:33 -07:00
Elms a37d2387e0 cmake: fix `unseal` warning and add build to ignore 2022-04-07 12:01:13 -07:00
Elms fd1474c68b cmake: Add to readme and fix native test 2022-04-07 10:55:15 -07:00
Elms 084ef170b7 cmake: windows fixes and spell fixes
* Examples working on Windows and SWTPM
 * Check command availability (including for windows blocking it).
 * update unseal to work without persistent NV storage
* cleanup cmake from review
* fix a few spelling mistakes
2022-04-07 10:55:11 -07:00
Elms f2b7bec392 cmake: Initial cmake build
Includes fixes for windows builds using both msys and MSVC
2022-04-07 10:54:52 -07:00
David Garske a2613bcae7 Fix for `TPM2_GetRandom2` to fallback to normal command if not found. Some older STM33 TPM firmware does not support this command. Fix to make sure we don't request more random data than the response can physically handle. 2022-02-04 09:51:09 -08:00
David Garske 4ced78d002 Added test for `TPM2_GetRandom2` 2022-02-04 09:28:03 -08:00
elms 4523d9bce1
Merge pull request #199 from dgarske/spell 2021-12-08 09:22:25 -08:00
David Garske d035cd239c Fix for a few spelling errors. Whitespace cleanup. 2021-12-07 11:10:50 -08:00
David Garske eebd30a4d5 Improve `TPM2_SetupPCRSel` to allow calling multiple times to select additional PCR's. Improved the PCR example code. 2021-12-06 14:48:01 -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
Elms 56a827ae44 Fix `make install` by renaming pcr example `read.c`
example files are installed into the same directory and must have
unique names.
2021-11-18 10:22:15 -08:00
elms 5af1360f3d
Merge pull request #195 from dgarske/rel_v2.3.0 2021-11-09 11:18:21 -08:00
David Garske 4ea2520856 Peer review fixes. 2021-11-09 09:57:43 -08:00
David Garske 0f9e8b5768 wolfTPM Release v2.3.0 2021-11-08 15:49:00 -08:00
David Garske c78d395a5c Refactor GPIO support. 2021-11-08 15:13:03 -08:00
David Garske 85b73ad75f Improve the IO layer try again logic. 2021-11-08 11:59:11 -08:00
David Garske 4adbbc560a Improve the printing of the capabilities vendor firmware number. Spelling fixes. 2021-11-08 11:59:11 -08:00
Elms 91174287b3 RSA_Encrypt: Fix for RSAES padding 2021-09-16 08:42:23 -07:00
Dimitar Tomov 5dfa13ec75 Added PCR Read example
Signed-off-by: Dimitar Tomov <dimi@wolfssl.com>
2021-07-28 14:48:58 +03:00
Elms 02b8834244 test: Allow `CreateLoaded` to pass on unsupported systems
Some hardware may not support these, but allow native and wrap tests to pass with comment
2021-07-26 11:18:33 -07:00
David Garske 54d3fea42b Fix for mismatch memset size. 2021-07-22 11:33:13 -07:00
David Garske ba1339b055 Fix for compiler warning for file read in make_credential.c. Updated attestation example documentation. 2021-07-22 11:09:16 -07:00
Elms 4931ea0e51 Fix unused variables `--disable-wolfcrypt` 2021-07-21 16:30:22 -07:00
David Garske b40574f545 Fix for keyload broken with PR 174. Added GPIO note about no input support for Nuvoton. 2021-07-13 16:06:33 -07:00
David Garske d05e503784 Fix for possible leak of ephemeral key in TLS server example. 2021-07-13 12:57:39 -07:00
David Garske 6abca6dc78 Fix for building with `--disable-wrapper`. 2021-07-13 12:02:25 -07:00
David Garske 6ddcdb0763 Fixes for building with `--disable-wolfcrypt`. 2021-07-13 11:58:17 -07:00
David Garske d17a182c30 Fix scan-build warnings. 2021-07-13 11:53:43 -07:00
David Garske 8455beaae4 Fixes for Public PEM functions. Cleanups. 2021-07-12 17:12:22 -07:00
Dimitar Tomov bc9434aec9 Update examples README files
Signed-off-by: Dimitar Tomov <dimi@wolfssl.com>
2021-07-12 15:09:28 -07:00
Dimitar Tomov 8528a326be Added fixes and unit tests for wolfTPM2_CreateLoadedKey and TPM2_CreateLoaded
* Added new units tests and fixed missing XMEMSET
* Renamed and modified PemToTpm to PubPemToTpm, works only with Pub keys
* Fixes from peer feedback

Signed-off-by: Dimitar Tomov <dimi@wolfssl.com>
2021-07-12 15:09:28 -07:00
Dimitar Tomov 3e217cc497 Made keygen and attestation examples work with EH keys
* Added option in keygen example to create and use keys under the EK
    - Added PolicySecret to provide EK auth

* Fix wrong total auth area size when multiple auth sessions are used
* Workaround policy Session for EK auth
* Added flag in WOLFTPM2_HANDLE to specify when policyAuth is used
* Added three macros to check TPM2.0 Policy session type

* Added option to use keys under Endorsement Hierarchy in attestation examples
    - MakeCredential modified to work without auth as TCG spec defines
    - MakeCredential can now use EK pub to encrypt challenge
    - AcivateCredential can now work with EK pub to decrypt challenge

* Added new wolfTPM2 wrapper for TPM2_CreateLoaded
    - Added missing TPM2_CreateLoaded command in tpm2.c
    - Create and load a key in single TPM 2.0 operation

* Added new wolfTPM2 wrappers to use PEM format in keygen
    - wolfTPM2_RsaKey_TpmToPem
    - wolfTPM2_RsaKey_PemToTpm

* Improved keygen, output in PEM format and saving EK's TPM2B_PUBLIC
    - Added keygen option to output PEM files for TPM public keys
    - Added saving of EK's TPM2B_PUBLIC for attestation purposes

* Modified keygen
    - Uses new wolfTPM2_CreateLoaded wrapper to acquire correct AK name
    - Stores AK name for attestation purposes

* Modified keyload to be able to load keys created under the EK/EH
    - Uses new wrapper
    - Can load keys created under EK/EH, non-AK and AK

* Added new wrapper for satisfying EK policy

* Applied fixes from peer review

Signed-off-by: Dimitar Tomov <dimi@wolfssl.com>
2021-07-12 15:09:28 -07:00
David Garske da5a1adf9c
Merge pull request #172 from tomoveu/add-nuvoton-gpio
Add GPIO example for NPCT7xx
2021-07-12 15:08:31 -07:00
David Garske aa71cfd73d Minor cleanups. 2021-07-12 15:07:45 -07:00
Dimitar Tomov 8946234c48 Added GPIO examples for Nuvoton NPCT75x TPM 2.0 Modules
* Added GPIO configuration logic
* Added more NV attributes per Nuvoton specification
* Fixes from testing on the hardware
* Improvements on tpm2.h definitions
* Fixes after vendor feedback
* Updated the examples README with NPCT75x information and ST33 differences

Signed-off-by: Dimitar Tomov <dimi@wolfssl.com>
2021-07-09 23:48:23 +03:00
David Garske fd6a768a3a Fix typo for Linux macro. 2021-06-07 10:44:14 -07:00
David Garske ead4f66967 Fix for linux dev, tpmsw and winapi. 2021-06-07 10:31:53 -07: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
David Garske eafc20b47c Fix automake issue. 2021-06-07 10:11:10 -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
Dimitar Tomov ab93e61afd Refactor examples/tpm_io into separate platform source files
* tpm_io_atmel.c contains only ASF code
* tpm_io_barebox.c contains only code for Barebox
* tpm_io_st.c to contain only STM32 specific code
* tpm_io_linux.c to contain only Linux specific code
* tpm_io_qnx includes the new QNX callback
* tpm_io_xilinx.c to contain only Xilinx code

- Noted that native Linux /dev/tpmX does not require an IO callback
- TPM Simulator and Windows TBS also does not require an IO callback

Signed-off-by: Dimitar Tomov <dimi@wolfssl.com>
2021-06-07 14:14:37 +03:00
David Garske 1942b3fd05 Move doxy group defs to the same header files and remove `doxygen.h`. 2021-06-02 10:20:00 -07:00
David Garske 2aaf60c068 Fix to make sure CS is de-asserted on failure case. The `spi_close` does not clear the CS. 2021-06-01 12:42:54 -07:00
David Garske ed1ec8c52d Support for QNX with wolfTPM:
* Fix for `wolfTPM2_NVCreateAuth` to return `TPM_RC_NV_DEFINED` if already exists (it used to do this, but broke with GPIO changes).
* Fixes for building wolfTPM with wolfCrypt only (no TLS).
* Fix for building without RSA and ECC.
* Fix for `--enable-smallstack` with parameter encryption,
* Fix for nvram/store unused variable.
2021-06-01 10:34:28 -07:00
Dimitar Tomov 21e6a74d8b Added unit test for TPM2_CertifyCreation
In a real-life use case, signHandle and objectHandle would
point to different objects. For unit testing, signHandle and
objectHandle can be the same object, because wolfTPM performs
the TPM2_CertifyCreation command the same.

Signed-off-by: Dimitar Tomov <dimi@wolfssl.com>
2021-05-31 19:51:32 +03:00
Dimitar Tomov ccde8c0386
Merge pull request #166 from dgarske/wolf-with
Add support for `--with-wolfcrypt=/dir/` and fix minor build error/warn
2021-05-18 19:56:49 +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 d672e36b2f Fix for building GPIO example without ST/auto-detect. Cleanup obsolete `txBuf[4] = 0x00;` replaced with SPI check wait state logic. 2021-05-06 11:52:51 -07:00
David Garske 99851e601e Fix a couple minor spelling errors. 2021-05-03 15:55:43 -07:00
Dimitar Tomov 8a996dff01 Added README for the new remote attestation related examples
Signed-off-by: Dimitar Tomov <dimi@wolfssl.com>
2021-04-29 23:27:27 +03:00
Dimitar Tomov 009a5df963 Added examples to create a remote attestation credential
Signed-off-by: Dimitar Tomov <dimi@wolfssl.com>
2021-04-29 23:26:24 +03:00
Elms 60ed683326 gpio: update program names in `README` and `usage()` 2021-04-21 14:43:58 -07:00
Elms 3d27101d58 make: Rename GPIO example source files to avoid conflict
New GPIO examples `read` conflicts with NVRAM example on `make install`
2021-04-21 14:24:57 -07:00
David Garske 9910e34f52 Fixes from peer review. 2021-04-21 09:20:46 -07:00
Dimitar Tomov 58c8053feb Changes for running seal example without wolfcrypt support
When wolfcrypt is not enabled:
* examples/keygen/keyload failed without error message
* examples/seal/seal did not generate an error message
* examples/seal/unseal was missing conditional compiling
Now, this is fixed.

Signed-off-by: Dimitar Tomov <dimi@wolfssl.com>
2021-04-20 15:33:08 +03:00
Dimitar Tomov 474ddb4d01 Minor changes based on peer feedback
Signed-off-by: Dimitar Tomov <dimi@wolfssl.com>
2021-04-20 15:15:40 +03:00
Dimitar Tomov f1f4de5739 Added nameAlg hash algorithm option for a TPM key seal template
Signed-off-by: Dimitar Tomov <dimi@wolfssl.com>
2021-04-20 15:06:19 +03:00
Dimitar Tomov b6c116e3a1 Updated the examples README with seal and unseal information
Signed-off-by: Dimitar Tomov <dimi@wolfssl.com>
2021-04-16 10:42:16 +03:00
Dimitar Tomov a45a398850 Added option for persistent key to examples/keygen/keyload
Signed-off-by: Dimitar Tomov <dimi@wolfssl.com>
2021-04-16 10:41:01 +03:00
Dimitar Tomov b7600a9348 Added new example for sealing a secret using TPM key
Signed-off-by: Dimitar Tomov <dimi@wolfssl.com>
2021-04-16 10:41:01 +03:00
Dimitar Tomov 35674052bb Added new example to demo TPM 2.0 extra GPIO control
* Create NV Index for GPIO access right after TPM2_GPIO_Config
* Set and read example to use the NV index created by the config example
* Added instructions about the new gpio examples
* Added vendor check, right now only ST33 supports TPM extra GPIO
* NV Index for GPIO Input requires an extra step, included in gpio/config
* Added sanity check and NV Index delete before new GPIO configuration
* Changes based on peer review

Signed-off-by: Dimitar Tomov <dimi@wolfssl.com>
2021-04-08 08:35:14 -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
elms d086eba2c3
Merge pull request #143 from tomoveu/add-sym-keygen 2021-03-15 18:27:49 -07:00
David Garske 8ee41a3c09 Fix minor printf type issue. 2021-03-15 15:11:31 -07:00