From 2a4c374451d50e240872cc9907b69c2d2464f2cc Mon Sep 17 00:00:00 2001 From: Pieter Lexis Date: Thu, 29 Dec 2016 18:01:30 +0100 Subject: [PATCH] Check in the detected OpenSSL/libcrypto for ECDSA We used to 'just' use the default includes for this detection. Fixes #4680 --- m4/pdns_check_libcrypto.m4 | 1 + m4/pdns_check_libcrypto_ecdsa.m4 | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/m4/pdns_check_libcrypto.m4 b/m4/pdns_check_libcrypto.m4 index 9f495b42ed..c9034cf5a2 100644 --- a/m4/pdns_check_libcrypto.m4 +++ b/m4/pdns_check_libcrypto.m4 @@ -54,6 +54,7 @@ AC_DEFUN([PDNS_CHECK_LIBCRYPTO], [ if test $? = 0; then LIBCRYPTO_LIBS=`$PKG_CONFIG libcrypto --libs-only-l 2>/dev/null` LIBCRYPTO_INCLUDES=`$PKG_CONFIG libcrypto --cflags-only-I 2>/dev/null` + ssldir=`$PKG_CONFIG libcrypto --variable=prefix 2>/dev/null` found=true fi fi diff --git a/m4/pdns_check_libcrypto_ecdsa.m4 b/m4/pdns_check_libcrypto_ecdsa.m4 index 7c2c48ad67..8720a63966 100644 --- a/m4/pdns_check_libcrypto_ecdsa.m4 +++ b/m4/pdns_check_libcrypto_ecdsa.m4 @@ -1,11 +1,22 @@ AC_DEFUN([PDNS_CHECK_LIBCRYPTO_ECDSA], [ AC_REQUIRE([PDNS_CHECK_LIBCRYPTO]) + + # Set the environment correctly for a possibly non-default OpenSSL path that was found by/supplied to PDNS_CHECK_LIBCRYPTO + save_CPPFLAGS="$CPPFLAGS" + save_LDFLAGS="$LDFLAGS" + save_LIBS="$LIBS" + + CPPFLAGS="$LIBCRYPTO_INCLUDES $CPPFLAGS" + LDFLAGS="$LIBCRYPTO_LDFLAGS $LDFLAGS" + LIBS="$LIBCRYPTO_LIBS $LIBS" + + # Find the headers we need for ECDSA libcrypto_ecdsa=yes - AC_CHECK_HEADER([openssl/ecdsa.h], [ + AC_CHECK_HEADER([$ssldir/include/openssl/ecdsa.h], [ AC_CHECK_DECLS([NID_X9_62_prime256v1, NID_secp384r1], [ : ], [ libcrypto_ecdsa=no ], [AC_INCLUDES_DEFAULT -#include +#include <$ssldir/include/openssl/evp.h> ]) ], [ libcrypto_ecdsa=no @@ -14,4 +25,9 @@ AC_DEFUN([PDNS_CHECK_LIBCRYPTO_ECDSA], [ AS_IF([test "x$libcrypto_ecdsa" = "xyes"], [ AC_DEFINE([HAVE_LIBCRYPTO_ECDSA], [1], [define to 1 if OpenSSL ecdsa support is available.]) ]) + + # Restore variables + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" ]) -- 2.47.2