forked from gentoo/gentoo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kdelibs4support-5.40.0-libressl.patch
208 lines (187 loc) · 8.58 KB
/
kdelibs4support-5.40.0-libressl.patch
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
From 00cae452ac619810f311cf63d4dfd268887d30e5 Mon Sep 17 00:00:00 2001
From: Heiko Becker <[email protected]>
Date: Sun, 5 Nov 2017 22:52:54 +0100
Subject: Fix build with LibreSSL
Summary:
Unfortunately LibreSSL sets OPENSSL_VERSION_NUMBER to
0x20000000L and doesn't support the OpenSSL 1.1 API.
Test Plan: Builds with LibreSSL
Reviewers: #frameworks
Tags: #frameworks
Differential Revision: https://phabricator.kde.org/D8672
---
src/kssl/kopenssl.cpp | 34 +++++++++++++++++-----------------
src/kssl/kopenssl.h | 2 +-
src/kssl/ksslcertificate.cpp | 2 +-
3 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/src/kssl/kopenssl.cpp b/src/kssl/kopenssl.cpp
index c68a134..ce5f137 100644
--- a/src/kssl/kopenssl.cpp
+++ b/src/kssl/kopenssl.cpp
@@ -81,7 +81,7 @@ extern "C" {
static void (*K_X509_LOOKUP_free)(X509_LOOKUP *) = nullptr;
static int (*K_X509_LOOKUP_ctrl)(X509_LOOKUP *, int, const char *, long, char **) = nullptr;
static void (*K_X509_STORE_CTX_init)(X509_STORE_CTX *, X509_STORE *, X509 *, STACK_OF(X509) *) = nullptr;
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
static void (*K_CRYPTO_free)(void *) = nullptr;
#else
static void (*K_CRYPTO_free)(void *, const char *, int) = nullptr;
@@ -430,7 +430,7 @@ KOpenSSLProxy::KOpenSSLProxy()
K_RAND_load_file = (int (*)(const char *, long)) d->cryptoLib->resolve("RAND_load_file");
K_RAND_file_name = (const char *(*)(char *, size_t)) d->cryptoLib->resolve("RAND_file_name");
K_RAND_write_file = (int (*)(const char *)) d->cryptoLib->resolve("RAND_write_file");
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
K_CRYPTO_free = (void (*)(void *)) d->cryptoLib->resolve("CRYPTO_free");
#else
K_CRYPTO_free = (void (*)(void *, const char *, int)) d->cryptoLib->resolve("CRYPTO_free");
@@ -485,7 +485,7 @@ KOpenSSLProxy::KOpenSSLProxy()
K_X509_STORE_CTX_get_current_cert = (X509 * (*)(X509_STORE_CTX *)) d->cryptoLib->resolve("X509_STORE_CTX_get_current_cert");
K_X509_STORE_CTX_set_error = (void (*)(X509_STORE_CTX *, int)) d->cryptoLib->resolve("X509_STORE_CTX_set_error");
K_X509_STORE_CTX_get_error = (int (*)(X509_STORE_CTX *)) d->cryptoLib->resolve("X509_STORE_CTX_get_error");
-#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
K_OPENSSL_sk_free = (void (*)(STACK *)) d->cryptoLib->resolve("OPENSSL_sk_free");
K_OPENSSL_sk_num = (int (*)(STACK *)) d->cryptoLib->resolve("OPENSSL_sk_num");
K_OPENSSL_sk_pop = (char *(*)(STACK *)) d->cryptoLib->resolve("OPENSSL_sk_pop");
@@ -979,7 +979,7 @@ void KOpenSSLProxy::X509_STORE_free(X509_STORE *v)
void KOpenSSLProxy::X509_STORE_set_verify_cb(X509_STORE *store, int (*verify_cb)(int, X509_STORE_CTX *))
{
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
X509_STORE_set_verify_cb_func(store, verify_cb);
#else
if (K_X509_STORE_set_verify_cb) {
@@ -1044,7 +1044,7 @@ X509_NAME *KOpenSSLProxy::X509_get_issuer_name(X509 *a)
void KOpenSSLProxy::X509_get0_signature(const ASN1_BIT_STRING **psig, const X509_ALGOR **algor, const X509 *x)
{
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
if (psig) {
*psig = x->signature;
}
@@ -1096,7 +1096,7 @@ void KOpenSSLProxy::X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store,
}
}
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
void KOpenSSLProxy::CRYPTO_free(void *x)
{
if (K_CRYPTO_free) {
@@ -1122,7 +1122,7 @@ X509 *KOpenSSLProxy::X509_dup(X509 *x509)
ASN1_TIME *KOpenSSLProxy::X509_getm_notBefore(const X509 *x)
{
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
return X509_get_notBefore(x);
#else
if (K_X509_getm_notBefore) {
@@ -1135,7 +1135,7 @@ ASN1_TIME *KOpenSSLProxy::X509_getm_notBefore(const X509 *x)
ASN1_TIME *KOpenSSLProxy::X509_getm_notAfter(const X509 *x)
{
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
return X509_get_notAfter(x);
#else
if (K_X509_getm_notAfter) {
@@ -1413,7 +1413,7 @@ void KOpenSSLProxy::X509_STORE_CTX_set_purpose(X509_STORE_CTX *v, int purpose)
X509 *KOpenSSLProxy::X509_STORE_CTX_get_current_cert(X509_STORE_CTX *v)
{
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
return v->current_cert;
#else
if (K_X509_STORE_CTX_get_current_cert) {
@@ -1426,7 +1426,7 @@ X509 *KOpenSSLProxy::X509_STORE_CTX_get_current_cert(X509_STORE_CTX *v)
void KOpenSSLProxy::X509_STORE_CTX_set_error(X509_STORE_CTX *v, int error)
{
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
v->error = error;
#else
if (K_X509_STORE_CTX_set_error) {
@@ -1437,7 +1437,7 @@ void KOpenSSLProxy::X509_STORE_CTX_set_error(X509_STORE_CTX *v, int error)
int KOpenSSLProxy::X509_STORE_CTX_get_error(X509_STORE_CTX *v)
{
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
return v->error;
#else
if (K_X509_STORE_CTX_get_error) {
@@ -1894,7 +1894,7 @@ int KOpenSSLProxy::EVP_PKEY_assign(EVP_PKEY *pkey, int type, char *key)
int KOpenSSLProxy::EVP_PKEY_base_id(EVP_PKEY *pkey)
{
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
return pkey->type;
#else
if (K_EVP_PKEY_base_id) {
@@ -1907,7 +1907,7 @@ int KOpenSSLProxy::EVP_PKEY_base_id(EVP_PKEY *pkey)
RSA *KOpenSSLProxy::EVP_PKEY_get0_RSA(EVP_PKEY *pkey)
{
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
return pkey->pkey.rsa;
#else
if (K_EVP_PKEY_get0_RSA) {
@@ -1920,7 +1920,7 @@ RSA *KOpenSSLProxy::EVP_PKEY_get0_RSA(EVP_PKEY *pkey)
void KOpenSSLProxy::RSA_get0_key(RSA *rsa, const BIGNUM **n, const BIGNUM **e, const BIGNUM **d)
{
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
if (n) {
*n = rsa->n;
}
@@ -1939,7 +1939,7 @@ void KOpenSSLProxy::RSA_get0_key(RSA *rsa, const BIGNUM **n, const BIGNUM **e, c
DSA *KOpenSSLProxy::EVP_PKEY_get0_DSA(EVP_PKEY *pkey)
{
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
return pkey->pkey.dsa;
#else
if (K_EVP_PKEY_get0_DSA) {
@@ -1952,7 +1952,7 @@ DSA *KOpenSSLProxy::EVP_PKEY_get0_DSA(EVP_PKEY *pkey)
void KOpenSSLProxy::DSA_get0_pqg(DSA *dsa, const BIGNUM **p, const BIGNUM **q, const BIGNUM **g)
{
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
if (p) {
*p = dsa->p;
}
@@ -1971,7 +1971,7 @@ void KOpenSSLProxy::DSA_get0_pqg(DSA *dsa, const BIGNUM **p, const BIGNUM **q, c
void KOpenSSLProxy::DSA_get0_key(DSA *dsa, const BIGNUM **pub_key, const BIGNUM **priv_key)
{
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
if (pub_key) {
*pub_key = dsa->pub_key;
}
diff --git a/src/kssl/kopenssl.h b/src/kssl/kopenssl.h
index 518cd5b..fa23efe 100644
--- a/src/kssl/kopenssl.h
+++ b/src/kssl/kopenssl.h
@@ -395,7 +395,7 @@ public:
/*
* CRYPTO_free - free up an internally allocated object
*/
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
void CRYPTO_free(void *x);
#else
void CRYPTO_free(void *x, const char *file, int line);
diff --git a/src/kssl/ksslcertificate.cpp b/src/kssl/ksslcertificate.cpp
index 4c96e4b..e9631fb 100644
--- a/src/kssl/ksslcertificate.cpp
+++ b/src/kssl/ksslcertificate.cpp
@@ -1222,7 +1222,7 @@ QByteArray KSSLCertificate::toNetscape()
{
QByteArray qba;
// no equivalent in OpenSSL 1.1.0 (?), so behave as if we had no OpenSSL at all
-#if KSSL_HAVE_SSL && OPENSSL_VERSION_NUMBER < 0x10100000L
+#if KSSL_HAVE_SSL && (OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER))
NETSCAPE_X509 nx;
ASN1_OCTET_STRING hdr;
QTemporaryFile ktf;
--
cgit v0.11.2