From 4790a614375581cc19c11b3ed35cf62bb2b5c428 Mon Sep 17 00:00:00 2001 From: Dmitry Podgorny Date: Tue, 23 Mar 2021 02:07:00 +0200 Subject: [PATCH] tls/openssl: fix openssl-0.9.8 support 0.9.8 doesn't implement GENERAL_NAME_get0_otherName(). --- src/tls_openssl.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/tls_openssl.c b/src/tls_openssl.c index 8f5fb00..b77b5ba 100644 --- a/src/tls_openssl.c +++ b/src/tls_openssl.c @@ -54,6 +54,21 @@ static const unsigned char *ASN1_STRING_get0_data(ASN1_STRING *asn1) } #endif +#if OPENSSL_VERSION_NUMBER < 0x10000000L +static int GENERAL_NAME_get0_otherName(const GENERAL_NAME *gen, + ASN1_OBJECT **poid, + ASN1_TYPE **pvalue) +{ + if (gen->type != GEN_OTHERNAME) + return 0; + if (poid) + *poid = gen->d.otherName->type_id; + if (pvalue) + *pvalue = gen->d.otherName->value; + return 1; +} +#endif + struct _tls { xmpp_ctx_t *ctx; sock_t sock;