Skip to content

Commit b086f34

Browse files
committed
Remove gActiveTPM thread local when it's properly mutex bound.
1 parent 5770675 commit b086f34

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/tpm2.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,18 @@
3737
/* --- Local Variables -- */
3838
/******************************************************************************/
3939

40-
41-
#ifdef WOLFTPM_NO_ACTIVE_THREAD_LS
42-
/* if using gHwLock and want to use a shared active TPM2_CTX between threads */
43-
static TPM2_CTX* gActiveTPM;
44-
#else
45-
static THREAD_LS_T TPM2_CTX* gActiveTPM;
46-
#endif
47-
4840
#ifndef WOLFTPM2_NO_WOLFCRYPT
4941
static volatile int gWolfCryptRefCount = 0;
5042
#endif
5143

5244
#if !defined(WOLFTPM2_NO_WOLFCRYPT) && !defined(WOLFTPM_NO_LOCK) && \
5345
!defined(SINGLE_THREADED)
46+
/* mutex protection enabled for gActiveTPM, so do not use thread local */
47+
static TPM2_CTX* gActiveTPM;
48+
5449
static wolfSSL_Mutex gHwLock WOLFSSL_MUTEX_INITIALIZER_CLAUSE(gHwLock);
50+
#else
51+
static THREAD_LS_T TPM2_CTX* gActiveTPM;
5552
#endif
5653

5754
#ifdef WOLFTPM_LINUX_DEV

0 commit comments

Comments
 (0)