aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2012-06-30 10:05:41 +0200
committerTobias Brunner <tobias@strongswan.org>2012-07-03 12:02:57 +0200
commit901dbc1077f6c9bd29369cad848bc79a29c1a65b (patch)
tree2cbac60c09859b8243712390754b60273625ac40 /src
parent997fdd1f024a8e30c97dcc86c874129f0fc8247f (diff)
downloadstrongswan-901dbc1077f6c9bd29369cad848bc79a29c1a65b.tar.bz2
strongswan-901dbc1077f6c9bd29369cad848bc79a29c1a65b.tar.xz
openssl: Ensure the thread ID is never zero
This might otherwise cause problems because OpenSSL tries to lock mutexes recursively if it assumes the lock is held by a different thread e.g. during FIPS initialization.
Diffstat (limited to 'src')
-rw-r--r--src/libstrongswan/plugins/openssl/openssl_plugin.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libstrongswan/plugins/openssl/openssl_plugin.c b/src/libstrongswan/plugins/openssl/openssl_plugin.c
index 5a114122a..7daa92bef 100644
--- a/src/libstrongswan/plugins/openssl/openssl_plugin.c
+++ b/src/libstrongswan/plugins/openssl/openssl_plugin.c
@@ -129,7 +129,9 @@ static void destroy_function(struct CRYPTO_dynlock_value *lock,
*/
static unsigned long id_function(void)
{
- return (unsigned long)thread_current_id();
+ /* ensure the thread ID is never zero, otherwise OpenSSL might try to
+ * acquire locks recursively */
+ return 1 + (unsigned long)thread_current_id();
}
/**