summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Bar-Lev <alonbl@gentoo.org>2018-06-22 22:38:08 +0300
committerAlon Bar-Lev <alonbl@gentoo.org>2018-06-28 10:53:05 +0300
commit37cd06c918995921e9deaf912d9474733896934a (patch)
tree54411e6b5b992a4fe0a3bcaf607cc0a8ecb1452f /dev-libs
parentdev-python/websocket-client: marked ~x64-macos (diff)
downloadgentoo-37cd06c918995921e9deaf912d9474733896934a.tar.gz
gentoo-37cd06c918995921e9deaf912d9474733896934a.tar.bz2
gentoo-37cd06c918995921e9deaf912d9474733896934a.zip
dev-libs/opensc: fix libressl-2.7 build
Closes: https://bugs.gentoo.org/show_bug.cgi?id=658212 Thanks: Tom Li Package-Manager: Portage-2.3.40, Repoman-2.3.9
Diffstat (limited to 'dev-libs')
-rw-r--r--dev-libs/opensc/files/opensc-0.18.0-libressl.patch79
-rw-r--r--dev-libs/opensc/opensc-0.18.0.ebuild1
2 files changed, 80 insertions, 0 deletions
diff --git a/dev-libs/opensc/files/opensc-0.18.0-libressl.patch b/dev-libs/opensc/files/opensc-0.18.0-libressl.patch
new file mode 100644
index 00000000000..f6f3d772e07
--- /dev/null
+++ b/dev-libs/opensc/files/opensc-0.18.0-libressl.patch
@@ -0,0 +1,79 @@
+From 226cd96bfd384a40b3ab6b6dafb97f6e399524f4 Mon Sep 17 00:00:00 2001
+From: Alon Bar-Lev <alon.barlev@gmail.com>
+Date: Fri, 22 Jun 2018 22:21:03 +0300
+Subject: [PATCH] build: support >=libressl-2.7
+
+https://github.com/OpenSC/OpenSC/pull/1406
+
+---
+ src/libopensc/sc-ossl-compat.h | 19 +++++++++++++------
+ src/tools/sc-hsm-tool.c | 2 +-
+ 2 files changed, 14 insertions(+), 7 deletions(-)
+
+diff --git a/src/libopensc/sc-ossl-compat.h b/src/libopensc/sc-ossl-compat.h
+index a94d9564..d9e087a3 100644
+--- a/src/libopensc/sc-ossl-compat.h
++++ b/src/libopensc/sc-ossl-compat.h
+@@ -90,17 +90,24 @@ extern "C" {
+
+ #if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+ #define RSA_PKCS1_OpenSSL RSA_PKCS1_SSLeay
+-#define OPENSSL_malloc_init CRYPTO_malloc_init
+
+-#define EVP_PKEY_get0_RSA(x) (x->pkey.rsa)
+-#define EVP_PKEY_get0_DSA(x) (x->pkey.dsa)
+ #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_PKEY_up_ref(user_key) CRYPTO_add(&user_key->references, 1, CRYPTO_LOCK_EVP_PKEY)
+ #if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x2050300fL
+ #define X509_up_ref(cert) CRYPTO_add(&cert->references, 1, CRYPTO_LOCK_X509)
+ #endif
++#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x20700000L
++#define OPENSSL_malloc_init CRYPTO_malloc_init
++#define EVP_PKEY_get0_RSA(x) (x->pkey.rsa)
++#define EVP_PKEY_get0_DSA(x) (x->pkey.dsa)
++#define EVP_PKEY_up_ref(user_key) CRYPTO_add(&user_key->references, 1, CRYPTO_LOCK_EVP_PKEY)
++#endif
++#endif
++
++/* workaround unused value warning for a macro that does nothing */
++#if defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x20700000L
++#define OPENSSL_malloc_init()
+ #endif
+
+ /*
+@@ -110,7 +117,7 @@ extern "C" {
+ * If that is not good enough, versions could be added to libopensc
+ */
+
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L)
+ /* based on OpenSSL-1.1.0 e_os2.h */
+ /* sc_ossl_inline: portable inline definition usable in public headers */
+ # if !defined(inline) && !defined(__cplusplus)
+@@ -129,7 +136,7 @@ extern "C" {
+ # endif
+ #endif
+
+-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
++#if OPENSSL_VERSION_NUMBER < 0x10100000L || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x2050300fL)
+
+ #define RSA_bits(R) (BN_num_bits(R->n))
+
+diff --git a/src/tools/sc-hsm-tool.c b/src/tools/sc-hsm-tool.c
+index 823eb217..307bad25 100644
+--- a/src/tools/sc-hsm-tool.c
++++ b/src/tools/sc-hsm-tool.c
+@@ -1761,7 +1761,7 @@ int main(int argc, char *argv[])
+ }
+ }
+
+-#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !(defined LIBRESSL_VERSION_NUMBER)
++#if OPENSSL_VERSION_NUMBER >= 0x10100000L || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x20700000L)
+ OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS
+ | OPENSSL_INIT_ADD_ALL_CIPHERS
+ | OPENSSL_INIT_ADD_ALL_DIGESTS,
+--
+2.16.4
+
diff --git a/dev-libs/opensc/opensc-0.18.0.ebuild b/dev-libs/opensc/opensc-0.18.0.ebuild
index 9693228d0a4..784b2c5735c 100644
--- a/dev-libs/opensc/opensc-0.18.0.ebuild
+++ b/dev-libs/opensc/opensc-0.18.0.ebuild
@@ -35,6 +35,7 @@ REQUIRED_USE="
PATCHES=(
"${FILESDIR}/${P}-build.patch"
+ "${FILESDIR}/${P}-libressl.patch"
)
src_configure() {