From 17d10b0dfb2b56a047db307687640adcd560e199 Mon Sep 17 00:00:00 2001 From: Alon Bar-Lev Date: Mon, 2 May 2022 21:26:58 +0300 Subject: [PATCH] openssl: libressl-3.5.0 does not have DSA_meth_set1_name while it does not expose the DSA_METHOD structure. [Retrieved (and updated to remove ChangeLog update) from: https://github.com/OpenSC/pkcs11-helper/commit/17d10b0dfb2b56a047db307687640adcd560e199] Signed-off-by: Fabrice Fontaine --- ChangeLog | 1 + configure.ac | 16 ++++++++++++++++ lib/pkcs11h-openssl.c | 4 ++++ 3 files changed, 21 insertions(+) diff --git a/configure.ac b/configure.ac index 716bb8d8..57697a3b 100644 --- a/configure.ac +++ b/configure.ac @@ -300,7 +300,9 @@ if test "${have_openssl}" = "no"; then fi if test "${have_openssl}" = "yes"; then + old_CFLAGS="${CFLAGS}" old_LIBS="${LIBS}" + CFLAGS="${CFLAGS} ${OPENSSL_CFLAGS}" LIBS="${LIBS} ${OPENSSL_LIBS}" AC_CHECK_FUNCS([ \ RSA_meth_dup RSA_meth_free \ @@ -344,6 +346,20 @@ if test "${have_openssl}" = "yes"; then ) AC_MSG_CHECKING([for OpenSSL ec support]) AC_MSG_RESULT([${openssl_ec}]) + # https://github.com/OpenSC/pkcs11-helper/pull/55 + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include ]], + [[ + int foo() { + DSA_METHOD *meth = NULL; + sizeof(meth->name); + } + ]] + )], + [AC_DEFINE([HAVE_DSA_METHOD_NAME], [1], [Have DSA_METHOD->name])] + ) + CFLAGS="${old_CFLAGS}" LIBS="${old_LIBS}" fi diff --git a/lib/pkcs11h-openssl.c b/lib/pkcs11h-openssl.c index 961c955c..38ee8e2d 100644 --- a/lib/pkcs11h-openssl.c +++ b/lib/pkcs11h-openssl.c @@ -235,9 +235,13 @@ DSA_meth_free (DSA_METHOD *meth) static int DSA_meth_set1_name (DSA_METHOD *meth, const char *name) { +#ifdef HAVE_DSA_METHOD_NAME CK_RV rv; rv = _pkcs11h_mem_strdup ((void *)&meth->name, name); return rv == CKR_OK ? 1 : 0; +#else + return 0; +#endif } #endif