aboutsummaryrefslogtreecommitdiffstats
path: root/community/yadifa/libressl-compat.patch
blob: 4b2c19d15bfbe184ebfc3c63e4f7521e48e00317 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
From 553b9d7d2a3c7cf56d1f02d73eb37cbd5a29e9df Mon Sep 17 00:00:00 2001
From: Bernard Spil <brnrd@FreeBSD.org>
Date: Sat, 25 Feb 2017 12:32:24 +0100
Subject: [PATCH] Fix build issues with LibreSSL

 - Check LIBRESSL_VERSION_NUMBER in addition to OpenSSL > 1.1

LibreSSL forked from OpenSSL 1.0.1f and does not have all features
from 1.1.0.
---
 lib/dnscore/src/dnskey_dsa.c   | 4 ++--
 lib/dnscore/src/dnskey_ecdsa.c | 2 +-
 lib/dnscore/src/dnskey_rsa.c   | 2 +-
 lib/dnscore/src/tsig.c         | 6 +++---
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/lib/dnscore/src/dnskey_dsa.c b/lib/dnscore/src/dnskey_dsa.c
index 43fe450..54b93f0 100644
--- a/lib/dnscore/src/dnskey_dsa.c
+++ b/lib/dnscore/src/dnskey_dsa.c
@@ -70,7 +70,7 @@
 #error "OPENSSL_VERSION_NUMBER not defined"
 #endif
 
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
 
 /*
  * Backward-compatible interface for 0.9.x
@@ -226,7 +226,7 @@ dnskey_dsa_genkey(u32 size)
     int err;
     DSA* dsa;
 
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
     dsa = DSA_generate_parameters(size, NULL,0, NULL, NULL, NULL, NULL);
 #else
     dsa = DSA_new();
diff --git a/lib/dnscore/src/dnskey_ecdsa.c b/lib/dnscore/src/dnskey_ecdsa.c
index 1638c3b..1ed19d4 100644
--- a/lib/dnscore/src/dnskey_ecdsa.c
+++ b/lib/dnscore/src/dnskey_ecdsa.c
@@ -79,7 +79,7 @@
 #define DNSKEY_ALGORITHM_ECDSAP256SHA256_NID NID_X9_62_prime256v1
 #define DNSKEY_ALGORITHM_ECDSAP384SHA384_NID NID_secp384r1
 
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
 
 #define SSL_FIELD_GET(st_,f_) if(f_ != NULL) { *f_ = st_->f_; }
 #define SSL_FIELD_SET(st_,f_) if(f_ != NULL) { BN_free(st_->f_); st_->f_ = f_; }
diff --git a/lib/dnscore/src/dnskey_rsa.c b/lib/dnscore/src/dnskey_rsa.c
index f52f84f..00529ea 100644
--- a/lib/dnscore/src/dnskey_rsa.c
+++ b/lib/dnscore/src/dnskey_rsa.c
@@ -64,7 +64,7 @@
 
 #define MODULE_MSG_HANDLE g_system_logger
 
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
 
 #define SSL_FIELD_GET(st_,f_) if(f_ != NULL) { *f_ = st_->f_; }
 #define SSL_FIELD_SET(st_,f_) if(f_ != NULL) { BN_free(st_->f_); st_->f_ = f_; }
diff --git a/lib/dnscore/src/tsig.c b/lib/dnscore/src/tsig.c
index 21d7e9d..391e72a 100644
--- a/lib/dnscore/src/tsig.c
+++ b/lib/dnscore/src/tsig.c
@@ -233,7 +233,7 @@
 tsig_hmac_t
 tsig_hmac_allocate()
 {
-#if OPENSSL_VERSION_NUMBER < 0x10100000L // ie: 0.9.x
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) // ie: 0.9.x
     HMAC_CTX *hmac;
     ZALLOC_OR_DIE(HMAC_CTX*, hmac, HMAC_CTX, GENERIC_TAG);
     HMAC_CTX_init(hmac);
@@ -257,7 +257,7 @@ tsig_hmac_free(tsig_hmac_t t)
 {
     HMAC_CTX *hmac = (HMAC_CTX*)t;
     yassert(hmac != NULL);
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
     HMAC_CTX_cleanup(hmac);
     ZFREE(t, HMAC_CTX);
 #else
@@ -268,7 +268,7 @@ tsig_hmac_free(tsig_hmac_t t)
 void tsig_hmac_reset(tsig_hmac_t t)
 {
     HMAC_CTX *hmac = (HMAC_CTX*)t;
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
     HMAC_CTX_cleanup(hmac);
     HMAC_CTX_init(hmac);
 #else