From: Rainer Jung Date: Thu, 11 Aug 2016 21:01:58 +0000 (+0000) Subject: OpenSSL 1.1.0 compat: X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=840b903c9692fa2cc765d8fefb4ad657fb14ae1d;p=thirdparty%2Fapache%2Fhttpd.git OpenSSL 1.1.0 compat: - Avoid use of deprecated functions for OpenSSL version >= 1.0 Backport of r1421305 from trunk. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x-openssl-1.1.0-compat@1756049 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/ssl/ssl_util.c b/modules/ssl/ssl_util.c index ee4c808eb7f..7c6af0d4bda 100644 --- a/modules/ssl/ssl_util.c +++ b/modules/ssl/ssl_util.c @@ -363,6 +363,28 @@ static void ssl_dyn_destroy_function(struct CRYPTO_dynlock_value *l, apr_pool_destroy(l->pool); } +#if OPENSSL_VERSION_NUMBER >= 0x10000000L + +static void ssl_util_thr_id(CRYPTO_THREADID *id) +{ + /* OpenSSL needs this to return an unsigned long. On OS/390, the pthread + * id is a structure twice that big. Use the TCB pointer instead as a + * unique unsigned long. + */ +#ifdef __MVS__ + struct PSA { + char unmapped[540]; + unsigned long PSATOLD; + } *psaptr = 0; + + CRYPTO_THREADID_set_numeric(id, psaptr->PSATOLD); +#else + CRYPTO_THREADID_set_numeric(id, (unsigned long) apr_os_thread_current()); +#endif +} + +#else + static unsigned long ssl_util_thr_id(void) { /* OpenSSL needs this to return an unsigned long. On OS/390, the pthread @@ -381,10 +403,16 @@ static unsigned long ssl_util_thr_id(void) #endif } +#endif + static apr_status_t ssl_util_thread_cleanup(void *data) { CRYPTO_set_locking_callback(NULL); +#if OPENSSL_VERSION_NUMBER >= 0x10000000L + CRYPTO_THREADID_set_callback(NULL); +#else CRYPTO_set_id_callback(NULL); +#endif CRYPTO_set_dynlock_create_callback(NULL); CRYPTO_set_dynlock_lock_callback(NULL); @@ -408,7 +436,11 @@ void ssl_util_thread_setup(apr_pool_t *p) apr_thread_mutex_create(&(lock_cs[i]), APR_THREAD_MUTEX_DEFAULT, p); } +#if OPENSSL_VERSION_NUMBER >= 0x10000000L + CRYPTO_THREADID_set_callback(ssl_util_thr_id); +#else CRYPTO_set_id_callback(ssl_util_thr_id); +#endif CRYPTO_set_locking_callback(ssl_util_thr_lock);