From 36d8b974fc42ed8eb1ff88811e09d0910ae61187 Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Mon, 11 Sep 2017 17:07:50 +0200 Subject: [PATCH] Restore compatibility with old OpenSSL versions Let's implement X509_STORE_up_ref on our own. --- src/core/network-openssl.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/core/network-openssl.c b/src/core/network-openssl.c index feb2295d..7ec902fb 100644 --- a/src/core/network-openssl.c +++ b/src/core/network-openssl.c @@ -45,6 +45,19 @@ #define ASN1_STRING_data(x) ASN1_STRING_get0_data(x) #endif +/* OpenSSL 1.1.0 also introduced some useful additions to the api */ +#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined (LIBRESSL_VERSION_NUMBER) +static int X509_STORE_up_ref(X509_STORE *vfy) +{ + int n; + + n = CRYPTO_add(&vfy->references, 1, CRYPTO_LOCK_X509_STORE); + g_assert(n > 1); + + return (n > 1) ? 1 : 0; +} +#endif + /* ssl i/o channel object */ typedef struct {