From bd00ef2d4b8978dc06e1058e39d025f28d564c94 Mon Sep 17 00:00:00 2001 From: Sebastian Reimers Date: Tue, 1 Nov 2022 21:04:12 +0100 Subject: [PATCH] tls: SSL_get_peer_certificate is deprecated (#585) --- src/tls/openssl/tls.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/tls/openssl/tls.c b/src/tls/openssl/tls.c index 0cd05971a..ef22b0e04 100644 --- a/src/tls/openssl/tls.c +++ b/src/tls/openssl/tls.c @@ -1035,7 +1035,11 @@ int tls_peer_fingerprint(const struct tls_conn *tc, enum tls_fingerprint type, if (!tc || !md) return EINVAL; +#if OPENSSL_VERSION_MAJOR >= 3 + cert = SSL_get1_peer_certificate(tc->ssl); +#else cert = SSL_get_peer_certificate(tc->ssl); +#endif if (!cert) return ENOENT; @@ -1064,7 +1068,11 @@ int tls_peer_common_name(const struct tls_conn *tc, char *cn, size_t size) if (!tc || !cn || !size) return EINVAL; +#if OPENSSL_VERSION_MAJOR >= 3 + cert = SSL_get1_peer_certificate(tc->ssl); +#else cert = SSL_get_peer_certificate(tc->ssl); +#endif if (!cert) return ENOENT;