From a898113823a3b76e0078764edabfac916de7e539 Mon Sep 17 00:00:00 2001 From: Ben Greear Date: Tue, 12 Sep 2017 10:43:36 -0700 Subject: [PATCH] HS 2.0: Fix EST compilation with OpenSSL 1.1.0 and newer SKM_sk_value() is not available anymore, so use DEFINE_STACK_OF() to get the appropriate accessor functions. Signed-off-by: Ben Greear --- hs20/client/est.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hs20/client/est.c b/hs20/client/est.c index b1aacb8ff..db65334b2 100644 --- a/hs20/client/est.c +++ b/hs20/client/est.c @@ -16,6 +16,7 @@ #include #include #include +#include #ifdef OPENSSL_IS_BORINGSSL #include #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);