[Spice-commits] 2 commits - AUTHORS server/reds.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Nov 6 08:59:48 UTC 2019


 AUTHORS       |    1 +
 server/reds.c |   33 +++++++++++++++++++--------------
 2 files changed, 20 insertions(+), 14 deletions(-)

New commits:
commit 1921d571600d85e6eb4ddca51dbd7bb9f34bc27c
Author: Rosen Penev <rosenp at gmail.com>
Date:   Sun Nov 3 15:44:10 2019 -0800

    reds: Fix compilation without deprecated OpenSSL 1.0.2 APIs
    
    The threading API for 1.0 was replaced with the THREADID API.
    
    Signed-off-by: Rosen Penev <rosenp at gmail.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/server/reds.c b/server/reds.c
index dc03ef3a..83967760 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -2802,12 +2802,9 @@ static int ssl_password_cb(char *buf, int size, int flags, void *userdata)
 #if OPENSSL_VERSION_NUMBER < 0x1010000FL
 static pthread_mutex_t *lock_cs;
 
-static unsigned long pthreads_thread_id(void)
+static void pthreads_thread_id(CRYPTO_THREADID *tid)
 {
-    unsigned long ret;
-
-    ret = (unsigned long)pthread_self();
-    return (ret);
+    CRYPTO_THREADID_set_numeric(tid, (unsigned long)pthread_self());
 }
 
 static void pthreads_locking_callback(int mode, int type, const char *file, int line)
@@ -2837,7 +2834,7 @@ static void openssl_thread_setup(void)
         pthread_mutex_init(&(lock_cs[i]), NULL);
     }
 
-    CRYPTO_set_id_callback(pthreads_thread_id);
+    CRYPTO_THREADID_set_callback(pthreads_thread_id);
     CRYPTO_set_locking_callback(pthreads_locking_callback);
 }
 
commit 5bc932f7a71ede7d8ecd9d88804af95a2eb955c0
Author: Rosen Penev <rosenp at gmail.com>
Date:   Sun Nov 3 15:34:33 2019 -0800

    reds: Fix compilation without deprecated OpenSSL 1.1 APIs
    
    Missing headers for BN_ and RSA_ functions.
    
    Initialization is deprecated with 1.1.
    
    Signed-off-by: Rosen Penev <rosenp at gmail.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/AUTHORS b/AUTHORS
index f888fcfb..7ca94f74 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -74,5 +74,6 @@ Patches also contributed by
     Thiago Mendes <tribeirom at gmail.com>
     Christian Ehrhardt <christian.ehrhardt at canonical.com>
     Kevin Pouget <kpouget at redhat.com>
+    Rosen Penev <rosenp at gmail.com>
 
    ....send patches to get your name here...
diff --git a/server/reds.c b/server/reds.c
index c55aa3f8..dc03ef3a 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -36,7 +36,9 @@
 #include <ws2tcpip.h>
 #endif
 
+#include <openssl/bn.h>
 #include <openssl/err.h>
+#include <openssl/rsa.h>
 
 #if HAVE_SASL
 #include <sasl/sasl.h>
@@ -2838,13 +2840,8 @@ static void openssl_thread_setup(void)
     CRYPTO_set_id_callback(pthreads_thread_id);
     CRYPTO_set_locking_callback(pthreads_locking_callback);
 }
-#else
-static inline void openssl_thread_setup(void)
-{
-}
-#endif
 
-static gpointer openssl_global_init(gpointer arg)
+static gpointer openssl_global_init_once(gpointer arg)
 {
     SSL_library_init();
     SSL_load_error_strings();
@@ -2854,9 +2851,20 @@ static gpointer openssl_global_init(gpointer arg)
     return NULL;
 }
 
-static int reds_init_ssl(RedsState *reds)
+static inline void openssl_global_init(void)
 {
     static GOnce openssl_once = G_ONCE_INIT;
+    g_once(&openssl_once, openssl_global_init_once, NULL);
+}
+
+#else
+static inline void openssl_global_init(void)
+{
+}
+#endif
+
+static int reds_init_ssl(RedsState *reds)
+{
     const SSL_METHOD *ssl_method;
     int return_code;
     /* Limit connection to TLSv1.1 or newer.
@@ -2865,7 +2873,7 @@ static int reds_init_ssl(RedsState *reds)
     long ssl_options = SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | SSL_OP_NO_COMPRESSION | SSL_OP_NO_TLSv1;
 
     /* Global system initialization*/
-    g_once(&openssl_once, openssl_global_init, NULL);
+    openssl_global_init();
 
     /* Create our context*/
     /* SSLv23_method() handles TLSv1.x in addition to SSLv2/v3 */


More information about the Spice-commits mailing list