fix with new libressl functions, from jsing

This commit is contained in:
sthen 2018-02-18 10:35:31 +00:00
parent 0c5ee89466
commit 6284280dcc
2 changed files with 59 additions and 4 deletions

View File

@ -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}

View File

@ -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 */