25c977
diff -ru bind-9.13.2.orig/lib/dns/dst_openssl.h bind-9.13.2/lib/dns/dst_openssl.h
25c977
--- bind-9.13.2.orig/lib/dns/dst_openssl.h	2018-07-03 09:51:40.000000000 +0200
25c977
+++ bind-9.13.2/lib/dns/dst_openssl.h	2022-03-03 17:33:45.630920499 +0100
25c977
@@ -23,7 +23,7 @@
25c977
 #include <openssl/crypto.h>
25c977
 #include <openssl/bn.h>
25c977
 
25c977
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
25c977
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || LIBRESSL_VERSION_NUMBER < 0x3050000fL
25c977
 /*
25c977
  * These are new in OpenSSL 1.1.0.  BN_GENCB _cb needs to be declared in
25c977
  * the function like this before the BN_GENCB_new call:
25c977
@@ -37,7 +37,7 @@
25c977
 #define BN_GENCB_get_arg(x) ((x)->arg)
25c977
 #endif
25c977
 
25c977
-#if OPENSSL_VERSION_NUMBER >= 0x10100000L
25c977
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L || LIBRESSL_VERSION_NUMBER >= 0x3050000fL
25c977
 /*
25c977
  * EVP_dss1() is a version of EVP_sha1() that was needed prior to
25c977
  * 1.1.0 because there was a link between digests and signing algorithms;
25c977
diff -ru bind-9.13.2.orig/lib/dns/openssldh_link.c bind-9.13.2/lib/dns/openssldh_link.c
25c977
--- bind-9.13.2.orig/lib/dns/openssldh_link.c	2018-07-03 09:51:40.000000000 +0200
25c977
+++ bind-9.13.2/lib/dns/openssldh_link.c	2022-03-03 17:28:31.794993951 +0100
25c977
@@ -255,7 +255,7 @@
25c977
 openssldh_generate(dst_key_t *key, int generator, void (*callback)(int)) {
25c977
 	DH *dh = NULL;
25c977
 	BN_GENCB *cb;
25c977
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
25c977
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || LIBRESSL_VERSION_NUMBER < 0x3050000fL
25c977
 	BN_GENCB _cb;
25c977
 #endif
25c977
 	union {
25c977
@@ -296,7 +296,7 @@
25c977
 		if (dh == NULL)
25c977
 			return (dst__openssl_toresult(ISC_R_NOMEMORY));
25c977
 		cb = BN_GENCB_new();
25c977
-#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
25c977
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L && LIBRESSL_VERSION_NUMBER >= 0x3050000fL
25c977
 		if (cb == NULL) {
25c977
 			DH_free(dh);
25c977
 			return (dst__openssl_toresult(ISC_R_NOMEMORY));
25c977
diff -ru bind-9.13.2.orig/lib/dns/openssldsa_link.c bind-9.13.2/lib/dns/openssldsa_link.c
25c977
--- bind-9.13.2.orig/lib/dns/openssldsa_link.c	2018-07-03 09:51:40.000000000 +0200
25c977
+++ bind-9.13.2/lib/dns/openssldsa_link.c	2022-03-03 17:35:08.250987970 +0100
25c977
@@ -342,7 +342,7 @@
25c977
 	DSA *dsa;
25c977
 	unsigned char rand_array[ISC_SHA1_DIGESTLENGTH];
25c977
 	BN_GENCB *cb;
25c977
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
25c977
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || LIBRESSL_VERSION_NUMBER < 0x3050000fL
25c977
 	BN_GENCB _cb;
25c977
 #endif
25c977
 	union {
25c977
@@ -358,7 +358,7 @@
25c977
 	if (dsa == NULL)
25c977
 		return (dst__openssl_toresult(DST_R_OPENSSLFAILURE));
25c977
 	cb = BN_GENCB_new();
25c977
-#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
25c977
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L || LIBRESSL_VERSION_NUMBER >= 0x3050000fL
25c977
 	if (cb == NULL) {
25c977
 		DSA_free(dsa);
25c977
 		return (dst__openssl_toresult(DST_R_OPENSSLFAILURE));
25c977
diff -ru bind-9.13.2.orig/lib/dns/opensslrsa_link.c bind-9.13.2/lib/dns/opensslrsa_link.c
25c977
--- bind-9.13.2.orig/lib/dns/opensslrsa_link.c	2018-07-03 09:51:40.000000000 +0200
25c977
+++ bind-9.13.2/lib/dns/opensslrsa_link.c	2022-03-03 17:36:13.226989276 +0100
25c977
@@ -487,7 +487,7 @@
25c977
 	} u;
25c977
 	RSA *rsa = RSA_new();
25c977
 	BIGNUM *e = BN_new();
25c977
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
25c977
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || LIBRESSL_VERSION_NUMBER < 0x3050000fL
25c977
 	BN_GENCB _cb;
25c977
 #endif
25c977
 	BN_GENCB *cb = BN_GENCB_new();
25c977
diff -ru bind-9.13.2.orig/lib/isc/aes.c bind-9.13.2/lib/isc/aes.c
25c977
--- bind-9.13.2.orig/lib/isc/aes.c	2018-07-03 09:51:40.000000000 +0200
25c977
+++ bind-9.13.2/lib/isc/aes.c	2022-03-03 17:10:21.765781027 +0100
25c977
@@ -27,7 +27,7 @@
25c977
 #include <openssl/opensslv.h>
25c977
 #include <openssl/evp.h>
25c977
 
25c977
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
25c977
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || LIBRESSL_VERSION_NUMBER < 0x3050000fL
25c977
 #define EVP_CIPHER_CTX_new() &(_context), EVP_CIPHER_CTX_init(&_context)
25c977
 #define EVP_CIPHER_CTX_free(c) RUNTIME_CHECK(EVP_CIPHER_CTX_cleanup(c) == 1)
25c977
 #endif
25c977
@@ -36,7 +36,7 @@
25c977
 isc_aes128_crypt(const unsigned char *key, const unsigned char *in,
25c977
 		 unsigned char *out)
25c977
 {
25c977
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
25c977
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || LIBRESSL_VERSION_NUMBER < 0x3050000fL
25c977
 	EVP_CIPHER_CTX _context;
25c977
 #endif
25c977
 	EVP_CIPHER_CTX *c;
25c977
@@ -56,7 +56,7 @@
25c977
 isc_aes192_crypt(const unsigned char *key, const unsigned char *in,
25c977
 		 unsigned char *out)
25c977
 {
25c977
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
25c977
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || LIBRESSL_VERSION_NUMBER < 0x3050000fL
25c977
 	EVP_CIPHER_CTX _context;
25c977
 #endif
25c977
 	EVP_CIPHER_CTX *c;
25c977
@@ -76,7 +76,7 @@
25c977
 isc_aes256_crypt(const unsigned char *key, const unsigned char *in,
25c977
 		 unsigned char *out)
25c977
 {
25c977
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
25c977
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || LIBRESSL_VERSION_NUMBER < 0x3050000fL
25c977
 	EVP_CIPHER_CTX _context;
25c977
 #endif
25c977
 	EVP_CIPHER_CTX *c;
25c977
diff -ru bind-9.13.2.orig/lib/isc/hmacmd5.c bind-9.13.2/lib/isc/hmacmd5.c
25c977
--- bind-9.13.2.orig/lib/isc/hmacmd5.c	2018-07-03 09:51:40.000000000 +0200
25c977
+++ bind-9.13.2/lib/isc/hmacmd5.c	2022-03-03 17:15:13.809786894 +0100
25c977
@@ -35,7 +35,7 @@
25c977
 #endif
25c977
 
25c977
 #ifdef ISC_PLATFORM_OPENSSLHASH
25c977
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
25c977
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || LIBRESSL_VERSION_NUMBER < 0x3050000fL
25c977
 #define HMAC_CTX_new() &(ctx->_ctx), HMAC_CTX_init(&(ctx->_ctx))
25c977
 #define HMAC_CTX_free(ptr) HMAC_CTX_cleanup(ptr)
25c977
 #endif
25c977
diff -ru bind-9.13.2.orig/lib/isc/hmacsha.c bind-9.13.2/lib/isc/hmacsha.c
25c977
--- bind-9.13.2.orig/lib/isc/hmacsha.c	2018-07-03 09:51:40.000000000 +0200
25c977
+++ bind-9.13.2/lib/isc/hmacsha.c	2022-03-03 17:22:31.285434086 +0100
25c977
@@ -33,7 +33,7 @@
25c977
 #endif
25c977
 
25c977
 #ifdef ISC_PLATFORM_OPENSSLHASH
25c977
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
25c977
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || LIBRESSL_VERSION_NUMBER < 0x3050000fL
25c977
 #define HMAC_CTX_new() &(ctx->_ctx), HMAC_CTX_init(&(ctx->_ctx))
25c977
 #define HMAC_CTX_free(ptr) HMAC_CTX_cleanup(ptr)
25c977
 #endif
25c977
diff -ru bind-9.13.2.orig/lib/isc/include/isc/hmacmd5.h bind-9.13.2/lib/isc/include/isc/hmacmd5.h
25c977
--- bind-9.13.2.orig/lib/isc/include/isc/hmacmd5.h	2018-07-03 09:51:40.000000000 +0200
25c977
+++ bind-9.13.2/lib/isc/include/isc/hmacmd5.h	2022-03-03 17:16:24.627248672 +0100
25c977
@@ -35,7 +35,7 @@
25c977
 
25c977
 typedef struct {
25c977
 	HMAC_CTX *ctx;
25c977
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
25c977
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || LIBRESSL_VERSION_NUMBER < 0x3050000fL
25c977
 	HMAC_CTX _ctx;
25c977
 #endif
25c977
 } isc_hmacmd5_t;
25c977
diff -ru bind-9.13.2.orig/lib/isc/include/isc/hmacsha.h bind-9.13.2/lib/isc/include/isc/hmacsha.h
25c977
--- bind-9.13.2.orig/lib/isc/include/isc/hmacsha.h	2018-07-03 09:51:40.000000000 +0200
25c977
+++ bind-9.13.2/lib/isc/include/isc/hmacsha.h	2022-03-03 17:20:52.731254059 +0100
25c977
@@ -36,7 +36,7 @@
25c977
 
25c977
 typedef struct {
25c977
 	HMAC_CTX *ctx;
25c977
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
25c977
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || LIBRESSL_VERSION_NUMBER < 0x3050000fL
25c977
 	HMAC_CTX _ctx;
25c977
 #endif
25c977
 } isc_hmacsha_t;
25c977
diff -ru bind-9.13.2.orig/lib/isc/include/isc/md5.h bind-9.13.2/lib/isc/include/isc/md5.h
25c977
--- bind-9.13.2.orig/lib/isc/include/isc/md5.h	2018-07-03 09:51:40.000000000 +0200
25c977
+++ bind-9.13.2/lib/isc/include/isc/md5.h	2022-03-03 17:16:46.283249108 +0100
25c977
@@ -53,7 +53,7 @@
25c977
 
25c977
 typedef struct {
25c977
 	EVP_MD_CTX *ctx;
25c977
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
25c977
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || LIBRESSL_VERSION_NUMBER < 0x3050000fL
25c977
 	EVP_MD_CTX _ctx;
25c977
 #endif
25c977
 } isc_md5_t;
25c977
diff -ru bind-9.13.2.orig/lib/isc/include/isc/sha1.h bind-9.13.2/lib/isc/include/isc/sha1.h
25c977
--- bind-9.13.2.orig/lib/isc/include/isc/sha1.h	2018-07-03 09:51:40.000000000 +0200
25c977
+++ bind-9.13.2/lib/isc/include/isc/sha1.h	2022-03-03 17:21:12.915254464 +0100
25c977
@@ -34,7 +34,7 @@
25c977
 
25c977
 typedef struct {
25c977
 	EVP_MD_CTX *ctx;
25c977
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
25c977
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || LIBRESSL_VERSION_NUMBER < 0x3050000fL
25c977
 	EVP_MD_CTX _ctx;
25c977
 #endif
25c977
 } isc_sha1_t;
25c977
diff -ru bind-9.13.2.orig/lib/isc/md5.c bind-9.13.2/lib/isc/md5.c
25c977
--- bind-9.13.2.orig/lib/isc/md5.c	2018-07-03 09:51:40.000000000 +0200
25c977
+++ bind-9.13.2/lib/isc/md5.c	2022-03-03 17:23:28.373435233 +0100
25c977
@@ -48,7 +48,7 @@
25c977
 #include <isc/util.h>
25c977
 
25c977
 #ifdef ISC_PLATFORM_OPENSSLHASH
25c977
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
25c977
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || LIBRESSL_VERSION_NUMBER < 0x3050000fL
25c977
 #define EVP_MD_CTX_new() &(ctx->_ctx)
25c977
 #define EVP_MD_CTX_free(ptr) EVP_MD_CTX_cleanup(ptr)
25c977
 #endif
25c977
diff -ru bind-9.13.2.orig/lib/isc/openssl_shim.c bind-9.13.2/lib/isc/openssl_shim.c
25c977
--- bind-9.13.2.orig/lib/isc/openssl_shim.c	2018-07-03 09:51:40.000000000 +0200
25c977
+++ bind-9.13.2/lib/isc/openssl_shim.c	2022-03-03 17:24:22.517436320 +0100
25c977
@@ -15,7 +15,7 @@
25c977
 
25c977
 #include <openssl/opensslv.h>
25c977
 
25c977
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
25c977
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || LIBRESSL_VERSION_NUMBER < 0x3050000fL
25c977
 
25c977
 #include <stdlib.h>
25c977
 #include <string.h>
25c977
diff -ru bind-9.13.2.orig/lib/isc/sha1.c bind-9.13.2/lib/isc/sha1.c
25c977
--- bind-9.13.2.orig/lib/isc/sha1.c	2018-07-03 09:51:40.000000000 +0200
25c977
+++ bind-9.13.2/lib/isc/sha1.c	2022-03-03 17:25:09.085437256 +0100
25c977
@@ -43,7 +43,7 @@
25c977
 #endif
25c977
 
25c977
 #ifdef ISC_PLATFORM_OPENSSLHASH
25c977
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
25c977
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || LIBRESSL_VERSION_NUMBER < 0x3050000fL
25c977
 #define EVP_MD_CTX_new() &(context->_ctx)
25c977
 #define EVP_MD_CTX_free(ptr) EVP_MD_CTX_cleanup(ptr)
25c977
 #endif