[Buildroot] [PATCH 1/1] package/pkcs11-helper: fix build with libressl >= 3.5.0
Fabrice Fontaine
fontaine.fabrice at gmail.com
Thu May 5 21:01:51 UTC 2022
Fix the following build failure with libressl raised since bump to
version 3.5.2 in commit 8b216927db080b38fdbf1f8b025b6f90a89d4bc2:
pkcs11h-openssl.c: In function 'DSA_meth_set1_name':
pkcs11h-openssl.c:239:41: error: invalid use of incomplete typedef 'DSA_METHOD' {aka 'struct dsa_method'}
239 | rv = _pkcs11h_mem_strdup ((void *)&meth->name, name);
| ^~
Fixes:
- http://autobuild.buildroot.org/results/9b0d3bf7d97696c7be6de1724daaba196626b865
Signed-off-by: Fabrice Fontaine <fontaine.fabrice at gmail.com>
---
...5-0-does-not-have-DSA_meth_set1_name.patch | 69 +++++++++++++++++++
package/pkcs11-helper/pkcs11-helper.mk | 2 +
2 files changed, 71 insertions(+)
create mode 100644 package/pkcs11-helper/0002-openssl-libressl-3-5-0-does-not-have-DSA_meth_set1_name.patch
diff --git a/package/pkcs11-helper/0002-openssl-libressl-3-5-0-does-not-have-DSA_meth_set1_name.patch b/package/pkcs11-helper/0002-openssl-libressl-3-5-0-does-not-have-DSA_meth_set1_name.patch
new file mode 100644
index 0000000000..21ce66ae79
--- /dev/null
+++ b/package/pkcs11-helper/0002-openssl-libressl-3-5-0-does-not-have-DSA_meth_set1_name.patch
@@ -0,0 +1,69 @@
+From 17d10b0dfb2b56a047db307687640adcd560e199 Mon Sep 17 00:00:00 2001
+From: Alon Bar-Lev <alon.barlev at gmail.com>
+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 <fontaine.fabrice at gmail.com>
+---
+ 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 <openssl/dsa.h>]],
++ [[
++ 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
+
diff --git a/package/pkcs11-helper/pkcs11-helper.mk b/package/pkcs11-helper/pkcs11-helper.mk
index 4fc3e21e5a..f8fe54ecf5 100644
--- a/package/pkcs11-helper/pkcs11-helper.mk
+++ b/package/pkcs11-helper/pkcs11-helper.mk
@@ -11,6 +11,8 @@ PKCS11_HELPER_LICENSE = GPL-2.0 or BSD-3-Clause
PKCS11_HELPER_LICENSE_FILES = COPYING COPYING.BSD COPYING.GPL
PKCS11_HELPER_DEPENDENCIES = host-pkgconf
PKCS11_HELPER_INSTALL_STAGING = YES
+# We're patching configure.ac
+PKCS11_HELPER_AUTORECONF = YES
PKCS11_HELPER_CONF_OPTS = \
--disable-crypto-engine-polarssl \
--
2.35.1
More information about the buildroot
mailing list