Commit Graph

171 Commits (9d7f3fd79d45fd7d398791f3ac8995eeae73ce87)

Author SHA1 Message Date
David Garske 1bacbd8343 Fixes to resolve loading an external AES key to TPM. 2019-02-01 16:22:55 -08:00
David Garske 697b655efe Fixes for TPM ECC verify using different hash algorithms and key sizes. 2019-02-01 13:27:52 -08:00
David Garske a5d286c737 Fixes for various compiler warnings. Fixes for supporting new CryptoCb. Added way to implement own socket functions for TLS examples. Added TLS error codes. 2019-02-01 13:27:52 -08:00
David Garske e057bc0a35 Cleanup to ensure `TpmCryptoDevCtx tpmCtx` is memset. Added support for handling new cryptocb update. 2019-02-01 13:27:52 -08:00
David Garske 8085793168 Added wrapper to load symmetric key. Finished code for Crypto callback AES. 2019-02-01 13:27:52 -08:00
David Garske dba2df99f2 Added Crypto callback support for AES, Hash and RNG. Minor compiler warning fixes. 2019-02-01 13:27:15 -08:00
David Garske 3433f0a045 Adds TIS locking protection when `WOLFTPM_TIS_LOCK` is defined. Uses a named semaphore to protect concurrent access to TPM device from multiple processes. This allows the wolfTPM example TLS client/server to be used against each other. 2019-02-01 13:26:55 -08:00
David Garske d2aaf9903d Add vendor lookup for MCHP. 2019-01-30 13:59:17 -08:00
David Garske d28e63c72f Added TPM2 wrappers for symmetric AES encrypt and decrypt. Moved common test parameters into examples/tpm_test.h. 2018-12-28 12:15:58 -08:00
Eric Blankenhorn b059216b35
Merge pull request #50 from dgarske/ecdh
ECDH enhancements
2018-11-20 13:35:33 -06:00
David Garske 66e845c209 Added new `wolfTPM2_GetCapabilities` wrapper API for getting chip info. 2018-11-20 06:27:23 -08:00
David Garske 037c3a2d59 Added ECDH support for ephemeral key generation and shared secret. Adds new wrapper API's `wolfTPM2_ECDHGenKey` and `wolfTPM2_ECDHGenZ`. Added crypto dev (TLS client/server) support for ECDH using TPM. Added ECDH tests in native and wrapper. Added experimental support for the 2-phase ephemeral key support with new wrapper API's `wolfTPM2_ECDHEGenKey` and `wolfTPM2_ECDHEGenZ`. 2018-11-16 13:27:22 -08:00
David Garske bcbbf8ed39 Prep for wolfTPM v1.4 release. Fixes for scan-build and valgrind reports. Updates to README.md. 2018-11-16 13:01:08 -08:00
David Garske f36cd4e349 Fixes for TLS server and client using RSA and ECC. Fixes for ECC sign cryptodev callback. Added an optional crypto dev callback for checking the key to determine if "fake" key is used. Added ability to use ECC permenant key for TLS examples using `USE_TLS_ECC`. 2018-11-14 09:51:06 -08:00
David Garske 6ce63ee671 Support for loading an external private key using new API's `wolfTPM2_LoadPrivateKey`, `wolfTPM2_LoadRsaPrivateKey`, and `wolfTPM2_LoadEccPrivateKey`. Cleanup of the packet code to handle determining of size (mark/place). Added support for computing object name `wolfTPM2_ComputeName`. Added support for converting sensitve to private `wolfTPM2_SensitiveToPrivate`. Tested on SLB9670 and ST33. 2018-11-12 11:12:52 -08:00
David Garske 2ea3811e96 Refactor to eliminate the packed TPM2_HEADER. Adds better portability for source code. 2018-11-06 09:04:39 -08:00
David Garske 6ffbe6c5bc Fix to detect improper packing for TPM2_HEADER. Fix for compiler warning about XSTRLEN type conversion warning in wrapper hash test. Made the pack macros overridable. 2018-10-17 08:27:11 -07:00
David Garske 032d356bb6 Added wrapper API's and tests for performing hash. New API's are: `wolfTPM2_HashStart`, `wolfTPM2_HashUpdate` and `wolfTPM2_HashFinish`. 2018-10-05 13:11:15 -07:00
David Garske 95a978c37b Added new RNG wrapper API `wolfTPM2_GetRandom`. Added macro for hardware RNG max request as `MAX_RNG_REQ_SIZE`. Trailing whitespace cleanup. 2018-09-20 12:15:03 -07:00
David Garske 18e7412681 Fix for handling the `WC_NO_RNG` case. Fix no case with `implicit declaration of function ‘close’`. 2018-09-14 09:32:14 -07:00
David Garske 0cfe8dd789 Decoupled the fixed algorithms sizes and build options from wolfCrypt. Now wolfCrypt can be built with algos like SHA256 and AES disabled, but they can still be supported in wolfTPM. Updated the README.md with a few additional build details. 2018-09-13 18:41:03 -07:00
David Garske 0810e9a6b2 Eliminated the private section from WOLFTPM2_KEY struct. 2018-08-29 10:12:28 -07:00
David Garske ba48628948 Improved error handling for the case where `TPM2_EncryptDecrypt2` is not supported. Added wrapper to help with creation of symmetric keys `wolfTPM2_GetKeyTemplate_Symmetric`. 2018-08-28 09:09:10 -07:00
David Garske 91c4feff2b Completed adding support for symetric AES encrypt/decrypt support. Works on ST33 only. The command is off by default. ST provided details for enabling this command using a vendor sepecific command. 2018-08-27 14:09:34 -07:00
David Garske 765d825dee Improvements to the Native tests. Adding support for `TPM2_EncryptDecrypt2` in native test. Appears to be an unsupported command on the SLB 9670. AES Key creation does work. 2018-08-27 14:09:34 -07:00
David Garske 6fe075911a * Added advanced IO callback support (enabled using `--enable-advio` or `#define WOLFTPM_ADV_IO`).
* Added ST33 TPM 2.0 support (`--enable-st33` or `#define WOLFTPM_ST33`). Only SPI version is tested and verified.
* Experimental TIS I2C support (`--enable-i2c` or `#define WOLFTPM_I2C`).
* Cleanup of the IO callback examples.
* Added support for Atmel ASF SPI.
2018-08-22 16:40:33 -07:00
David Garske 5ce7e00d05 Fix for packing `TPM2_HEADER` structure in IAR EWARM. 2018-08-21 19:58:19 -07:00
David Garske e5929bae0a TIS cleanup to improve return code and timeout handling. Added overridable define `WOLFTPM_LOCALITY_DEFAULT` for the locality used. Added `XTPM_WAIT()` macro to enable custom wait between polling. Increased the default `TPM_TIMEOUT_TRIES` to give enough time on Pi to do a key gen. Removed unused SET, CLEAR, TRUE, FALSE macros. 2018-08-16 15:54:12 -07:00
David Garske c5a4c06dd1 Fixes for building with different wolfCrypt options. Fix for byte swap build error. 2018-08-15 11:53:14 -07:00
David Garske d8174d4ef7 Added build option to disable wolfCrypt dependency using `./configure --disable-wolfcrypt` or `#define WOLFTPM2_NO_WOLFCRYPT`. Moved types and configuration/port specific items into new `tpm2_types.h`. Removed execute bit on serveral files. 2018-08-12 15:25:35 -07:00
David Garske aa27a2ab65 Updated version to 1.3. Fixed scan-build warning with `wolfTPM2_ReadPCR`. 2018-07-20 11:08:49 -07:00
David Garske 19ef638dc0 Fix for timeout checking. Fixes for OpenSTM32 project example. Started on ST33 support. Updated README.md and release note for v1.3 prep. 2018-07-19 15:45:49 -07:00
David Garske d489452d53 Updates to TPM based TLS Client example. Added CSR generation of an ECC Certificate. Added scripts to help with making certificates from the CSR. TLS still has some outstanding work for ECDHE. 2018-07-18 16:28:50 -07:00
David Garske f1e82ac0e4 Added PKCS7, CSR and TLS Client examples using the TPM. Added builtin wrapper support for `WOLF_CRYPT_DEV`, which enables wolfCrypt PK type callbacks for RSA and ECC. Moved some of the example configuration into `./examples/tpm_io.h`. TLS Client example is not complete. 2018-07-18 16:28:50 -07:00
David Garske f09de6b6ac Fixes a few minor warnings in the library. Pulling these in separately from PR #18. 2018-06-11 11:26:29 -07:00
David Garske c5586be75c Added helper functions for converting RSA/ECC keys between wolf and TPM format. This only populates the public portion of the key. Fix to enable way to get public NV information. Increase default size for `WOLFTPM2_BUFFER`. Added wrapper example/tests for the new wolf helpers. 2018-06-01 16:26:39 -07:00
David Garske dfe634be13 Fix to handle `CFLAGS`. Added generation of configuration options in `wolftpm/options.h`. Cleanup of the `configure.ac`. 2018-05-23 13:32:09 -07:00
David Garske 2d274f08b7 Fix logic error with `--enable-wrapper`. Fix for RSA encrypt/decrypt with no (NULL) padding scheme. Added RSA wrapper test for no padding. Added wrapper function to get a devId based on did_vid. Added wrapper TPM device pointer to handle. 2018-05-18 10:07:26 -07:00
David Garske 9f574a89fb Minor cleanups. Added way to get TPM's WC_RNG. 2018-05-17 16:21:10 -07:00
David Garske cecf33ae03 Added support for getting the builtin Endorsement Keys. 2018-05-14 16:36:14 -07:00
David Garske 98ee7be29c Added new API wrappers (`wolfTPM2_LoadRsaPublicKey` and `wolfTPM2_LoadEccPublicKey`) for loading RSA and ECC public keys. 2018-05-03 14:45:29 -07:00
David Garske 51655bf7c2 Added TPM wrapper support for NV create, write, read and delete. 2018-05-02 11:47:02 -07:00
David Garske cf2305b994 Fixes for evict control. Added new API `wolfTPM2_Clear` to clear (fully reset) TPM. 2018-05-01 17:16:05 -07:00
David Garske db49e917ac Split the native and wrapper test code into separate applications. Moved some of the utility wrapper functions into native area to support `WOLFTPM2_NO_WRAPPER`. Fix for storageKey auth in case when it used from NV. 2018-05-01 15:59:54 -07:00
David Garske c81fb24cd6 Added evict control support for saving and deleting keys to NV. 2018-05-01 14:42:14 -07:00
David Garske a2785ac000 wolfTPM Release v1.1 2018-03-09 15:38:16 -08:00
David Garske 9cae3e68e7 Fix for g++ build to avoid use of `public` and `private`. 2018-03-09 14:12:17 -08:00
David Garske 2a98635a2f Fixes for the TPM wrapper for VerifyHash. 2018-03-09 10:52:30 -08:00
David Garske e58c950a70 Completed new TPM2 wrappers and example code. New functions: `wolfTPM2_LoadPublicKey`, `wolfTPM2_ReadPublicKey`, `wolfTPM2_VerifyHash`, `wolfTPM2_ECDHGen`, `wolfTPM2_RsaEncrypt`, `wolfTPM2_RsaDecrypt`, `wolfTPM2_GetCurveSize`. 2018-03-08 17:07:52 -08:00
David Garske c681164cef Added WOLFTPM2_DEV context. New init/cleanup for wrappers. Added `wolfTPM2_SignHash` function. 2018-03-03 19:49:09 -05:00
David Garske 1426f76e4c New WOLFTPM2 types for handle, session and key. New wrappers for starting session and creating/loading keys. Changed `TPM2_GetNonce` to use current ctx and not use arg. Cleanup of bad arg return code. 2018-03-03 18:49:53 -05:00
David Garske fca0af99a8 Progress with refactor to support parameter encryption/decryption using both session auth and object auth. Cleanup with the response parsing to reduce code / simplify. 2018-03-03 05:03:14 -08:00
David Garske 98181f573a Cleanups based on peer review. Changed the IO callback return type to int. 2018-03-02 09:22:36 +01:00
David Garske 5364c711f0 Fixes after refactor. Further fixes for error code string lookup. 2018-02-28 07:58:27 +01:00
David Garske 6fa51c27a8 Fix for error code reporting. The `RC_VER1`, `RC_FMT1` and `RC_WARN` values are a bit-mask to indicate group. Only the LSB 8-bits indicate error code. 2018-02-28 00:24:25 +01:00
David Garske 85cd1a5b68 Initial progress on supporting encrypt/decrypt for TPM commands. Moved the software RNG support into TPM code. Added new `TPM2_Cleanup` function for making sure resources are free'd and global ctx released. 2018-02-27 23:49:07 +01:00
David Garske fa0d94fbb3 Refactor TIS and Packet code into separate files. Updates to README.md. Increased the Raspberry Pi SPI clock to 33Mhz. 2018-02-27 23:45:41 +01:00
David Garske 5cd7d3cc50 Progress with getting NV working. 2018-02-26 23:53:42 +01:00
David Garske c2d23f927e Fixes for parsing/appending `TPMT_SIGNATURE`. Added tests for `TPM2_ECDH_KeyGen`, `TPM2_ECC_Parameters`, `TPM2_VerifySignature` and `TPM2_NV_UndefineSpace`. 2018-02-26 01:28:40 +01:00
David Garske 99afd8f0d5 Added way to set the auth resp using `TPM2_SetSessionAuth`. 2018-02-24 21:25:31 -08:00
David Garske 69eea6f034 Fixes for TPM2 commands expecting TPM_ST_SESSIONS. Added tests for TPM2_ReadPublic, TPM2_MakeCredential, TPM2_PolicyCommandCode, TPM2_ObjectChangeAuth. 2018-02-24 21:18:49 -08:00
David Garske 2d8e3b3eb7 Added TPM2_StirRandom, TPM2_PolicyRestart, TPM2_LoadExternal and TPM2_EvictControl. Fix for CC value typo. Updates to README.md. 2018-02-24 19:30:18 -08:00
David Garske 986fd398b7 Progress with creating keys. Able to create storage (platform) and endorsement primary keys. Still working on creating ECC key. 2018-02-23 12:18:43 -08:00
David Garske 6c901be08a Progress with creating an ECC key. 2018-02-19 16:35:03 -08:00
David Garske f4cd4028d5 Fixes for session auth information and getting CreatePrimary working. 2018-02-16 12:22:34 -08:00
David Garske e02518dc3e Added `TPM2_CreatePrimary` test. 2018-02-15 15:45:15 -08:00
David Garske 78876923cc Adds wrapper code. Adds tests for `TPM2_PolicyPCR` and `TPM2_FlushContext`. 2018-02-15 10:20:19 -08:00
David Garske 43b0682dd8 Fixes for proper handling of `TPMT_SYM_DEF` or `TPMT_SYM_DEF_OBJECT` when `TPM_ALG_NULL` (don't append keyBits and mode). Refactor of the param details and scheme. Refactor of the session information into TPM context. 2018-02-14 14:11:01 -08:00
David Garske 156fc9b521 Added Linux SPI stdio support for running on Rasberry Pi. Cleanups for wolfTPM. 2018-02-08 12:21:39 -08:00
David Garske 35a585828b Updates to the IDE example for STM32. 2018-02-07 15:28:31 -08:00
David Garske 8bf8ae340f wolfTPM v1.0 TPM 2.0 support:
* Support for all TPM2 API's using TIS and SPI IO callback.
* Helper for getting TPM return code string `TPM2_GetRCString`.
* TPM 2.0 demo code in `examples/tpm/tpm2_demo.c` with support for STM32 CubeMX SPI as reference.

Requires wolfSSL (https://github.com/wolfSSL/wolfssl/pull/1344)
2018-02-06 16:27:50 -08:00