New support for mchp `--enable-mchp`.

pull/59/head
David Garske 2019-01-30 13:41:05 -08:00
parent dcd10f1920
commit dc441a1555
3 changed files with 40 additions and 14 deletions

View File

@ -183,6 +183,18 @@ fi
AM_CONDITIONAL([BUILD_ST33], [test "x$ENABLED_ST33" = "xyes"])
# MCHP Support
AC_ARG_ENABLE([mchp],
[AS_HELP_STRING([--enable-mchp],[Enable TPM 2.0 Support (default: disabled)])],
[ ENABLED_MCHP=$enableval ],
[ ENABLED_MCHP=no ]
)
if test "x$ENABLED_MCHP" = "xyes"
then
AM_CFLAGS="$AM_CFLAGS -DWOLFTPM_MCHP"
fi
AM_CONDITIONAL([BUILD_MCHP], [test "x$ENABLED_MCHP" = "xyes"])
# HARDEN FLAGS
AX_HARDEN_CC_COMPILER_FLAGS

View File

@ -347,12 +347,16 @@ int TPM2_Native_Test(void* userCtx)
TPM2_GetRCString(rc));
goto exit;
}
printf("TPM2_PCR_Read: Index %d, Digest Sz %d, Update Counter %d\n",
pcrIndex,
(int)cmdOut.pcrRead.pcrValues.digests[0].size,
(int)cmdOut.pcrRead.pcrUpdateCounter);
TPM2_PrintBin(cmdOut.pcrRead.pcrValues.digests[0].buffer,
cmdOut.pcrRead.pcrValues.digests[0].size);
printf("TPM2_PCR_Read: Index %d, Count %d\n",
pcrIndex, (int)cmdOut.pcrRead.pcrValues.count);
if (cmdOut.pcrRead.pcrValues.count > 0) {
printf("TPM2_PCR_Read: Index %d, Digest Sz %d, Update Counter %d\n",
pcrIndex,
(int)cmdOut.pcrRead.pcrValues.digests[0].size,
(int)cmdOut.pcrRead.pcrUpdateCounter);
TPM2_PrintBin(cmdOut.pcrRead.pcrValues.digests[0].buffer,
cmdOut.pcrRead.pcrValues.digests[0].size);
}
}
/* PCR Extend and Verify */
@ -380,13 +384,16 @@ int TPM2_Native_Test(void* userCtx)
printf("TPM2_PCR_Read failed 0x%x: %s\n", rc, TPM2_GetRCString(rc));
goto exit;
}
printf("TPM2_PCR_Read: Index %d, Digest Sz %d, Update Counter %d\n",
pcrIndex,
(int)cmdOut.pcrRead.pcrValues.digests[0].size,
(int)cmdOut.pcrRead.pcrUpdateCounter);
TPM2_PrintBin(cmdOut.pcrRead.pcrValues.digests[0].buffer,
cmdOut.pcrRead.pcrValues.digests[0].size);
printf("TPM2_PCR_Read: Index %d, Count %d\n",
pcrIndex, (int)cmdOut.pcrRead.pcrValues.count);
if (cmdOut.pcrRead.pcrValues.count > 0) {
printf("TPM2_PCR_Read: Index %d, Digest Sz %d, Update Counter %d\n",
pcrIndex,
(int)cmdOut.pcrRead.pcrValues.digests[0].size,
(int)cmdOut.pcrRead.pcrUpdateCounter);
TPM2_PrintBin(cmdOut.pcrRead.pcrValues.digests[0].buffer,
cmdOut.pcrRead.pcrValues.digests[0].size);
}
/* Start Auth Session */

View File

@ -55,7 +55,14 @@
#define TPM2_I2C_DEV "/dev/i2c-1"
#else
/* SPI */
#ifdef WOLFTPM_ST33
#ifdef WOLFTPM_MCHP
/* SPI uses CE0 */
#define TPM2_SPI_DEV "/dev/spidev0.0"
#ifndef WOLFTPM_CHECK_WAIT_STATE
#define WOLFTPM_CHECK_WAIT_STATE
#endif
#elif defined(WOLFTPM_ST33)
/* ST33HTPH SPI uses CE0 */
#define TPM2_SPI_DEV "/dev/spidev0.0"