aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2009-08-01 11:09:02 +0000
committerDaniel Stenberg <daniel@haxx.se>2009-08-01 11:09:02 +0000
commit0dce2ff8a09065b2be2a3531f498006906c81db5 (patch)
treeef97cbf066d5485ee1bdb7ce5cbabc6ccb780485 /lib
parent2642638fcae2c51a3407f0af6a90b3c6aca895f5 (diff)
- Tanguy Fautre pointed out that OpenSSL's function RAND_screen() (present
only in some OpenSSL installs - like on Windows) isn't thread-safe and we agreed that moving it to the global_init() function is a decent way to deal with this situation.
Diffstat (limited to 'lib')
-rw-r--r--lib/ssluse.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/ssluse.c b/lib/ssluse.c
index 2365d5283..ffc1fbd96 100644
--- a/lib/ssluse.c
+++ b/lib/ssluse.c
@@ -225,8 +225,7 @@ static int ossl_seed(struct SessionHandle *data)
/* If we get here, it means we need to seed the PRNG using a "silly"
approach! */
#ifdef HAVE_RAND_SCREEN
- /* This one gets a random value by reading the currently shown screen */
- RAND_screen();
+ /* if RAND_screen() is present, it was called during global init */
nread = 100; /* just a value */
#else
{
@@ -642,6 +641,13 @@ int Curl_ossl_init(void)
OpenSSL_add_all_algorithms();
+#ifdef HAVE_RAND_SCREEN
+ /* This one gets a random value by reading the currently shown screen.
+ RAND_screen() is not thread-safe according to OpenSSL devs - although not
+ mentioned in documentation. */
+ RAND_screen();
+#endif
+
return 1;
}