From 08c628b240bc7b81b6abfcafa6bf147e2187e4d9 Mon Sep 17 00:00:00 2001 From: Viktor Dukhovni Date: Wed, 4 Mar 2015 19:49:40 -0500 Subject: [PATCH] BN_is_negative is no longer a macro in OpenSSL master --- cf/crypto.m4 | 17 +++++++++++++++++ include/crypto-headers.h | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/cf/crypto.m4 b/cf/crypto.m4 index da0778817..370068b4d 100644 --- a/cf/crypto.m4 +++ b/cf/crypto.m4 @@ -63,6 +63,20 @@ m4_define([test_body], [ DES_cbc_encrypt(0, 0, 0, schedule, 0, 0); RC4(0, 0, 0, 0);]) +m4_define([bn_headers], [ + #include + #include + ]) +m4_define([bn_body], [ + BIGNUM *bn = BN_new(); + BN_set_word(bn, 1); + if (BN_is_negative(bn)) + exit(EXIT_FAILURE); + BN_set_negative(bn, 1); + if (!BN_is_negative(bn)) + exit(EXIT_FAILURE); + exit(EXIT_SUCCESS); + ]) AC_DEFUN([KRB_CRYPTO],[ crypto_lib=unknown @@ -96,6 +110,9 @@ if test "$crypto_lib" = "unknown" -a "$with_openssl" != "no"; then AC_LINK_IFELSE([AC_LANG_PROGRAM([test_headers],[test_body])], [ crypto_lib=libcrypto openssl=yes AC_MSG_RESULT([libcrypto]) + AC_RUN_IFELSE([AC_LANG_PROGRAM([bn_headers],[bn_body])], [ + AC_DEFINE([HAVE_BN_IS_NEGATIVE], 1, [define if OpenSSL provides BN_is_negative]) + ]) ]) if test "$crypto_lib" = libcrypto ; then break; diff --git a/include/crypto-headers.h b/include/crypto-headers.h index ed2f5b8f2..d69505455 100644 --- a/include/crypto-headers.h +++ b/include/crypto-headers.h @@ -29,7 +29,7 @@ #include #include #include -#ifndef BN_is_negative +#ifndef HAVE_BN_IS_NEGATIVE #define BN_set_negative(bn, flag) ((bn)->neg=(flag)?1:0) #define BN_is_negative(bn) ((bn)->neg != 0) #endif