diff options
author | Hugo Landau <hlandau@openssl.org> | 2024-02-08 10:27:56 +0000 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2024-02-09 14:10:17 +0100 |
commit | 62cb7c810e882895a71ba2cc479f482df0aa8e32 (patch) | |
tree | 835ecd73332006d90857245d1e713f5a8739d6f9 /include | |
parent | d8d19107618dd89c4584996b2bbed32b983d3890 (diff) |
THREADING: Make CRYPTO_MUTEX and CRYPTO_CONDVAR typesafe
There was really no need for this to be void and it made bugs very easy
to introduce accidentally, especially given that the free functions
needed to be passed a pointer to the pointer.
Also fix some bugs in the QUIC code detected immediately by this change.
.
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23519)
Diffstat (limited to 'include')
-rw-r--r-- | include/internal/quic_reactor.h | 3 | ||||
-rw-r--r-- | include/internal/thread_arch.h | 4 |
2 files changed, 4 insertions, 3 deletions
diff --git a/include/internal/quic_reactor.h b/include/internal/quic_reactor.h index 10d54ee156..47d93eee06 100644 --- a/include/internal/quic_reactor.h +++ b/include/internal/quic_reactor.h @@ -12,6 +12,7 @@ # include "internal/time.h" # include "internal/sockets.h" # include "internal/quic_predef.h" +# include "internal/thread_arch.h" # include <openssl/bio.h> # ifndef OPENSSL_NO_QUIC @@ -191,7 +192,7 @@ int ossl_quic_reactor_tick(QUIC_REACTOR *rtor, uint32_t flags); int ossl_quic_reactor_block_until_pred(QUIC_REACTOR *rtor, int (*pred)(void *arg), void *pred_arg, uint32_t flags, - CRYPTO_RWLOCK *mutex); + CRYPTO_MUTEX *mutex); # endif diff --git a/include/internal/thread_arch.h b/include/internal/thread_arch.h index 1bfc0ebb3d..0994433e7d 100644 --- a/include/internal/thread_arch.h +++ b/include/internal/thread_arch.h @@ -37,8 +37,8 @@ # include <openssl/crypto.h> -typedef void CRYPTO_MUTEX; -typedef void CRYPTO_CONDVAR; +typedef struct crypto_mutex_st CRYPTO_MUTEX; +typedef struct crypto_condvar_st CRYPTO_CONDVAR; CRYPTO_MUTEX *ossl_crypto_mutex_new(void); void ossl_crypto_mutex_lock(CRYPTO_MUTEX *mutex); |