[Buildroot] [PATCH 2/2] package/opensc: fix build with newer versions of LibreSSL

Bernd Kuhls bernd at kuhls.net
Sat Jun 24 08:50:50 UTC 2023


Fixes:
http://autobuild.buildroot.net/results/913/91318abb98146dd967115ed6233949daa60d8bba/

This patch adds two patches added after the release of 0.23.0 so this
patch depends on the version bump included in this series.

Signed-off-by: Bernd Kuhls <bernd at kuhls.net>
---
 ...ed-compatibility-with-LibreSSL-3.5.0.patch | 54 +++++++++++++++++++
 ...ed-compatibility-with-LibreSSL-3.7.0.patch | 28 ++++++++++
 2 files changed, 82 insertions(+)
 create mode 100644 package/opensc/0001-fixed-compatibility-with-LibreSSL-3.5.0.patch
 create mode 100644 package/opensc/0001-fixed-compatibility-with-LibreSSL-3.7.0.patch

diff --git a/package/opensc/0001-fixed-compatibility-with-LibreSSL-3.5.0.patch b/package/opensc/0001-fixed-compatibility-with-LibreSSL-3.5.0.patch
new file mode 100644
index 0000000000..0daf75d5ba
--- /dev/null
+++ b/package/opensc/0001-fixed-compatibility-with-LibreSSL-3.5.0.patch
@@ -0,0 +1,54 @@
+From da01e5fab9be9865db1aac203e574e0edbfd6584 Mon Sep 17 00:00:00 2001
+From: Frank Morgner <frankmorgner at gmail.com>
+Date: Wed, 14 Dec 2022 09:31:29 +0100
+Subject: [PATCH] fixed compatibility with LibreSSL >= 3.5.0
+
+fixes https://github.com/OpenSC/OpenSC/issues/2664
+
+Upstream: https://github.com/OpenSC/OpenSC/commit/da01e5fab9be9865db1aac203e574e0edbfd6584
+
+Signed-off-by: Bernd Kuhls <bernd at kuhls.net>
+---
+ src/libopensc/card-iasecc.c    | 12 +-----------
+ src/libopensc/sc-ossl-compat.h |  1 +
+ 2 files changed, 2 insertions(+), 11 deletions(-)
+
+diff --git a/src/libopensc/card-iasecc.c b/src/libopensc/card-iasecc.c
+index 480c1cf87b..1347ed2393 100644
+--- a/src/libopensc/card-iasecc.c
++++ b/src/libopensc/card-iasecc.c
+@@ -38,21 +38,11 @@
+ #include <openssl/pkcs12.h>
+ #include <openssl/x509v3.h>
+ 
+-/*
+- * OpenSSL-3.0.0 does not allow access to the SHA data
+- * so this driver can not produces signatures
+- * OpenSSL 1.1.1 uses EVP_MD_CTX_md_data
+- * LibreSSL
+- */
+-
+-#if defined(LIBRESSL_VERSION_NUMBER)
+-# define  EVP_MD_CTX_md_data(x)  (x->md_data)
+-#endif
+-
+ #include "internal.h"
+ #include "asn1.h"
+ #include "cardctl.h"
+ #include "opensc.h"
++#include "sc-ossl-compat.h"
+ /* #include "sm.h" */
+ #include "pkcs15.h"
+ /* #include "hash-strings.h" */
+diff --git a/src/libopensc/sc-ossl-compat.h b/src/libopensc/sc-ossl-compat.h
+index da53ca8cee..8c0f96701c 100644
+--- a/src/libopensc/sc-ossl-compat.h
++++ b/src/libopensc/sc-ossl-compat.h
+@@ -42,6 +42,7 @@ extern "C" {
+ #define X509_get_extension_flags(x)	(x->ex_flags)
+ #define X509_get_key_usage(x)		(x->ex_kusage)
+ #define X509_get_extended_key_usage(x)	(x->ex_xkusage)
++#define EVP_MD_CTX_md_data(x)          (x->md_data)
+ #endif
+ 
+ #if defined(LIBRESSL_VERSION_NUMBER)
diff --git a/package/opensc/0001-fixed-compatibility-with-LibreSSL-3.7.0.patch b/package/opensc/0001-fixed-compatibility-with-LibreSSL-3.7.0.patch
new file mode 100644
index 0000000000..6bbbea6ce6
--- /dev/null
+++ b/package/opensc/0001-fixed-compatibility-with-LibreSSL-3.7.0.patch
@@ -0,0 +1,28 @@
+From 98ad0f93b0a7673cdce82e1b3faa7dc314c64dd6 Mon Sep 17 00:00:00 2001
+From: Frank Morgner <frankmorgner at gmail.com>
+Date: Fri, 16 Dec 2022 11:56:28 +0100
+Subject: [PATCH] fixed compatibility with LibreSSL 3.7.0
+
+Upstream: https://github.com/OpenSC/OpenSC/commit/98ad0f93b0a7673cdce82e1b3faa7dc314c64dd6
+
+Signed-off-by: Bernd Kuhls <bernd at kuhls.net>
+---
+ src/libopensc/sc-ossl-compat.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/libopensc/sc-ossl-compat.h b/src/libopensc/sc-ossl-compat.h
+index 8c0f96701c..4425da93f3 100644
+--- a/src/libopensc/sc-ossl-compat.h
++++ b/src/libopensc/sc-ossl-compat.h
+@@ -54,9 +54,11 @@ extern "C" {
+ #define EVP_sha3_256()                          (NULL)
+ #define EVP_sha3_384()                          (NULL)
+ #define EVP_sha3_512()                          (NULL)
++#if LIBRESSL_VERSION_NUMBER < 0x3070000fL
+ #define EVP_PKEY_new_raw_public_key(t, e, p, l) (NULL)
+ #define EVP_PKEY_get_raw_public_key(p, pu, l)   (0)
+ #endif
++#endif
+ 
+ /* OpenSSL 1.1.1 has FIPS_mode function */
+ #if OPENSSL_VERSION_NUMBER >= 0x30000000L
-- 
2.39.2




More information about the buildroot mailing list