From 6284280dcc30d3b85c1b3475ae04aacb536832e9 Mon Sep 17 00:00:00 2001 From: sthen Date: Sun, 18 Feb 2018 10:35:31 +0000 Subject: [PATCH] fix with new libressl functions, from jsing --- security/opensc/Makefile | 4 +- .../patch-src_libopensc_sc-ossl-compat_h | 59 ++++++++++++++++++- 2 files changed, 59 insertions(+), 4 deletions(-) diff --git a/security/opensc/Makefile b/security/opensc/Makefile index 6fd98adcf62..050e2410c0e 100644 --- a/security/opensc/Makefile +++ b/security/opensc/Makefile @@ -1,11 +1,11 @@ -# $OpenBSD: Makefile,v 1.44 2018/02/16 12:20:47 sthen Exp $ +# $OpenBSD: Makefile,v 1.45 2018/02/18 10:35:31 sthen Exp $ COMMENT= set of libraries and utilities to access smart cards VERSION= 0.17.0 DISTNAME= OpenSC-${VERSION} PKGNAME= opensc-${VERSION} -REVISION= 1 +REVISION= 2 GH_ACCOUNT= OpenSC GH_PROJECT= ${GH_ACCOUNT} GH_TAGNAME= ${VERSION} diff --git a/security/opensc/patches/patch-src_libopensc_sc-ossl-compat_h b/security/opensc/patches/patch-src_libopensc_sc-ossl-compat_h index 6d5d211773c..9a78c73fa9d 100644 --- a/security/opensc/patches/patch-src_libopensc_sc-ossl-compat_h +++ b/security/opensc/patches/patch-src_libopensc_sc-ossl-compat_h @@ -1,9 +1,16 @@ -$OpenBSD: patch-src_libopensc_sc-ossl-compat_h,v 1.1 2018/02/16 12:20:47 sthen Exp $ +$OpenBSD: patch-src_libopensc_sc-ossl-compat_h,v 1.2 2018/02/18 10:35:31 sthen Exp $ Index: src/libopensc/sc-ossl-compat.h --- src/libopensc/sc-ossl-compat.h.orig +++ src/libopensc/sc-ossl-compat.h -@@ -97,7 +97,9 @@ extern "C" { +@@ -92,12 +92,16 @@ extern "C" { + #define RSA_PKCS1_OpenSSL RSA_PKCS1_SSLeay + #define OPENSSL_malloc_init CRYPTO_malloc_init + ++#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x2070000fL + #define EVP_PKEY_get0_RSA(x) (x->pkey.rsa) + #define EVP_PKEY_get0_DSA(x) (x->pkey.dsa) ++#endif #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) @@ -13,3 +20,51 @@ Index: src/libopensc/sc-ossl-compat.h #if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x2050300fL #define X509_up_ref(cert) CRYPTO_add(&cert->references, 1, CRYPTO_LOCK_X509) #endif +@@ -142,6 +146,7 @@ extern "C" { + #endif + + #ifndef OPENSSL_NO_RSA ++#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x2070000fL + static sc_ossl_inline int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d) + { + /* d is the private component and may be NULL */ +@@ -157,6 +162,7 @@ static sc_ossl_inline int RSA_set0_key(RSA *r, BIGNUM + + return 1; + } ++#endif + + static sc_ossl_inline int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q) + { +@@ -186,6 +192,7 @@ static sc_ossl_inline int RSA_set0_crt_params(RSA *r, + return 1; + } + ++#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x2070000fL + static sc_ossl_inline void RSA_get0_key(const RSA *r, const BIGNUM **n, const BIGNUM **e, const BIGNUM **d) + { + if (n != NULL) +@@ -195,6 +202,7 @@ static sc_ossl_inline void RSA_get0_key(const RSA *r, + if (d != NULL) + *d = r->d; + } ++#endif + + static sc_ossl_inline void RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q) + { +@@ -218,6 +226,7 @@ static sc_ossl_inline void RSA_get0_crt_params(const R + #endif /* OPENSSL_NO_RSA */ + + #ifndef OPENSSL_NO_DSA ++#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x2070000fL + static sc_ossl_inline void DSA_get0_pqg(const DSA *d, const BIGNUM **p, const BIGNUM **q, const BIGNUM **g) + { + if (p != NULL) +@@ -235,6 +244,7 @@ static sc_ossl_inline void DSA_get0_key(const DSA *d, + if (priv_key != NULL) + *priv_key = d->priv_key; + } ++#endif + + /* NOTE: DSA_set0_* functions not defined because they are not currently used in OpenSC */ + #endif /* OPENSSL_NO_DSA */