wolfSSL / wolfTPM

wolfTPM is a highly portable TPM 2.0 library, designed for embedded use.
https://www.wolfssl.com
GNU General Public License v2.0
232 stars 56 forks source link

Refactor examples/tpm_io into separate platform source files #171

Closed tomoveu closed 3 years ago

tomoveu commented 3 years ago

This is the crude work, now remains the details in automake and testing

Signed-off-by: Dimitar Tomov dimi@wolfssl.com

dgarske commented 3 years ago

@tomoveu also looks like you will need to add all tpmio[platform].c files to all the examples _SOURCES.

dgarske commented 3 years ago

@tomoveu . Also with --enable-swtpm get issue with #define TPM2_IoCb NULL and function in tpm_io.c conflicting.

examples/tpm_io.c:170:5: error: expected ')'
int TPM2_IoCb(TPM2_CTX* ctx, const byte* txBuf, byte* rxBuf,
tomoveu commented 3 years ago

@dgarske Oh, thanks! Good points.

I thought automake could include the correct tpm_io_platform.c at compile time?

Thus, include.am would require only tpm_io.c/.h Hm, I may have overestimated how versatile automake is.

tomoveu commented 3 years ago
  1. Kept single tpm_io.h for backward compatibility
  2. Updated all example include.am files to include every supported tpm_io platform
  3. Fixed missing ifdefs for TPM Simulator case

TPM Simulator and Native Linux are working. I am testing STM32 right now.

@elms could you please quickly run the native tests for the Windows port?

@dgarske could you please help test QNX, Xilinx and Atmel ASF?

elms commented 3 years ago

@tomoveu Testing on Windows looks like it operates the same as master.