diff --git a/crypto/internal.h b/crypto/internal.h index 438d7169..045e0526 100644 --- a/crypto/internal.h +++ b/crypto/internal.h @@ -353,7 +353,9 @@ OPENSSL_EXPORT int CRYPTO_refcount_dec_and_test_zero(CRYPTO_refcount_t *count); * automatically by |CRYPTO_STATIC_MUTEX_lock_*|. */ #if defined(OPENSSL_NO_THREADS) -struct CRYPTO_STATIC_MUTEX {}; +struct CRYPTO_STATIC_MUTEX { + char padding; /* Empty structs have different sizes in C and C++. */ +}; #define CRYPTO_STATIC_MUTEX_INIT {} #elif defined(OPENSSL_WINDOWS) struct CRYPTO_STATIC_MUTEX { diff --git a/include/openssl/thread.h b/include/openssl/thread.h index 568a8583..ac4ced07 100644 --- a/include/openssl/thread.h +++ b/include/openssl/thread.h @@ -67,7 +67,9 @@ extern "C" { #if defined(OPENSSL_NO_THREADS) -typedef struct crypto_mutex_st {} CRYPTO_MUTEX; +typedef struct crypto_mutex_st { + char padding; /* Empty structs have different sizes in C and C++. */ +} CRYPTO_MUTEX; #elif defined(OPENSSL_WINDOWS) /* CRYPTO_MUTEX can appear in public header files so we really don't want to * pull in windows.h. It's statically asserted that this structure is large