]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
HS 2.0: Fix EST compilation with OpenSSL 1.1.0 and newer
authorBen Greear <greearb@candelatech.com>
Tue, 12 Sep 2017 17:43:36 +0000 (10:43 -0700)
committerJouni Malinen <j@w1.fi>
Tue, 1 Jan 2019 17:56:19 +0000 (19:56 +0200)
SKM_sk_value() is not available anymore, so use DEFINE_STACK_OF() to get
the appropriate accessor functions.

Signed-off-by: Ben Greear <greearb@candelatech.com>
hs20/client/est.c

index b1aacb8ffbbe5e9f430c1a6132218a73706a35de..db65334b20f3e05f76aca5a75e328861f6f7d0b0 100644 (file)
@@ -16,6 +16,7 @@
 #include <openssl/asn1t.h>
 #include <openssl/x509.h>
 #include <openssl/x509v3.h>
+#include <openssl/opensslv.h>
 #ifdef OPENSSL_IS_BORINGSSL
 #include <openssl/buf.h>
 #endif /* OPENSSL_IS_BORINGSSL */
@@ -219,6 +220,10 @@ typedef struct {
        } d;
 } AttrOrOID;
 
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(OPENSSL_IS_BORINGSSL)
+DEFINE_STACK_OF(AttrOrOID)
+#endif
+
 typedef struct {
        int type;
        STACK_OF(AttrOrOID) *attrs;
@@ -352,9 +357,17 @@ static void add_csrattrs(struct hs20_osu_client *ctx, CsrAttrs *csrattrs,
                }
        }
 #else /* OPENSSL_IS_BORINGSSL */
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(OPENSSL_IS_BORINGSSL)
+       num = sk_AttrOrOID_num(csrattrs->attrs);
+#else
        num = SKM_sk_num(AttrOrOID, csrattrs->attrs);
+#endif
        for (i = 0; i < num; i++) {
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(OPENSSL_IS_BORINGSSL)
+               AttrOrOID *ao = sk_AttrOrOID_value(csrattrs->attrs, i);
+#else
                AttrOrOID *ao = SKM_sk_value(AttrOrOID, csrattrs->attrs, i);
+#endif
                switch (ao->type) {
                case 0:
                        add_csrattrs_oid(ctx, ao->d.oid, exts);