From d2dd356f8b1048abf754ca7d793b73d1e8255b1f Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Wed, 14 Dec 2016 22:03:38 +0100 Subject: [PATCH] libpoe-filter-ssl-perl: add openssl 1.1.0 support Signed-off-by: Sebastian Andrzej Siewior Bug: https://rt.cpan.org/Public/Bug/Display.html?id=118536 Bug-Debian: https://bugs.debian.org/828408 --- SSL.xs | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/SSL.xs b/SSL.xs index f7ee51ca389d..39aa0739ffe8 100755 --- a/SSL.xs +++ b/SSL.xs @@ -6,6 +6,13 @@ #include #include +#if OPENSSL_VERSION_NUMBER < 0x10100000 +static const ASN1_INTEGER *X509_REVOKED_get0_serialNumber(const X509_REVOKED *x) +{ + return x->serialNumber; +} +#endif + MODULE = POE::Filter::SSL PACKAGE = POE::Filter::SSL ASN1_INTEGER * @@ -21,6 +28,7 @@ verify_serial_against_crl_file(crlfile, serial) CODE: X509_CRL *crl=NULL; X509_REVOKED *revoked; + STACK_OF(X509_REVOKED) *revokes; BIO *in=NULL; int n,i,retval = 0; STRLEN len, lenser; @@ -51,14 +59,18 @@ verify_serial_against_crl_file(crlfile, serial) goto end; } - n = sk_num(X509_CRL_get_REVOKED(crl)); + revokes = X509_CRL_get_REVOKED(crl); + n = sk_X509_REVOKED_num(revokes); if (n > 0) { for (i = 0; i < n; i++) { - revoked = (X509_REVOKED *)sk_value(X509_CRL_get_REVOKED(crl), i); - if ( (revoked->serialNumber->length > 0) && - (revoked->serialNumber->length == lenser) && - (strncmp(revoked->serialNumber->data, serial, lenser) == 0)) { - sv_setpvn( ST(0), revoked->serialNumber->data, revoked->serialNumber->length); + const ASN1_INTEGER *asn_ser; + + revoked = sk_X509_REVOKED_value(revokes, i); + asn_ser = X509_REVOKED_get0_serialNumber(revoked); + if ( (asn_ser->length > 0) && + (asn_ser->length == lenser) && + (strncmp(asn_ser->data, serial, lenser) == 0)) { + sv_setpvn( ST(0), asn_ser->data, asn_ser->length); goto end; } } -- 2.11.0