mirror of https://github.com/wolfSSL/wolfTPM.git
fix casting and unused variable problems on windows (#255)
parent
3a1ece8da1
commit
ae280a7e71
|
@ -157,7 +157,9 @@ int TPM2_Native_TestArgs(void* userCtx, int argc, char *argv[])
|
|||
TPML_TAGGED_TPM_PROPERTY* tpmProp;
|
||||
TPM_HANDLE handle = TPM_RH_NULL;
|
||||
TPM_HANDLE sessionHandle = TPM_RH_NULL;
|
||||
#ifndef WOLFTPM_WINAPI
|
||||
TPMI_RH_NV_INDEX nvIndex;
|
||||
#endif
|
||||
TPM2B_PUBLIC_KEY_RSA message;
|
||||
|
||||
#ifndef WOLFTPM2_NO_WOLFCRYPT
|
||||
|
|
|
@ -103,7 +103,9 @@ static const char pemFileKey[] = "key.pem";
|
|||
extern double current_time(int reset);
|
||||
return current_time(reset);
|
||||
#elif defined(_WIN32)
|
||||
return ((double)GetTickCount64())/1000.0;
|
||||
unsigned long long ticks = GetTickCount64();
|
||||
(void)reset;
|
||||
return ((double)ticks)/1000.0;
|
||||
#else
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, 0);
|
||||
|
|
|
@ -79,7 +79,9 @@ int TPM2_Wrapper_TestArgs(void* userCtx, int argc, char *argv[])
|
|||
WOLFTPM2_BUFFER plain;
|
||||
TPMT_PUBLIC publicTemplate;
|
||||
TPM2B_ECC_POINT pubPoint;
|
||||
#ifndef WOLFTPM_WINAPI
|
||||
word32 nvAttributes = 0;
|
||||
#endif
|
||||
#ifdef WOLFTPM_CRYPTOCB
|
||||
TpmCryptoDevCtx tpmCtx;
|
||||
#endif
|
||||
|
|
|
@ -512,7 +512,7 @@ int wolfTPM2_SelfTest(WOLFTPM2_DEV* dev)
|
|||
selfTest.fullTest = YES;
|
||||
rc = TPM2_SelfTest(&selfTest);
|
||||
#ifdef WOLFTPM_WINAPI
|
||||
if (rc == TPM_E_COMMAND_BLOCKED) { /* 0x80280400 */
|
||||
if (rc == (int)TPM_E_COMMAND_BLOCKED) { /* 0x80280400 */
|
||||
#ifdef DEBUG_WOLFTPM
|
||||
printf("TPM2_SelfTest not allowed on Windows TBS (err 0x%x)\n", rc);
|
||||
#endif
|
||||
|
@ -2510,7 +2510,7 @@ int wolfTPM2_NVStoreKey(WOLFTPM2_DEV* dev, TPM_HANDLE primaryHandle,
|
|||
rc = TPM2_EvictControl(&in);
|
||||
if (rc != TPM_RC_SUCCESS) {
|
||||
#ifdef WOLFTPM_WINAPI
|
||||
if (rc == TPM_E_COMMAND_BLOCKED) { /* 0x80280400 */
|
||||
if (rc == (int)TPM_E_COMMAND_BLOCKED) { /* 0x80280400 */
|
||||
#ifdef DEBUG_WOLFTPM
|
||||
printf("TPM2_EvictControl (storing key to NV) not allowed on "
|
||||
"Windows TBS (err 0x%x)\n", rc);
|
||||
|
|
|
@ -1670,9 +1670,9 @@ struct wolfTPM_winContext {
|
|||
#define TPM_E_COMMAND_BLOCKED (0x80284000)
|
||||
#endif
|
||||
|
||||
#define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code) == TPM_E_COMMAND_BLOCKED)
|
||||
#define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == (int)TPM_RC_COMMAND_CODE || (code) == (int)TPM_E_COMMAND_BLOCKED)
|
||||
#else
|
||||
#define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) (code == TPM_RC_COMMAND_CODE)
|
||||
#define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) (code == (int)TPM_RC_COMMAND_CODE)
|
||||
#endif /* WOLFTPM_WINAPI */
|
||||
|
||||
/* make sure advanced IO is enabled for I2C */
|
||||
|
|
Loading…
Reference in New Issue