GUACAMOLE-205: Use semantically-named macro rather than repeatedly and explicitly check OpenSSL version.
This commit is contained in:
parent
98a5faaa77
commit
270d51d4d4
20
configure.ac
20
configure.ac
@ -261,6 +261,26 @@ then
|
||||
[Whether libssl provides RSA_get0_key()])],,
|
||||
[#include <openssl/rsa.h>])
|
||||
|
||||
# OpenSSL 1.1 does away with explicit threading callbacks
|
||||
AC_MSG_CHECKING([whether libssl requires threading callbacks])
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
||||
|
||||
#include <openssl/opensslv.h>
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
#error Threading callbacks required.
|
||||
#endif
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
]])],
|
||||
[AC_MSG_RESULT([no])],
|
||||
[AC_MSG_RESULT([yes])
|
||||
AC_DEFINE([OPENSSL_REQUIRES_THREADING_CALLBACKS],,
|
||||
[Whether OpenSSL requires explicit threading callbacks for threadsafety])])
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -45,7 +45,7 @@
|
||||
GCRY_THREAD_OPTION_PTHREAD_IMPL;
|
||||
#endif
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
#ifdef OPENSSL_REQUIRES_THREADING_CALLBACKS
|
||||
/**
|
||||
* Array of mutexes, used by OpenSSL.
|
||||
*/
|
||||
@ -147,7 +147,7 @@ int guac_common_ssh_init(guac_client* client) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
#ifdef OPENSSL_REQUIRES_THREADING_CALLBACKS
|
||||
/* Init threadsafety in OpenSSL */
|
||||
guac_common_ssh_openssl_init_locks(CRYPTO_num_locks());
|
||||
CRYPTO_set_id_callback(guac_common_ssh_openssl_id_callback);
|
||||
@ -167,7 +167,7 @@ int guac_common_ssh_init(guac_client* client) {
|
||||
}
|
||||
|
||||
void guac_common_ssh_uninit() {
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
#ifdef OPENSSL_REQUIRES_THREADING_CALLBACKS
|
||||
guac_common_ssh_openssl_free_locks(CRYPTO_num_locks());
|
||||
#endif
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ static int daemonize() {
|
||||
}
|
||||
|
||||
#ifdef ENABLE_SSL
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
#ifdef OPENSSL_REQUIRES_THREADING_CALLBACKS
|
||||
/**
|
||||
* Array of mutexes, used by OpenSSL.
|
||||
*/
|
||||
@ -361,7 +361,7 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
guacd_log(GUAC_LOG_INFO, "Communication will require SSL/TLS.");
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
#ifdef OPENSSL_REQUIRES_THREADING_CALLBACKS
|
||||
/* Init threadsafety in OpenSSL */
|
||||
guacd_openssl_init_locks(CRYPTO_num_locks());
|
||||
CRYPTO_set_id_callback(guacd_openssl_id_callback);
|
||||
@ -494,7 +494,7 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
#ifdef ENABLE_SSL
|
||||
if (ssl_context != NULL) {
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
#ifdef OPENSSL_REQUIRES_THREADING_CALLBACKS
|
||||
guacd_openssl_free_locks(CRYPTO_num_locks());
|
||||
#endif
|
||||
SSL_CTX_free(ssl_context);
|
||||
|
Loading…
Reference in New Issue
Block a user