From 763d7a89de3fb8a00edece8f39b4cdd37ea616ed Mon Sep 17 00:00:00 2001 From: Stefan Berger Date: Thu, 20 Jun 2019 11:56:06 -0400 Subject: [PATCH] build-sys: Implement AX_CHECK_DEFINE and use for OpenSSL #define's Some of the functions that OpenSSL uses are #define's for which we need to check using a new AX_CHECK_DEFINE. We need to check for them also because they were added at different points in time. Signed-off-by: Stefan Berger --- configure.ac | 4 ++++ m4/ax_check_define.m4 | 31 +++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 m4/ax_check_define.m4 diff --git a/configure.ac b/configure.ac index 5721a150..444f6ed9 100644 --- a/configure.ac +++ b/configure.ac @@ -206,6 +206,10 @@ AS_IF([test "x$enable_use_openssl_functions" != "xno"], [ AC_CHECK_LIB([crypto], [EVP_PKEY_verify_init],, not_found=1) AC_CHECK_LIB([crypto], [EVP_PKEY_verify],, not_found=1) AC_CHECK_LIB([crypto], [EVP_get_digestbyname],, not_found=1) + AX_CHECK_DEFINE([], [EVP_PKEY_CTX_set0_rsa_oaep_label],, not_found=1) + AX_CHECK_DEFINE([], [EVP_PKEY_CTX_set_rsa_padding],, not_found=1) + AX_CHECK_DEFINE([], [EVP_PKEY_CTX_set_rsa_oaep_md],, not_found=1) + AX_CHECK_DEFINE([], [EVP_PKEY_CTX_set_signature_md],, not_found=1) if test "x$not_found" = "x0"; then use_openssl_functions_rsa=1 use_openssl_functions_for="${use_openssl_functions_for}RSA " diff --git a/m4/ax_check_define.m4 b/m4/ax_check_define.m4 new file mode 100644 index 00000000..398d475d --- /dev/null +++ b/m4/ax_check_define.m4 @@ -0,0 +1,31 @@ +# SYNOPSIS +# +# AX_CHECK_DEFINE(includefile, define, [ACTION-SUCCESS], [ACTION-FAILURE]) +# +# DESCRIPTION +# +# Check whether the given #define is available in the given #include file +# +# LICENSE +# +# See the root directory of the libtpms project for the LICENSE +# +AC_DEFUN([AX_CHECK_DEFINE], + [AC_PREREQ(2.64) + AC_MSG_CHECKING(whether $2 is defined in $1) + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#include $1]], + [[#ifndef $2 + #error $2 not defined + #endif]])], + [ + AC_MSG_RESULT([yes]) + [$3] + ], + [ + AC_MSG_RESULT([no]) + [$4] + ] + ) + ] +)