This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/tomcat-native.git
commit 82a29490f2ab9cefa444445fe23d0ebfe65c0a53 Author: Mark Thomas <ma...@apache.org> AuthorDate: Thu Aug 20 11:04:19 2020 +0100 Fiz BZ 64429 - compilation with LibreSSL https://bz.apache.org/bugzilla/show_bug.cgi?id=64429 --- native/include/ssl_private.h | 2 +- native/src/ssl.c | 18 +++++++++--------- xdocs/miscellaneous/changelog.xml | 3 +++ 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/native/include/ssl_private.h b/native/include/ssl_private.h index 125d6b7..b50bf24 100644 --- a/native/include/ssl_private.h +++ b/native/include/ssl_private.h @@ -397,7 +397,7 @@ int SSL_callback_alpn_select_proto(SSL *, const unsigned char **, unsign void SSL_callback_add_keylog(SSL_CTX *); #endif -#if (OPENSSL_VERSION_NUMBER < 0x10100000L) && ! (defined(WIN32) || defined(WIN64)) +#if (OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)) && ! (defined(WIN32) || defined(WIN64)) unsigned long SSL_ERR_get(void); void SSL_ERR_clear(void); #else diff --git a/native/src/ssl.c b/native/src/ssl.c index 98d77eb..985b61a 100644 --- a/native/src/ssl.c +++ b/native/src/ssl.c @@ -46,7 +46,7 @@ static void ssl_keylog_callback(const SSL *ssl, const char *line) static jclass byteArrayClass; static jclass stringClass; -#if OPENSSL_VERSION_NUMBER < 0x10100000L +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) /* Global reference to the pool used by the dynamic mutexes */ static apr_pool_t *dynlockpool = NULL; @@ -349,7 +349,7 @@ static apr_status_t ssl_init_cleanup(void *data) return APR_SUCCESS; ssl_initialized = 0; -#if OPENSSL_VERSION_NUMBER < 0x10100000L && ! (defined(WIN32) || defined(WIN64)) +#if (OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)) && ! (defined(WIN32) || defined(WIN64)) if (threadkey_initialized) { threadkey_initialized = 0; apr_threadkey_private_delete(thread_exit_key); @@ -435,7 +435,7 @@ static ENGINE *ssl_try_load_engine(const char *engine) * To ensure thread-safetyness in OpenSSL */ -#if OPENSSL_VERSION_NUMBER < 0x10100000L +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) static apr_thread_mutex_t **ssl_lock_cs; static int ssl_lock_num_locks; @@ -460,7 +460,7 @@ static unsigned long ssl_thread_id(void) return (unsigned long)tcn_get_thread_id(); } -#if OPENSSL_VERSION_NUMBER < 0x10100000L +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) #if ! (defined(WIN32) || defined(WIN64)) void SSL_thread_exit(void) { ERR_remove_thread_state(NULL); @@ -1310,7 +1310,7 @@ static apr_status_t ssl_con_pool_cleanup(void *data) int *destroyCount; TCN_ASSERT(ssl != 0); - + destroyCount = SSL_get_app_data4(ssl); if (destroyCount != NULL) { ++(*destroyCount); @@ -1332,7 +1332,7 @@ TCN_IMPLEMENT_CALL(jlong /* SSL * */, SSL, newSSL)(TCN_STDARGS, UNREFERENCED_STDARGS; TCN_ASSERT(ctx != 0); - + ssl = SSL_new(c->ctx); if (ssl == NULL) { free(handshakeCount); @@ -1340,7 +1340,7 @@ TCN_IMPLEMENT_CALL(jlong /* SSL * */, SSL, newSSL)(TCN_STDARGS, tcn_ThrowException(e, "cannot create new ssl"); return 0; } - + apr_pool_create(&p, c->pool); if (p == NULL) { free(handshakeCount); @@ -1349,7 +1349,7 @@ TCN_IMPLEMENT_CALL(jlong /* SSL * */, SSL, newSSL)(TCN_STDARGS, tcn_ThrowAPRException(e, apr_get_os_error()); return 0; } - + if ((con = apr_pcalloc(p, sizeof(tcn_ssl_conn_t))) == NULL) { free(handshakeCount); free(destroyCount); @@ -1391,7 +1391,7 @@ TCN_IMPLEMENT_CALL(jlong /* SSL * */, SSL, newSSL)(TCN_STDARGS, apr_pool_cleanup_register(con->pool, (const void *)ssl, ssl_con_pool_cleanup, apr_pool_cleanup_null); - + return P2J(ssl); } diff --git a/xdocs/miscellaneous/changelog.xml b/xdocs/miscellaneous/changelog.xml index a6690b9..a59df09 100644 --- a/xdocs/miscellaneous/changelog.xml +++ b/xdocs/miscellaneous/changelog.xml @@ -61,6 +61,9 @@ if OCSP is enabled, a missing responder is now treated as an error. (jfclere) </add> + <fix> + <bug>64429</bug>: Fix compilation with LibreSSL. (markt) + </fix> </changelog> </section> <section name="Changes in 1.2.24"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org