Fix openssl dependancy

This commit is contained in:
Sara Dickinson 2015-08-15 16:35:30 +01:00
parent 2404cc2c8e
commit dc7d7e7689
4 changed files with 9 additions and 4 deletions

View File

@ -89,7 +89,7 @@ External dependencies are linked outside the getdns API build tree (we rely on c
* [libunbound from NLnet Labs](http://www.nlnetlabs.nl/projects/unbound/) version 1.4.16 or later * [libunbound from NLnet Labs](http://www.nlnetlabs.nl/projects/unbound/) version 1.4.16 or later
* [libexpat](http://expat.sourceforge.net/) for libunbound. * [libexpat](http://expat.sourceforge.net/) for libunbound.
* [libidn from the FSF](http://www.gnu.org/software/libidn/) version 1. * [libidn from the FSF](http://www.gnu.org/software/libidn/) version 1.
* [libopenssl from the OpenSSL Project](https://www.openssl.org/) version 0.9.7 or later. (Note: version 1.0.2 or later is required for TLS support) * [libssl from the OpenSSL Project](https://www.openssl.org/) version 0.9.7 or later. (Note: version 1.0.2 or later is required for TLS support)
* Doxygen is used to generate documentation, while this is not technically necessary for the build it makes things a lot more pleasant. * Doxygen is used to generate documentation, while this is not technically necessary for the build it makes things a lot more pleasant.
You have to install the library and also the library-devel (or -dev) for your You have to install the library and also the library-devel (or -dev) for your

View File

@ -105,8 +105,9 @@ AC_DEFUN([ACX_SSL_CHECKS], [
AC_CHECK_HEADERS([openssl/ssl.h],,, [AC_INCLUDES_DEFAULT]) AC_CHECK_HEADERS([openssl/ssl.h],,, [AC_INCLUDES_DEFAULT])
AC_CHECK_HEADERS([openssl/err.h],,, [AC_INCLUDES_DEFAULT]) AC_CHECK_HEADERS([openssl/err.h],,, [AC_INCLUDES_DEFAULT])
AC_CHECK_HEADERS([openssl/rand.h],,, [AC_INCLUDES_DEFAULT]) AC_CHECK_HEADERS([openssl/rand.h],,, [AC_INCLUDES_DEFAULT])
AC_CHECK_LIB(ssl, TLSv1_2_client_method,AC_DEFINE([HAVE_LIBTLS1_2], [1], dnl Authentication now requires 1.0.2, which supports TLSv1.2
[Define if you have libssl with tls 1.2]),[AC_MSG_WARN([Cannot find TLSv1_2_client_method in libssl library. TLS will not be available.])]) AC_CHECK_LIB(ssl, SSL_CTX_get0_param,AC_DEFINE([HAVE_LIBSSL_102], [1],
[Define if you have libssl 1.0.2 or later]),[AC_MSG_WARN([libssl 1.0.2 or higher is required for TLS authentication. TLS will not be available.])])
])dnl End of ACX_SSL_CHECKS ])dnl End of ACX_SSL_CHECKS
dnl Check for SSL, where SSL is mandatory dnl Check for SSL, where SSL is mandatory

View File

@ -2164,7 +2164,7 @@ getdns_context_prepare_for_resolution(struct getdns_context *context,
if (context->resolution_type == GETDNS_RESOLUTION_STUB) { if (context->resolution_type == GETDNS_RESOLUTION_STUB) {
if (tls_is_in_transports_list(context) == 1 && if (tls_is_in_transports_list(context) == 1 &&
context->tls_ctx == NULL) { context->tls_ctx == NULL) {
#ifdef HAVE_LIBTLS1_2 #ifdef HAVE_LIBSSL_102
/* Create client context, use TLS v1.2 only for now */ /* Create client context, use TLS v1.2 only for now */
context->tls_ctx = SSL_CTX_new(TLSv1_2_client_method()); context->tls_ctx = SSL_CTX_new(TLSv1_2_client_method());
#endif #endif

View File

@ -825,6 +825,7 @@ tls_failed(getdns_upstream *upstream)
static SSL* static SSL*
tls_create_object(getdns_context *context, int fd, const char* auth_name) tls_create_object(getdns_context *context, int fd, const char* auth_name)
{ {
#ifdef HAVE_LIBSSL_102
/* Create SSL instance */ /* Create SSL instance */
if (context->tls_ctx == NULL || auth_name == NULL) if (context->tls_ctx == NULL || auth_name == NULL)
return NULL; return NULL;
@ -845,6 +846,9 @@ tls_create_object(getdns_context *context, int fd, const char* auth_name)
SSL_set_connect_state(ssl); SSL_set_connect_state(ssl);
(void) SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY); (void) SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY);
return ssl; return ssl;
#else
return NULL;
#endif
} }
static int static int