summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRodrigo Arias Mallo <rodarima@gmail.com>2024-04-04 23:57:51 +0200
committerRodrigo Arias Mallo <rodarima@gmail.com>2024-04-05 00:07:58 +0200
commit54fe81fc60ce84d5740041c43ce9bcc1e8bb6693 (patch)
tree4452d2d88d080f848703069b015ad4b3c32cb2f5
parentf806c2accd8f7bfcb68e88b431d6b2e24078bdc7 (diff)
Use SSL_get1_peer_certificate() in OpenSSL 3
The function SSL_get_peer_certificate() is deprecated in 3.0.0, but still defined as a compatibility macro. Fixes: https://github.com/dillo-browser/dillo/issues/118
-rw-r--r--src/IO/tls_openssl.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/IO/tls_openssl.c b/src/IO/tls_openssl.c
index 5090683c..ceb06f93 100644
--- a/src/IO/tls_openssl.c
+++ b/src/IO/tls_openssl.c
@@ -821,7 +821,12 @@ static int Tls_examine_certificate(SSL *ssl, Server_t *srv)
int choice = -1, ret = -1;
char *title = dStrconcat("Dillo TLS security warning: ",srv->hostname,NULL);
+#if OPENSSL_VERSION_NUMBER < 0x30000000L
remote_cert = SSL_get_peer_certificate(ssl);
+#else
+ /* SSL_get_peer_certificate() was deprecated in 3.0.0. */
+ remote_cert = SSL_get1_peer_certificate(ssl);
+#endif
if (remote_cert == NULL){
/* Inform user that remote system cannot be trusted */
choice = a_Dialog_choice(title,