summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/crypto_init.c
diff options
context:
space:
mode:
authorbcook <>2018-11-11 06:41:28 +0000
committerbcook <>2018-11-11 06:41:28 +0000
commitc3082ab78ba758ef51c552b6a91bdf1236de0cf8 (patch)
tree6d18ff101148258c403e820ff423d10a65fba89e /src/lib/libcrypto/crypto_init.c
parent32ccc9aa9f3dd1c0efa02d4b21376521a91e4705 (diff)
downloadopenbsd-c3082ab78ba758ef51c552b6a91bdf1236de0cf8.tar.gz
openbsd-c3082ab78ba758ef51c552b6a91bdf1236de0cf8.tar.bz2
openbsd-c3082ab78ba758ef51c552b6a91bdf1236de0cf8.zip
Add automatic threading initialization for libcrypto.
This implements automatic thread support initialization in libcrypto. This does not remove any functions from the ABI, but does turn them into no-ops. Stub implementations of pthread_mutex_(init|lock|unlock) are provided for ramdisks. This does not implement the new OpenSSL 1.1 thread API internally, keeping the original CRYTPO_lock / CRYPTO_add_lock functions for library locking. For -portable, crypto_lock.c can be reimplemented with OS-specific primitives as needed. ok beck@, tb@, looks sane guenther@
Diffstat (limited to 'src/lib/libcrypto/crypto_init.c')
-rw-r--r--src/lib/libcrypto/crypto_init.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/lib/libcrypto/crypto_init.c b/src/lib/libcrypto/crypto_init.c
index 08fb55ffd5..3745e2e718 100644
--- a/src/lib/libcrypto/crypto_init.c
+++ b/src/lib/libcrypto/crypto_init.c
@@ -30,6 +30,8 @@ int OpenSSL_no_config(void);
30 30
31static pthread_t crypto_init_thread; 31static pthread_t crypto_init_thread;
32 32
33void crypto_init_locks(void);
34
33static void 35static void
34OPENSSL_init_crypto_internal(void) 36OPENSSL_init_crypto_internal(void)
35{ 37{
@@ -38,6 +40,7 @@ OPENSSL_init_crypto_internal(void)
38 ERR_load_crypto_strings(); 40 ERR_load_crypto_strings();
39 OpenSSL_add_all_ciphers(); 41 OpenSSL_add_all_ciphers();
40 OpenSSL_add_all_digests(); 42 OpenSSL_add_all_digests();
43 crypto_init_locks();
41} 44}
42 45
43int 46int