kumquat-buildroot/package/opensc/0003-Fix-build-with-libressl-3.5.0.patch
Fabrice Fontaine 8915beede6 package/opensc: fix build with libressl
Fix the following build failure with libressl raised since the addition
of the package in commit 8aaa7ecbce:

In file included from internal.h:45,
                 from card-authentic.c:32:
/nvmedata/autobuild/instance-29/output-1/host/powerpc64-buildroot-linux-gnu/sysroot/usr/include/openssl/x509v3.h:802:10: error: expected ')' before '*' token
  802 | uint32_t X509_get_extension_flags(X509 *x);
      |          ^~~~~~~~~~~~~~~~~~~~~~~~

Fixes:
 - http://autobuild.buildroot.org/results/7b50ab363c174636fb27d554223287d7496676ed

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Arnout Vandecappelle <arnout@mind.be>
2022-08-24 21:59:50 +02:00

48 lines
2.0 KiB
Diff

From d13059d1ec2bbb8fe7068db0d66d521daa4b71ce Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Date: Sat, 13 Aug 2022 14:27:22 +0200
Subject: [PATCH] Fix build with libressl >= 3.5.0
libressl added back FIPS_mode since version 3.5.0 and
https://github.com/libressl-portable/openbsd/commit/a97eabc90d7647e374c1c6da686aeec63c49ff14
libressl provides X509_get_extension_flags since version 3.5.0 and
https://github.com/libressl-portable/openbsd/commit/3180723224c1b2c7856a110b8213e4966995d7e0
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
[Upstream status: https://github.com/OpenSC/OpenSC/pull/2593 &
https://github.com/OpenSC/OpenSC/pull/2595 (merged)]
---
src/libopensc/sc-ossl-compat.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/libopensc/sc-ossl-compat.h b/src/libopensc/sc-ossl-compat.h
index f0d55279..2c42794c 100644
--- a/src/libopensc/sc-ossl-compat.h
+++ b/src/libopensc/sc-ossl-compat.h
@@ -86,9 +86,11 @@ extern "C" {
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
#define RSA_PKCS1_OpenSSL RSA_PKCS1_SSLeay
+#if defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x30500000L
#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)
+#endif
#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x2050300fL
#define X509_up_ref(cert) CRYPTO_add(&cert->references, 1, CRYPTO_LOCK_X509)
#endif
@@ -104,7 +106,9 @@ extern "C" {
/* workaround unused value warning for a macro that does nothing */
#if defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x20700000L
#define OPENSSL_malloc_init()
+#if LIBRESSL_VERSION_NUMBER < 0x30500000L
#define FIPS_mode() (0)
+#endif
#define EVP_sha3_224() (NULL)
#define EVP_sha3_256() (NULL)
#define EVP_sha3_384() (NULL)
--
2.35.1