]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
openssl: fix build with LibreSSL < 2.9.1
authorMarcel Raad <Marcel.Raad@teamviewer.com>
Sat, 1 Aug 2020 09:51:59 +0000 (11:51 +0200)
committerMarcel Raad <Marcel.Raad@teamviewer.com>
Sat, 1 Aug 2020 15:47:32 +0000 (17:47 +0200)
`SSL_CTX_add0_chain_cert` and `SSL_CTX_clear_chain_certs` were
introduced in LibreSSL 2.9.1 [0].

[0] https://github.com/libressl-portable/openbsd/commit/0db809ee178457c8170abfae3931d7bd13abf3ef

Closes https://github.com/curl/curl/pull/5757

lib/vtls/openssl.c

index cc18b8c815fa29b3455086e4688b8d371cba7d10..1685a4aa4cb5e221f6e0045f0f3c530b375278fb 100644 (file)
@@ -619,7 +619,9 @@ SSL_CTX_use_certificate_chain_bio(SSL_CTX *ctx, BIO* in,
                                   const char *key_passwd)
 {
 /* SSL_CTX_add1_chain_cert introduced in OpenSSL 1.0.2 */
-#if (OPENSSL_VERSION_NUMBER >= 0x1000200fL) /* 1.0.2 or later */
+#if (OPENSSL_VERSION_NUMBER >= 0x1000200fL) && /* OpenSSL 1.0.2 or later */ \
+    !(defined(LIBRESSL_VERSION_NUMBER) && \
+      (LIBRESSL_VERSION_NUMBER < 0x2090100fL)) /* LibreSSL 2.9.1 or later */
   int ret = 0;
   X509 *x = NULL;
   void *passwd_callback_userdata = (void *)key_passwd;