Subject: | [PATCH] 4 functions need PREINIT blocks to compile on MSVC, etc |
Some of the new functions that were added recently don't compile on some non-gcc compilers due to variable declarations after statements. I ran into this with both MSVC and AIX cc. The attached patch fixes X509_check_host, X509_check_ip, SSL_CTX_set_alpn_protos, and SSL_set_alpn_protos.
Thanks,
--
Andy Grundman
Lead Perl Language Developer, ActiveState
andyg@activestate.com
Subject: | Net-SSLeay-1.70-xs-preinit.patch |
From f81a73dc2a3e077858d92e5d900b0fe91ddce64c Mon Sep 17 00:00:00 2001
From: Andy Grundman <andyg@activestate.com>
Date: Wed, 19 Aug 2015 13:41:46 -0700
Subject: [PATCH] Generated C code is not compatible with MSVC, AIX cc,
probably others. Added some PREINIT blocks and replaced 2 cases of INIT with
PREINIT.
---
SSLeay.xs | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/SSLeay.xs b/SSLeay.xs
index 1bf09fa..7e42f47 100644
--- a/SSLeay.xs
+++ b/SSLeay.xs
@@ -2336,7 +2336,7 @@ RAND_write_file(file_name)
int
X509_check_host(X509 *cert, const char *name, unsigned int flags = 0, SV *peername = &PL_sv_undef)
- INIT:
+ PREINIT:
char *c_peername = NULL;
CODE:
RETVAL = X509_check_host(cert, name, 0, flags, (items == 4) ? &c_peername : NULL);
@@ -2357,7 +2357,7 @@ X509_check_email(X509 *cert, const char *address, unsigned int flags = 0)
int
X509_check_ip(X509 *cert, SV *address, unsigned int flags = 0)
- INIT:
+ PREINIT:
unsigned char *c_address;
size_t addresslen;
CODE:
@@ -5852,10 +5852,11 @@ int
SSL_CTX_set_alpn_protos(ctx,data=&PL_sv_undef)
SSL_CTX * ctx
SV * data
- CODE:
+ PREINIT:
unsigned char *alpn_data;
unsigned char alpn_len;
+ CODE:
RETVAL = -1;
if (!SvROK(data) || (SvTYPE(SvRV(data)) != SVt_PVAV))
@@ -5875,10 +5876,11 @@ int
SSL_set_alpn_protos(ssl,data=&PL_sv_undef)
SSL * ssl
SV * data
- CODE:
+ PREINIT:
unsigned char *alpn_data;
unsigned char alpn_len;
+ CODE:
RETVAL = -1;
if (!SvROK(data) || (SvTYPE(SvRV(data)) != SVt_PVAV))
--
2.3.2 (Apple Git-55)