Skip to content

Commit e7aad1a

Browse files
committed
Support for pthread static mutex when building against older wolfSSL versions (like 5.6.6).
1 parent ac800d3 commit e7aad1a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

wolftpm/tpm2_types.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,20 @@ typedef int64_t INT64;
234234
#endif
235235
#endif
236236

237+
/* if using older wolfSSL that does not have the pthread mutex initializer */
238+
#ifndef WOLFSSL_MUTEX_INITIALIZER
239+
#if defined(WOLFSSL_PTHREADS)
240+
#define WOLFSSL_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
241+
#endif
242+
#endif
243+
#ifndef WOLFSSL_MUTEX_INITIALIZER_CLAUSE
244+
#ifdef WOLFSSL_MUTEX_INITIALIZER
245+
#define WOLFSSL_MUTEX_INITIALIZER_CLAUSE(lockname) = WOLFSSL_MUTEX_INITIALIZER
246+
#else
247+
#define WOLFSSL_MUTEX_INITIALIZER_CLAUSE(lockname) /* null expansion */
248+
#endif
249+
#endif
250+
237251
#ifndef WOLFTPM_CUSTOM_TYPES
238252
#include <stdlib.h>
239253

0 commit comments

Comments
 (0)