Fixes for MMIO HAL refactor.

pull/271/head
David Garske 2023-06-28 16:00:56 -07:00
parent 21638b065a
commit ab9bf2981b
3 changed files with 5 additions and 8 deletions

View File

@ -39,7 +39,7 @@
#endif
#ifndef WOLFTPM_ADV_IO
#error "WOLFTPM_MMIO_BUILTIN_CB requires WOLFTPM_ADV_IO"
#error "WOLFTPM_MMIO requires WOLFTPM_ADV_IO"
#endif
#ifdef __GNUC__

View File

@ -28,6 +28,8 @@
#include <wolftpm/tpm2_winapi.h>
#include <wolftpm/tpm2_param_enc.h>
#include <hal/tpm_io.h>
/******************************************************************************/
/* --- Local Variables -- */
/******************************************************************************/
@ -623,14 +625,14 @@ TPM_RC TPM2_Init_ex(TPM2_CTX* ctx, TPM2HalIoCb ioCb, void* userCtx,
#endif
#if defined(WOLFTPM_LINUX_DEV) || defined(WOLFTPM_SWTPM) || \
defined(WOLFTPM_WINAPI) || defined(WOLFTPM_MMIO)
defined(WOLFTPM_WINAPI)
if (ioCb != NULL || userCtx != NULL) {
return BAD_FUNC_ARG;
}
#else
#ifdef WOLFTPM_MMIO
if (ioCb == NULL)
ioCb = TPM2_Mmio_Cb;
ioCb = TPM2_IoCb_Mmio;
#endif
/* Setup HAL IO Callback */
rc = TPM2_SetHalIoCb(ctx, ioCb, userCtx);

View File

@ -54,11 +54,6 @@ WOLFTPM_LOCAL int TPM2_TIS_StartupWait(TPM2_CTX* ctx, int timeout);
WOLFTPM_LOCAL int TPM2_TIS_Write(TPM2_CTX* ctx, word32 addr, const byte* value, word32 len);
WOLFTPM_LOCAL int TPM2_TIS_Read(TPM2_CTX* ctx, word32 addr, byte* result, word32 len);
#ifdef WOLFTPM_MMIO_BUILTIN_CB
WOLFTPM_LOCAL int TPM2_Mmio_Cb(TPM2_CTX *ctx, int isRead, word32 addr, byte* buf, word16 size,
void* userCtx);
#endif /* WOLFTPM_MMIO_BUILTIN_CB */
#ifdef __cplusplus
} /* extern "C" */
#endif