From 47a65ecd166526bbc43c86cb38c743e84b050eec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Thu, 27 Oct 2016 12:16:29 +0200
Subject: [PATCH] Fix STACK_OF(OPENSSL_STRING) conflicts with OpenSSL 1.1.0
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Since OpenSSL 1.1.0, STACK_OF(OPENSSL_STRING) defines
sk_OPENSSL_STRING_num() and other accessors as a functions, not
macros. Thus the #ifndef sk_OPENSSL_STRING_num incorrectly redefined
them and caused fatal warnings about incompatible types.
This patch redefines the accessors only with OpenSSL older than 1.1.0.
<https://github.com/dsully/perl-crypt-openssl-x509/issues/53>
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
X509.xs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/X509.xs b/X509.xs
index 9d11f03..a08ed81 100644
--- a/X509.xs
+++ b/X509.xs
@@ -35,6 +35,9 @@ typedef X509_NAME_ENTRY* Crypt__OpenSSL__X509__Name_Entry;
typedef X509_CRL* Crypt__OpenSSL__X509__CRL;
/* 1.0 backwards compat */
+#if OPENSSL_VERSION_NUMBER < 0x10100000
+#define const_ossl11
+
#ifndef sk_OPENSSL_STRING_num
#define sk_OPENSSL_STRING_num sk_num
#endif
@@ -43,9 +46,6 @@ typedef X509_CRL* Crypt__OpenSSL__X509__CRL;
#define sk_OPENSSL_STRING_value sk_value
#endif
-#if OPENSSL_VERSION_NUMBER < 0x10100000
-#define const_ossl11
-
static ASN1_INTEGER *X509_get0_serialNumber(const X509 *a)
{
return a->cert_info->serialNumber;
--
2.7.4