aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRosen Penev <rosenp@gmail.com>2019-12-01 20:47:58 -0800
committerRosen Penev <rosenp@gmail.com>2019-12-08 14:50:31 -0800
commit5c015d1eb75fad60339c06fbb65fbfda0080c0ab (patch)
treef188357f582c6cc99801766c68326cc8edb6ff49
parentff321480a575e1c29c9b78ceca1d2e8c60ed6071 (diff)
opensc: Fix compilation without deprecated OpenSSL APIs
Based on upstream patch. Signed-off-by: Rosen Penev <rosenp@gmail.com>
-rw-r--r--utils/opensc/Makefile2
-rw-r--r--utils/opensc/patches/010-openssl-deprecated.patch34
2 files changed, 35 insertions, 1 deletions
diff --git a/utils/opensc/Makefile b/utils/opensc/Makefile
index 71231a384..754e7de07 100644
--- a/utils/opensc/Makefile
+++ b/utils/opensc/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=opensc
PKG_VERSION:=0.19.0
-PKG_RELEASE:=2
+PKG_RELEASE:=3
PKG_HASH:=2c5a0e4df9027635290b9c0f3addbbf0d651db5ddb0ab789cb0e978f02fd5826
PKG_LICENSE:=LGPL-2.1-or-later
diff --git a/utils/opensc/patches/010-openssl-deprecated.patch b/utils/opensc/patches/010-openssl-deprecated.patch
new file mode 100644
index 000000000..d58134c7f
--- /dev/null
+++ b/utils/opensc/patches/010-openssl-deprecated.patch
@@ -0,0 +1,34 @@
+--- a/src/libopensc/sc-ossl-compat.h
++++ b/src/libopensc/sc-ossl-compat.h
+@@ -76,6 +76,21 @@ extern "C" {
+ })
+ #endif /* OPENSSL_VERSION_NUMBER =< 0x00907000L */
+
++/*
++ * 1.1.0 depracated ERR_load_crypto_strings(), SSL_load_error_strings(), ERR_free_strings()
++ * and ENGINE_load_dynamic.EVP_CIPHER_CTX_cleanup and EVP_CIPHER_CTX_init are replaced
++ * by EVP_CIPHER_CTX_reset.
++ * But for compatability with LibreSSL and older OpenSSL. OpenSC uses the older functions
++ */
++#if OPENSSL_API_COMPAT >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
++#define ERR_load_crypto_strings(x) {}
++#define SSL_load_error_strings(x) {}
++#define ERR_free_strings(x) {}
++#define ENGINE_load_dynamic(x) {}
++#define EVP_CIPHER_CTX_cleanup(x) EVP_CIPHER_CTX_reset(x)
++#define EVP_CIPHER_CTX_init(x) EVP_CIPHER_CTX_reset(x)
++#endif
++
+ /*
+ * 1.1 renames RSA_PKCS1_SSLeay to RSA_PKCS1_OpenSSL
+ * use RSA_PKCS1_OpenSSL
+--- a/src/pkcs15init/pkcs15-oberthur-awp.c
++++ b/src/pkcs15init/pkcs15-oberthur-awp.c
+@@ -37,6 +37,7 @@
+ #include "libopensc/asn1.h"
+
+ #ifdef ENABLE_OPENSSL
++#include "libopensc/sc-ossl-compat.h"
+
+ struct awp_lv zero_lv = { 0, NULL };
+ struct awp_lv x30_lv = { 0x10, (unsigned char *)"0000000000000000" };