Commit Graph

97 Commits (892726e6b5bb87430bea56377cb7b39d935537de)

Author SHA1 Message Date
David Garske 5f0c7ba6c1 Fix printf type warnings. Added missing stdio.h for printf in examples. Added new API's `TPM2_SetActiveCtx`, `TPM2_ChipStartup`, `TPM2_SetHalIoCb` and `TPM2_Init_ex`. Fix to make sure TPM2_CTX is cleaned up after `wolfTPM2_Test`. Allowed way to indicate `BOOL` type already defined. 2019-05-07 14:35:23 -07:00
David Garske 01f5dc856c Added new API `wolfTPM2_Test` for testing for TPM and optionally returning capabilties. This API is useful for providing a "single shot" call without context to init and test the TPM module. 2019-05-06 13:54:44 -07:00
David Garske d8effc7c05 Fixes for various scan-build and G++ warnings. Updates to ChangeLog.md and README.md. Fix for `./certs/certreq.sh clean` to not remove wolf certs. 2019-02-20 15:13:01 -08:00
David Garske f1353cbbaf Fixes for STM32 CubeMX SPI example. Fix for issue with wrapper test AES key not being memset. 2019-02-07 15:25:58 -08:00
David Garske c23ca467aa Fix bug with AES wrapper test and IV. 2019-02-07 10:57:58 -08:00
David Garske 7706f9a652 Fix for AES IV output to support blocks over 1024 bytes. Added more AES tests. 2019-02-07 10:12:47 -08:00
David Garske 586219164c Fixes for TPM HMAC with CryptoCb. 2019-02-05 17:47:58 -08:00
David Garske 302b3653c7 Working HMAC wrappers/tests. 2019-02-04 11:48:52 -08:00
David Garske 1a27e9676a Added HMAC wrapper support. Added HMAC crypto callback support. 2019-02-03 17:18:58 -08:00
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 70b354677e Implemented workaround for TPM2_EncryptDecrypt. Improved ATTPM20 workarounds for backwards compatibility. Added README.md notes for ATTPM20. 2019-02-01 11:01:40 -08:00
David Garske 6090e4bff6 Implemented workarounds for known ATTPM20 issues. Changes the default algo for PCR read to SHA1. Clear the sign obj attrib on symmetric key creation template (both sign and decrypt cannot be set at same time). 2019-02-01 10:28:11 -08:00
David Garske b44cbbdfac Added wrapper test / example for using the `wolfTPM2_NVDeleteKey` API. 2019-01-22 13:42:13 -08:00
David Garske e38413fa03 Improved EncryptDecrypt wrapper to allow larger block for better performance. Fixes for AES/Hashing benchmarks.
Results on ST33TP SPI at 1MHz:

```
RNG                  8 KB took 1.124 seconds,    7.117 KB/s
AES-128-CBC-enc     88 KB took 1.023 seconds,   86.014 KB/s
AES-128-CBC-dec     88 KB took 1.020 seconds,   86.234 KB/s
AES-256-CBC-enc     90 KB took 1.023 seconds,   88.008 KB/s
AES-256-CBC-dec     90 KB took 1.022 seconds,   88.037 KB/s
AES-128-CTR-enc     82 KB took 1.021 seconds,   80.350 KB/s
AES-128-CTR-dec     78 KB took 1.004 seconds,   77.682 KB/s
AES-256-CTR-enc     78 KB took 1.012 seconds,   77.110 KB/s
AES-256-CTR-dec     78 KB took 1.014 seconds,   76.915 KB/s
AES-128-CFB-enc     84 KB took 1.012 seconds,   82.983 KB/s
AES-128-CFB-dec     84 KB took 1.019 seconds,   82.407 KB/s
AES-256-CFB-enc     84 KB took 1.021 seconds,   82.312 KB/s
AES-256-CFB-dec     84 KB took 1.020 seconds,   82.357 KB/s
SHA1                22 KB took 1.000 seconds,   21.995 KB/s
SHA256              22 KB took 1.046 seconds,   21.043 KB/s
RSA     2048 key gen        1 ops took 10.927 sec, avg 10926.749 ms, 0.092 ops/sec
RSA     2048 Public        63 ops took 1.002 sec, avg 15.903 ms, 62.880 ops/sec
RSA     2048 Private        4 ops took 1.020 sec, avg 255.000 ms, 3.922 ops/sec
RSA     2048 Pub  OAEP     62 ops took 1.013 sec, avg 16.345 ms, 61.182 ops/sec
RSA     2048 Priv OAEP      4 ops took 1.027 sec, avg 256.824 ms, 3.894 ops/sec
ECC      256 key gen        5 ops took 1.156 sec, avg 231.156 ms, 4.326 ops/sec
ECDSA    256 sign          23 ops took 1.027 sec, avg 44.660 ms, 22.391 ops/sec
ECDSA    256 verify        14 ops took 1.069 sec, avg 76.354 ms, 13.097 ops/sec
ECDHE    256 agree          5 ops took 1.244 sec, avg 248.865 ms, 4.018 ops/sec
```
2018-12-28 16:00:13 -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 371f2780c0 Fixes for release testing (#48)
* Fixes for release testing. Fixes for building with `--disable-wolfcrypt` or `--disable-wrapper`. Fix for possible use of NULL parentKey in new private key functions.

* Fix for building with just `--enable-i2c`. Its currently supported/tested only with `ST33HTPH I2C` via `--enable-st33 --enable-i2c`.
2018-11-13 17:20:08 -06:00
David Garske 6f0282430e Fix for issue with public key object attributes. Fix for `TPM2_TIS_SendCommand` rspSz error detection case. Added some additional RSA and ECC key loading examples. General wrapper test cleanup to move some test data into `tpm_test.h`. 2018-11-12 15:55:51 -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 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 7a33302537 Fix for detecting the correct hash algorithm in `wolfTPM2_VerifyHash`. The ST33 part requires SHA1 alg for the new wrap verify only test. 2018-10-01 13:55:03 -07:00
David Garske 5d2c080e15 Fix for loading public ECC key to make sure it can perform an ECC verify. Fix for cryptodev ECC callback to use R and S for the signature verify. Added ECC verify using public key and NIST test vectors. 2018-09-28 11:21:29 -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 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 9efe01d0fc Fix for ST33 ECC public key import. 2018-08-27 11:01:50 -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 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 cc6a28d026 Added ability to clear/reset TPM using wrapper example with arg such as './examples/wrap/wrap_test 1`. 2018-07-19 08:20:38 -07:00
David Garske 6ae32daa52 Fix TLS client example to properly shutdown before closing socket. Added additional logging and fixed comment about certreq.sh script. Improved the cert signing script to not prompt. Also supports option `./certs/certreq.sh clean` to do a clean sign. Added way to do a TPM clean/reset using `TPM2_Wrapper_SetReset`. 2018-07-18 16:29:15 -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 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 3e462b0172 Added TPM bechmarking support. 2018-05-25 11:59:55 -07:00
David Garske bf725524de Removed the execute bit on new files. 2018-05-21 23:07:26 +00: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