forked from gentoo/gentoo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
2 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
From 226cd96bfd384a40b3ab6b6dafb97f6e399524f4 Mon Sep 17 00:00:00 2001 | ||
From: Alon Bar-Lev <[email protected]> | ||
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters