From 12d0521977032412f6eec5dc91b4e12477d2d7af Mon Sep 17 00:00:00 2001 From: Daniele Lacamera Date: Thu, 19 Mar 2026 18:06:25 +0100 Subject: [PATCH] Don't nanosleep on non-linux builds --- src/tpm2_wrap.c | 5 +++++ wolftpm/tpm2_types.h | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/src/tpm2_wrap.c b/src/tpm2_wrap.c index 7a3e0f2c..3c7ea757 100644 --- a/src/tpm2_wrap.c +++ b/src/tpm2_wrap.c @@ -3428,6 +3428,9 @@ int wolfTPM2_ImportPublicKeyBuffer(WOLFTPM2_DEV* dev, int keyType, } #endif + (void)derBuf; + (void)derSz; + return rc; } @@ -3545,6 +3548,8 @@ int wolfTPM2_ImportPrivateKeyBuffer(WOLFTPM2_DEV* dev, #endif TPM2_ForceZero(&sens, sizeof(sens)); + (void)derBuf; + (void)derSz; return rc; } diff --git a/wolftpm/tpm2_types.h b/wolftpm/tpm2_types.h index ddd08d55..d37dee13 100644 --- a/wolftpm/tpm2_types.h +++ b/wolftpm/tpm2_types.h @@ -526,6 +526,13 @@ typedef int64_t INT64; #define XSLEEP_MS(ms) k_msleep(ms) #elif defined(WOLFSSL_ESPIDF) #define XSLEEP_MS(ms) vTaskDelay(pdMS_TO_TICKS(ms)) + #elif defined(__linux__) || defined(__ARM_EABI__) + #include + static inline void XSLEEP_MS(unsigned int ms) { + if (ms >= 1000) + sleep(ms / 1000); + usleep((ms % 1000) * 1000); + } #elif defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309L #include static inline void XSLEEP_MS(unsigned int ms) {