Remove CRYPTO_MUTEX from public headers
We no longer need to define CRYPTO_MUTEX in public headers. This
simplifies a pile of things. First, we can now use pthread_rwlock_t
without any fuss, rather than trying to guess the size on glibc.
As a result, CRYPTO_MUTEX and CRYPTO_STATIC_MUTEX can be merged into one
type. We can almost do this to CRYPTO_refcount_t too. BIO is the one
straggler remaining.
Fixed: 325
Change-Id: Ie93c9f553c0f02ce594b959c041b00fc15ba51d2
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/60611
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Bob Beck <bbe@google.com>
diff --git a/crypto/ex_data.c b/crypto/ex_data.c
index d34769f..7dc3272 100644
--- a/crypto/ex_data.c
+++ b/crypto/ex_data.c
@@ -144,13 +144,13 @@
funcs->free_func = free_func;
funcs->next = NULL;
- CRYPTO_STATIC_MUTEX_lock_write(&ex_data_class->lock);
+ CRYPTO_MUTEX_lock_write(&ex_data_class->lock);
uint32_t num_funcs = CRYPTO_atomic_load_u32(&ex_data_class->num_funcs);
// The index must fit in |int|.
if (num_funcs > (size_t)(INT_MAX - ex_data_class->num_reserved)) {
OPENSSL_PUT_ERROR(CRYPTO, ERR_R_OVERFLOW);
- CRYPTO_STATIC_MUTEX_unlock_write(&ex_data_class->lock);
+ CRYPTO_MUTEX_unlock_write(&ex_data_class->lock);
return 0;
}
@@ -165,7 +165,7 @@
}
CRYPTO_atomic_store_u32(&ex_data_class->num_funcs, num_funcs + 1);
- CRYPTO_STATIC_MUTEX_unlock_write(&ex_data_class->lock);
+ CRYPTO_MUTEX_unlock_write(&ex_data_class->lock);
*out_index = (int)num_funcs + ex_data_class->num_reserved;
return 1;
}