From 568e890e761274efd01f4c771242da1dc53820c7 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 5 Jan 2019 11:33:40 +0200 Subject: [PATCH] OpenSSL: Fix build with OpenSSL 1.0.2 SSL_use_certificate_chain_file() was added in OpenSSL 1.1.0, so need to maintain the old version using SSL_use_certificate_file() for backwards compatibility. Fixes: 658c39809bf8 ("OpenSSL: Load chain certificates from client_cert file") Signed-off-by: Jouni Malinen --- src/crypto/tls_openssl.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/crypto/tls_openssl.c b/src/crypto/tls_openssl.c index 69c0c4005..4058f414b 100644 --- a/src/crypto/tls_openssl.c +++ b/src/crypto/tls_openssl.c @@ -2757,12 +2757,22 @@ static int tls_connection_client_cert(struct tls_connection *conn, return 0; } +#if OPENSSL_VERSION_NUMBER >= 0x10100000L if (SSL_use_certificate_chain_file(conn->ssl, client_cert) == 1) { ERR_clear_error(); wpa_printf(MSG_DEBUG, "OpenSSL: SSL_use_certificate_chain_file" " --> OK"); return 0; } +#else + if (SSL_use_certificate_file(conn->ssl, client_cert, + SSL_FILETYPE_PEM) == 1) { + ERR_clear_error(); + wpa_printf(MSG_DEBUG, "OpenSSL: SSL_use_certificate_file (PEM)" + " --> OK"); + return 0; + } +#endif tls_show_errors(MSG_DEBUG, __func__, "SSL_use_certificate_file failed");