Updated CMake to include new examples. Fixed doxygen issue with `wolfTPM2_GetKeyTemplate_EK` -> `curveID`. Fixed issue with possible create key timeout by always adding `XTPM_WAIT` for Linux.

pull/363/head
David Garske 2024-07-30 13:21:45 -07:00
parent 642beec340
commit 62eff27459
3 changed files with 16 additions and 9 deletions

View File

@ -291,17 +291,25 @@ if (WOLFTPM_EXAMPLES)
add_tpm_example(make_credential attestation/make_credential.c) add_tpm_example(make_credential attestation/make_credential.c)
add_tpm_example(bench bench/bench.c) add_tpm_example(bench bench/bench.c)
add_tpm_example(csr csr/csr.c) add_tpm_example(csr csr/csr.c)
add_tpm_example(get_ek_certs endorsement/get_ek_certs.c)
add_tpm_example(ifx_fw_extract firmware/ifx_fw_extract.c)
add_tpm_example(ifx_fw_update firmware/ifx_fw_update.c)
add_tpm_example(gpio_config gpio/gpio_config.c) add_tpm_example(gpio_config gpio/gpio_config.c)
add_tpm_example(gpio_read gpio/gpio_read.c) add_tpm_example(gpio_read gpio/gpio_read.c)
add_tpm_example(gpio_set gpio/gpio_set.c) add_tpm_example(gpio_set gpio/gpio_set.c)
add_tpm_example(create_primary keygen/create_primary.c)
add_tpm_example(external_import keygen/external_import.c)
add_tpm_example(keygen keygen/keygen.c) add_tpm_example(keygen keygen/keygen.c)
add_tpm_example(keyimport keygen/keyimport.c) add_tpm_example(keyimport keygen/keyimport.c)
add_tpm_example(keyload keygen/keyload.c) add_tpm_example(keyload keygen/keyload.c)
add_tpm_example(flush management/flush.c) add_tpm_example(flush management/flush.c)
add_tpm_example(native_test native/native_test.c) add_tpm_example(native_test native/native_test.c)
add_tpm_example(counter nvram/counter.c)
add_tpm_example(policy_nv nvram/policy_nv.c)
add_tpm_example(read nvram/read.c) add_tpm_example(read nvram/read.c)
add_tpm_example(store nvram/store.c) add_tpm_example(store nvram/store.c)
add_tpm_example(extend pcr/extend.c) add_tpm_example(extend pcr/extend.c)
add_tpm_example(policy_sign pcr/policy_sign.c)
add_tpm_example(quote pcr/quote.c) add_tpm_example(quote pcr/quote.c)
add_tpm_example(read_pcr pcr/read_pcr.c) add_tpm_example(read_pcr pcr/read_pcr.c)
add_tpm_example(reset pcr/reset.c) add_tpm_example(reset pcr/reset.c)

View File

@ -432,17 +432,16 @@ typedef int64_t INT64;
/* ---------------------------------------------------------------------------*/ /* ---------------------------------------------------------------------------*/
/* Optional delay between polling */ /* Optional delay between polling */
#if (defined(WOLFTPM_SLB9670) || defined(WOLFTPM_SLB9672)) && !defined(XTPM_WAIT) #if defined(__linux__) && !defined(XTPM_WAIT)
/* For Infineon SLB9670 and SLB9672 adding 10us delay improves performance /* Avoid excessive polling.
* For Infineon SLB9670 and SLB9672 adding 10us delay improves performance
* and prevents issue with rapid use at higher speeds */ * and prevents issue with rapid use at higher speeds */
#ifdef __linux__
#ifndef XTPM_WAIT_POLLING_US #ifndef XTPM_WAIT_POLLING_US
#define XTPM_WAIT_POLLING_US 10 /* 0.01ms */ #define XTPM_WAIT_POLLING_US 10 /* 0.01ms */
#endif #endif
#include <unistd.h> #include <unistd.h>
#define XTPM_WAIT() usleep(XTPM_WAIT_POLLING_US); #define XTPM_WAIT() usleep(XTPM_WAIT_POLLING_US);
#endif #endif
#endif
#ifndef XTPM_WAIT #ifndef XTPM_WAIT
#define XTPM_WAIT() /* just poll without delay by default */ #define XTPM_WAIT() /* just poll without delay by default */
#endif #endif

View File

@ -2684,7 +2684,7 @@ WOLFTPM_API int wolfTPM2_GetKeyTemplate_KeySeal(TPMT_PUBLIC* publicTemplate, TPM
\param publicTemplate pointer to an empty structure of TPMT_PUBLIC type, to store the new template \param publicTemplate pointer to an empty structure of TPMT_PUBLIC type, to store the new template
\param alg can be only TPM_ALG_RSA or TPM_ALG_ECC, see Note above \param alg can be only TPM_ALG_RSA or TPM_ALG_ECC, see Note above
\param keyBits integer value, specifying bits for the key, typically 2048 (RSA) or 256 (ECC) \param keyBits integer value, specifying bits for the key, typically 2048 (RSA) or 256 (ECC)
\param curveId use one of the accepted TPM_ECC_CURVE values like TPM_ECC_NIST_P256 (only used when alg=TPM_ALG_ECC) \param curveID use one of the accepted TPM_ECC_CURVE values like TPM_ECC_NIST_P256 (only used when alg=TPM_ALG_ECC)
\param nameAlg integer value of TPMI_ALG_HASH type, specifying a valid TPM2 hashing algorithm (typically TPM_ALG_SHA256) \param nameAlg integer value of TPMI_ALG_HASH type, specifying a valid TPM2 hashing algorithm (typically TPM_ALG_SHA256)
\param highRange integer value: 0=low range, 1=high range \param highRange integer value: 0=low range, 1=high range