diff options
author | Tobias Brunner <tobias@strongswan.org> | 2013-04-17 13:00:51 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2013-05-08 15:02:40 +0200 |
commit | 3ee2af97bfd77927fe2a765821030a8419f2f072 (patch) | |
tree | adaf18f8ce3eea9abbca5c62fdd21a33ea13d031 /src/libstrongswan/plugins/openssl/openssl_plugin.c | |
parent | 780900ab0e747a4dbdf70bfa2a40f1cd19581744 (diff) | |
download | strongswan-3ee2af97bfd77927fe2a765821030a8419f2f072.tar.bz2 strongswan-3ee2af97bfd77927fe2a765821030a8419f2f072.tar.xz |
openssl: Don't use deprecated CRYPTO_set_id_callback() with OpenSSL >= 1.0.0
Diffstat (limited to 'src/libstrongswan/plugins/openssl/openssl_plugin.c')
-rw-r--r-- | src/libstrongswan/plugins/openssl/openssl_plugin.c | 46 |
1 files changed, 29 insertions, 17 deletions
diff --git a/src/libstrongswan/plugins/openssl/openssl_plugin.c b/src/libstrongswan/plugins/openssl/openssl_plugin.c index 174f94e05..7c880402b 100644 --- a/src/libstrongswan/plugins/openssl/openssl_plugin.c +++ b/src/libstrongswan/plugins/openssl/openssl_plugin.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Tobias Brunner + * Copyright (C) 2008-2013 Tobias Brunner * Copyright (C) 2008 Martin Willi * Hochschule fuer Technik Rapperswil * @@ -142,6 +142,13 @@ static unsigned long id_function(void) return 1 + (unsigned long)thread_current_id(); } +#if OPENSSL_VERSION_NUMBER >= 0x1000000fL +static void threadid_function(CRYPTO_THREADID *threadid) +{ + CRYPTO_THREADID_set_numeric(threadid, id_function()); +} +#endif /* OPENSSL_VERSION_NUMBER */ + /** * initialize OpenSSL for multi-threaded use */ @@ -149,7 +156,12 @@ static void threading_init() { int i, num_locks; +#if OPENSSL_VERSION_NUMBER >= 0x1000000fL + CRYPTO_THREADID_set_callback(threadid_function); +#else CRYPTO_set_id_callback(id_function); +#endif + CRYPTO_set_locking_callback(locking_function); CRYPTO_set_dynlock_create_callback(create_function); @@ -165,6 +177,22 @@ static void threading_init() } /** + * cleanup OpenSSL threading locks + */ +static void threading_cleanup() +{ + int i, num_locks; + + num_locks = CRYPTO_num_locks(); + for (i = 0; i < num_locks; i++) + { + mutex[i]->destroy(mutex[i]); + } + free(mutex); + mutex = NULL; +} + +/** * Seed the OpenSSL RNG, if required */ static bool seed_rng() @@ -193,22 +221,6 @@ static bool seed_rng() return TRUE; } -/** - * cleanup OpenSSL threading locks - */ -static void threading_cleanup() -{ - int i, num_locks; - - num_locks = CRYPTO_num_locks(); - for (i = 0; i < num_locks; i++) - { - mutex[i]->destroy(mutex[i]); - } - free(mutex); - mutex = NULL; -} - METHOD(plugin_t, get_name, char*, private_openssl_plugin_t *this) { |