Gentoo Archives: gentoo-commits

From: Alon Bar-Lev <alonbl@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/opensc/files/, dev-libs/opensc/
Date: Thu, 28 Jun 2018 07:53:33
Message-Id: 1530172385.37cd06c918995921e9deaf912d9474733896934a.alonbl@gentoo
1 commit: 37cd06c918995921e9deaf912d9474733896934a
2 Author: Alon Bar-Lev <alonbl <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jun 22 19:38:08 2018 +0000
4 Commit: Alon Bar-Lev <alonbl <AT> gentoo <DOT> org>
5 CommitDate: Thu Jun 28 07:53:05 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=37cd06c9
7
8 dev-libs/opensc: fix libressl-2.7 build
9
10 Closes: https://bugs.gentoo.org/show_bug.cgi?id=658212
11 Thanks: Tom Li
12 Package-Manager: Portage-2.3.40, Repoman-2.3.9
13
14 dev-libs/opensc/files/opensc-0.18.0-libressl.patch | 79 ++++++++++++++++++++++
15 dev-libs/opensc/opensc-0.18.0.ebuild | 1 +
16 2 files changed, 80 insertions(+)
17
18 diff --git a/dev-libs/opensc/files/opensc-0.18.0-libressl.patch b/dev-libs/opensc/files/opensc-0.18.0-libressl.patch
19 new file mode 100644
20 index 00000000000..f6f3d772e07
21 --- /dev/null
22 +++ b/dev-libs/opensc/files/opensc-0.18.0-libressl.patch
23 @@ -0,0 +1,79 @@
24 +From 226cd96bfd384a40b3ab6b6dafb97f6e399524f4 Mon Sep 17 00:00:00 2001
25 +From: Alon Bar-Lev <alon.barlev@×××××.com>
26 +Date: Fri, 22 Jun 2018 22:21:03 +0300
27 +Subject: [PATCH] build: support >=libressl-2.7
28 +
29 +https://github.com/OpenSC/OpenSC/pull/1406
30 +
31 +---
32 + src/libopensc/sc-ossl-compat.h | 19 +++++++++++++------
33 + src/tools/sc-hsm-tool.c | 2 +-
34 + 2 files changed, 14 insertions(+), 7 deletions(-)
35 +
36 +diff --git a/src/libopensc/sc-ossl-compat.h b/src/libopensc/sc-ossl-compat.h
37 +index a94d9564..d9e087a3 100644
38 +--- a/src/libopensc/sc-ossl-compat.h
39 ++++ b/src/libopensc/sc-ossl-compat.h
40 +@@ -90,17 +90,24 @@ extern "C" {
41 +
42 + #if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
43 + #define RSA_PKCS1_OpenSSL RSA_PKCS1_SSLeay
44 +-#define OPENSSL_malloc_init CRYPTO_malloc_init
45 +
46 +-#define EVP_PKEY_get0_RSA(x) (x->pkey.rsa)
47 +-#define EVP_PKEY_get0_DSA(x) (x->pkey.dsa)
48 + #define X509_get_extension_flags(x) (x->ex_flags)
49 + #define X509_get_key_usage(x) (x->ex_kusage)
50 + #define X509_get_extended_key_usage(x) (x->ex_xkusage)
51 +-#define EVP_PKEY_up_ref(user_key) CRYPTO_add(&user_key->references, 1, CRYPTO_LOCK_EVP_PKEY)
52 + #if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x2050300fL
53 + #define X509_up_ref(cert) CRYPTO_add(&cert->references, 1, CRYPTO_LOCK_X509)
54 + #endif
55 ++#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x20700000L
56 ++#define OPENSSL_malloc_init CRYPTO_malloc_init
57 ++#define EVP_PKEY_get0_RSA(x) (x->pkey.rsa)
58 ++#define EVP_PKEY_get0_DSA(x) (x->pkey.dsa)
59 ++#define EVP_PKEY_up_ref(user_key) CRYPTO_add(&user_key->references, 1, CRYPTO_LOCK_EVP_PKEY)
60 ++#endif
61 ++#endif
62 ++
63 ++/* workaround unused value warning for a macro that does nothing */
64 ++#if defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x20700000L
65 ++#define OPENSSL_malloc_init()
66 + #endif
67 +
68 + /*
69 +@@ -110,7 +117,7 @@ extern "C" {
70 + * If that is not good enough, versions could be added to libopensc
71 + */
72 +
73 +-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
74 ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L)
75 + /* based on OpenSSL-1.1.0 e_os2.h */
76 + /* sc_ossl_inline: portable inline definition usable in public headers */
77 + # if !defined(inline) && !defined(__cplusplus)
78 +@@ -129,7 +136,7 @@ extern "C" {
79 + # endif
80 + #endif
81 +
82 +-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
83 ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x2050300fL)
84 +
85 + #define RSA_bits(R) (BN_num_bits(R->n))
86 +
87 +diff --git a/src/tools/sc-hsm-tool.c b/src/tools/sc-hsm-tool.c
88 +index 823eb217..307bad25 100644
89 +--- a/src/tools/sc-hsm-tool.c
90 ++++ b/src/tools/sc-hsm-tool.c
91 +@@ -1761,7 +1761,7 @@ int main(int argc, char *argv[])
92 + }
93 + }
94 +
95 +-#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !(defined LIBRESSL_VERSION_NUMBER)
96 ++#if OPENSSL_VERSION_NUMBER >= 0x10100000L || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x20700000L)
97 + OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS
98 + | OPENSSL_INIT_ADD_ALL_CIPHERS
99 + | OPENSSL_INIT_ADD_ALL_DIGESTS,
100 +--
101 +2.16.4
102 +
103
104 diff --git a/dev-libs/opensc/opensc-0.18.0.ebuild b/dev-libs/opensc/opensc-0.18.0.ebuild
105 index 9693228d0a4..784b2c5735c 100644
106 --- a/dev-libs/opensc/opensc-0.18.0.ebuild
107 +++ b/dev-libs/opensc/opensc-0.18.0.ebuild
108 @@ -35,6 +35,7 @@ REQUIRED_USE="
109
110 PATCHES=(
111 "${FILESDIR}/${P}-build.patch"
112 + "${FILESDIR}/${P}-libressl.patch"
113 )
114
115 src_configure() {