File 0003-openssl-Ensure-the-thread-ID-is-never-zero.patch of Package strongswan
From 901dbc1077f6c9bd29369cad848bc79a29c1a65b Mon Sep 17 00:00:00 2001
From: Tobias Brunner <tobias@strongswan.org>
Date: Sat, 30 Jun 2012 10:05:41 +0200
References: bnc#779038,strongswan#198
Upstream: yes
Subject: [PATCH] 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.
---
src/libstrongswan/plugins/openssl/openssl_plugin.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
--- strongswan-4.3.4/src/libstrongswan/plugins/openssl/openssl_plugin.c.orig 2013-11-20 16:11:33.107544778 +0100
+++ strongswan-4.3.4/src/libstrongswan/plugins/openssl/openssl_plugin.c 2013-11-20 16:13:12.611518877 +0100
@@ -119,7 +119,9 @@
*/
static unsigned long id_function(void)
{
- return (unsigned long)pthread_self();
+ /* ensure the thread ID is never zero, otherwise OpenSSL might try to
+ * acquire locks recursively */
+ return 1 + (unsigned long)pthread_self();
}
/**