Skip to content

Commit d1756f9

Browse files
authored
Merge pull request #472 from danielinux/do-not-nanosleep
Don't nanosleep on non-linux builds
2 parents 9613068 + 12d0521 commit d1756f9

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

src/tpm2_wrap.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3428,6 +3428,9 @@ int wolfTPM2_ImportPublicKeyBuffer(WOLFTPM2_DEV* dev, int keyType,
34283428
}
34293429
#endif
34303430

3431+
(void)derBuf;
3432+
(void)derSz;
3433+
34313434
return rc;
34323435
}
34333436

@@ -3545,6 +3548,8 @@ int wolfTPM2_ImportPrivateKeyBuffer(WOLFTPM2_DEV* dev,
35453548
#endif
35463549

35473550
TPM2_ForceZero(&sens, sizeof(sens));
3551+
(void)derBuf;
3552+
(void)derSz;
35483553

35493554
return rc;
35503555
}

wolftpm/tpm2_types.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,13 @@ typedef int64_t INT64;
526526
#define XSLEEP_MS(ms) k_msleep(ms)
527527
#elif defined(WOLFSSL_ESPIDF)
528528
#define XSLEEP_MS(ms) vTaskDelay(pdMS_TO_TICKS(ms))
529+
#elif defined(__linux__) || defined(__ARM_EABI__)
530+
#include <unistd.h>
531+
static inline void XSLEEP_MS(unsigned int ms) {
532+
if (ms >= 1000)
533+
sleep(ms / 1000);
534+
usleep((ms % 1000) * 1000);
535+
}
529536
#elif defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309L
530537
#include <time.h>
531538
static inline void XSLEEP_MS(unsigned int ms) {

0 commit comments

Comments
 (0)