From 9937fd05d4529976b7566764b113dfd4724022d0 Mon Sep 17 00:00:00 2001
From: Slaven Rezic <slaven@rezic.de>
Date: Mon, 12 May 2025 22:57:58 +0200
Subject: [PATCH] Try to work around LibreSSL 3.9.0 dropping EVP_add_digest()
 (PR485, partial)

---
 SSLeay.xs          | 4 ++++
 lib/Net/SSLeay.pod | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/SSLeay.xs b/SSLeay.xs
index e345ebd..c1e33e6 100644
--- a/SSLeay.xs
+++ b/SSLeay.xs
@@ -7493,8 +7493,12 @@ SSL_CTX_set_tlsext_ticket_getkey_cb(ctx,callback=&PL_sv_undef,data=&PL_sv_undef)
 
 #endif
 
+#if !defined(LIBRESSL_VERSION_NUMBER) || (LIBRESSL_VERSION_NUMBER < 0x3090000fL) /* LibreSSL < 3.9.0 */
+
 int EVP_add_digest(const EVP_MD *digest)
 
+#endif
+
 #ifndef OPENSSL_NO_SHA
 
 const EVP_MD *EVP_sha1()
diff --git a/lib/Net/SSLeay.pod b/lib/Net/SSLeay.pod
index f8de992..8052a16 100644
--- a/lib/Net/SSLeay.pod
+++ b/lib/Net/SSLeay.pod
@@ -9019,6 +9019,8 @@ B<COMPATIBILITY:> not available in Net-SSLeay-1.42 and before; requires at least
     #
     # returns: value corresponding to openssl's EVP_MD structure
 
+B<COMPATIBILITY:> no longer available in LibreSSL 3.9.0 and later
+
 =item * EVP_add_digest
 
     my $rv = Net::SSLeay::EVP_add_digest($digest);
-- 
2.11.0