File gnutls-FIPS-jitterentropy-threadsafe.patch of Package gnutls.32149

--- gnutls-3.7.3/lib/nettle/sysrng-linux.c	
+++ gnutls-3.7.3/lib/nettle/sysrng-linux.c	
@@ -52,8 +52,9 @@ get_entropy_func _rnd_get_system_entropy
 # if defined(ENABLE_FIPS140)
 #  define HAVE_JENT
 #  include <jitterentropy.h>
-static int jent_initialized = 0;
-static struct rand_data* ec = NULL;
+/* Per thread context of random generator, and a flag to indicate initialization */
+static _Thread_local struct rand_data* ec = NULL;
+static _Thread_local int jent_initialized = 0;
 /* Declare function to fix a missing-prototypes compilation warning */
 void FIPS_jent_entropy_deinit(void);
 # endif
@@ -118,6 +119,8 @@ void FIPS_jent_entropy_deinit(void)
 		ec = NULL;
 	}
 
+	jent_initialized = 0;
+
 	return;
 }
 
openSUSE Build Service is sponsored by