openssl: Fix mapping from ASN1 to chunk_t with OpenSSL 1.1.0
authorTobias Brunner <tobias@strongswan.org>
Mon, 27 Jun 2016 09:17:31 +0000 (11:17 +0200)
committerTobias Brunner <tobias@strongswan.org>
Wed, 29 Jun 2016 09:09:37 +0000 (11:09 +0200)
ASN1_OBJECT is now opaque.

src/libstrongswan/plugins/openssl/openssl_util.c

index 9140603..a1d675f 100644 (file)
 #include <openssl/evp.h>
 #include <openssl/x509.h>
 
+/* these were added with 1.1.0 when ASN1_OBJECT was made opaque */
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#define OBJ_get0_data(o) ((o)->data)
+#define OBJ_length(o) ((o)->length)
+#endif
+
 /**
  * Described in header.
  */
@@ -149,7 +155,7 @@ chunk_t openssl_asn1_obj2chunk(ASN1_OBJECT *asn1)
 {
        if (asn1)
        {
-               return chunk_create((u_char*)asn1->data, asn1->length);
+               return chunk_create((u_char*)OBJ_get0_data(asn1), OBJ_length(asn1));
        }
        return chunk_empty;
 }