Removed
Link Here
|
1 |
--- src/_cffi_src/openssl/crypto.py.orig 2023-03-22 07:29:15 UTC |
2 |
+++ src/_cffi_src/openssl/crypto.py |
3 |
@@ -74,11 +74,8 @@ CUSTOMIZATIONS = """ |
4 |
# define OPENSSL_DIR SSLEAY_DIR |
5 |
#endif |
6 |
|
7 |
+static const long Cryptography_HAS_OPENSSL_CLEANUP = 1; |
8 |
#if CRYPTOGRAPHY_IS_LIBRESSL |
9 |
-static const long Cryptography_HAS_OPENSSL_CLEANUP = 0; |
10 |
- |
11 |
-void (*OPENSSL_cleanup)(void) = NULL; |
12 |
- |
13 |
/* This function has a significantly different signature pre-1.1.0. since it is |
14 |
* for testing only, we don't bother to expose it on older OpenSSLs. |
15 |
*/ |
16 |
@@ -89,7 +86,6 @@ int (*Cryptography_CRYPTO_set_mem_functions)( |
17 |
void (*)(void *, const char *, int)) = NULL; |
18 |
|
19 |
#else |
20 |
-static const long Cryptography_HAS_OPENSSL_CLEANUP = 1; |
21 |
static const long Cryptography_HAS_MEM_FUNCTIONS = 1; |
22 |
|
23 |
int Cryptography_CRYPTO_set_mem_functions( |
24 |
--- src/_cffi_src/openssl/cryptography.py.orig 2021-08-24 17:17:17 UTC |
25 |
+++ src/_cffi_src/openssl/cryptography.py |
26 |
@@ -33,17 +33,17 @@ INCLUDES = """ |
27 |
#endif |
28 |
|
29 |
#define CRYPTOGRAPHY_OPENSSL_110F_OR_GREATER \ |
30 |
- (OPENSSL_VERSION_NUMBER >= 0x1010006f && !CRYPTOGRAPHY_IS_LIBRESSL) |
31 |
+ OPENSSL_VERSION_NUMBER >= 0x1010006f |
32 |
|
33 |
#define CRYPTOGRAPHY_OPENSSL_LESS_THAN_110J \ |
34 |
- (OPENSSL_VERSION_NUMBER < 0x101000af || CRYPTOGRAPHY_IS_LIBRESSL) |
35 |
+ OPENSSL_VERSION_NUMBER < 0x101000af |
36 |
#define CRYPTOGRAPHY_OPENSSL_LESS_THAN_111 \ |
37 |
- (OPENSSL_VERSION_NUMBER < 0x10101000 || CRYPTOGRAPHY_IS_LIBRESSL) |
38 |
+ OPENSSL_VERSION_NUMBER < 0x10101000 |
39 |
#define CRYPTOGRAPHY_OPENSSL_LESS_THAN_111B \ |
40 |
- (OPENSSL_VERSION_NUMBER < 0x10101020 || CRYPTOGRAPHY_IS_LIBRESSL) |
41 |
+ OPENSSL_VERSION_NUMBER < 0x10101020 |
42 |
#define CRYPTOGRAPHY_OPENSSL_LESS_THAN_111D \ |
43 |
- (OPENSSL_VERSION_NUMBER < 0x10101040 || CRYPTOGRAPHY_IS_LIBRESSL) |
44 |
-#if (CRYPTOGRAPHY_OPENSSL_LESS_THAN_111D && !CRYPTOGRAPHY_IS_LIBRESSL && \ |
45 |
+ OPENSSL_VERSION_NUMBER < 0x10101040 |
46 |
+#if (CRYPTOGRAPHY_OPENSSL_LESS_THAN_111D && \ |
47 |
!defined(OPENSSL_NO_ENGINE)) || defined(USE_OSRANDOM_RNG_FOR_TESTING) |
48 |
#define CRYPTOGRAPHY_NEEDS_OSRANDOM_ENGINE 1 |
49 |
#else |
50 |
--- src/_cffi_src/openssl/dh.py.orig 2021-08-24 17:17:17 UTC |
51 |
+++ src/_cffi_src/openssl/dh.py |
52 |
@@ -37,117 +37,9 @@ int Cryptography_i2d_DHxparams_bio(BIO *bp, DH *x); |
53 |
""" |
54 |
|
55 |
CUSTOMIZATIONS = """ |
56 |
-#if CRYPTOGRAPHY_IS_LIBRESSL |
57 |
-#ifndef DH_CHECK_Q_NOT_PRIME |
58 |
-#define DH_CHECK_Q_NOT_PRIME 0x10 |
59 |
-#endif |
60 |
- |
61 |
-#ifndef DH_CHECK_INVALID_Q_VALUE |
62 |
-#define DH_CHECK_INVALID_Q_VALUE 0x20 |
63 |
-#endif |
64 |
- |
65 |
-#ifndef DH_CHECK_INVALID_J_VALUE |
66 |
-#define DH_CHECK_INVALID_J_VALUE 0x40 |
67 |
-#endif |
68 |
- |
69 |
-/* DH_check implementation taken from OpenSSL 1.1.0pre6 */ |
70 |
- |
71 |
-/*- |
72 |
- * Check that p is a safe prime and |
73 |
- * if g is 2, 3 or 5, check that it is a suitable generator |
74 |
- * where |
75 |
- * for 2, p mod 24 == 11 |
76 |
- * for 3, p mod 12 == 5 |
77 |
- * for 5, p mod 10 == 3 or 7 |
78 |
- * should hold. |
79 |
- */ |
80 |
- |
81 |
-int Cryptography_DH_check(const DH *dh, int *ret) |
82 |
-{ |
83 |
- int ok = 0, r; |
84 |
- BN_CTX *ctx = NULL; |
85 |
- BN_ULONG l; |
86 |
- BIGNUM *t1 = NULL, *t2 = NULL; |
87 |
- |
88 |
- *ret = 0; |
89 |
- ctx = BN_CTX_new(); |
90 |
- if (ctx == NULL) |
91 |
- goto err; |
92 |
- BN_CTX_start(ctx); |
93 |
- t1 = BN_CTX_get(ctx); |
94 |
- if (t1 == NULL) |
95 |
- goto err; |
96 |
- t2 = BN_CTX_get(ctx); |
97 |
- if (t2 == NULL) |
98 |
- goto err; |
99 |
- |
100 |
- if (dh->q) { |
101 |
- if (BN_cmp(dh->g, BN_value_one()) <= 0) |
102 |
- *ret |= DH_NOT_SUITABLE_GENERATOR; |
103 |
- else if (BN_cmp(dh->g, dh->p) >= 0) |
104 |
- *ret |= DH_NOT_SUITABLE_GENERATOR; |
105 |
- else { |
106 |
- /* Check g^q == 1 mod p */ |
107 |
- if (!BN_mod_exp(t1, dh->g, dh->q, dh->p, ctx)) |
108 |
- goto err; |
109 |
- if (!BN_is_one(t1)) |
110 |
- *ret |= DH_NOT_SUITABLE_GENERATOR; |
111 |
- } |
112 |
- r = BN_is_prime_ex(dh->q, BN_prime_checks, ctx, NULL); |
113 |
- if (r < 0) |
114 |
- goto err; |
115 |
- if (!r) |
116 |
- *ret |= DH_CHECK_Q_NOT_PRIME; |
117 |
- /* Check p == 1 mod q i.e. q divides p - 1 */ |
118 |
- if (!BN_div(t1, t2, dh->p, dh->q, ctx)) |
119 |
- goto err; |
120 |
- if (!BN_is_one(t2)) |
121 |
- *ret |= DH_CHECK_INVALID_Q_VALUE; |
122 |
- if (dh->j && BN_cmp(dh->j, t1)) |
123 |
- *ret |= DH_CHECK_INVALID_J_VALUE; |
124 |
- |
125 |
- } else if (BN_is_word(dh->g, DH_GENERATOR_2)) { |
126 |
- l = BN_mod_word(dh->p, 24); |
127 |
- if (l == (BN_ULONG)-1) |
128 |
- goto err; |
129 |
- if (l != 11) |
130 |
- *ret |= DH_NOT_SUITABLE_GENERATOR; |
131 |
- } else if (BN_is_word(dh->g, DH_GENERATOR_5)) { |
132 |
- l = BN_mod_word(dh->p, 10); |
133 |
- if (l == (BN_ULONG)-1) |
134 |
- goto err; |
135 |
- if ((l != 3) && (l != 7)) |
136 |
- *ret |= DH_NOT_SUITABLE_GENERATOR; |
137 |
- } else |
138 |
- *ret |= DH_UNABLE_TO_CHECK_GENERATOR; |
139 |
- |
140 |
- r = BN_is_prime_ex(dh->p, BN_prime_checks, ctx, NULL); |
141 |
- if (r < 0) |
142 |
- goto err; |
143 |
- if (!r) |
144 |
- *ret |= DH_CHECK_P_NOT_PRIME; |
145 |
- else if (!dh->q) { |
146 |
- if (!BN_rshift1(t1, dh->p)) |
147 |
- goto err; |
148 |
- r = BN_is_prime_ex(t1, BN_prime_checks, ctx, NULL); |
149 |
- if (r < 0) |
150 |
- goto err; |
151 |
- if (!r) |
152 |
- *ret |= DH_CHECK_P_NOT_SAFE_PRIME; |
153 |
- } |
154 |
- ok = 1; |
155 |
- err: |
156 |
- if (ctx != NULL) { |
157 |
- BN_CTX_end(ctx); |
158 |
- BN_CTX_free(ctx); |
159 |
- } |
160 |
- return (ok); |
161 |
-} |
162 |
-#else |
163 |
int Cryptography_DH_check(const DH *dh, int *ret) { |
164 |
return DH_check(dh, ret); |
165 |
} |
166 |
-#endif |
167 |
|
168 |
/* These functions were added in OpenSSL 1.1.0f commit d0c50e80a8 */ |
169 |
/* Define our own to simplify support across all versions. */ |
170 |
--- src/_cffi_src/openssl/evp.py.orig 2021-08-24 17:02:37 UTC |
171 |
+++ src/_cffi_src/openssl/evp.py |
172 |
@@ -203,7 +203,20 @@ int (*EVP_PKEY_set1_tls_encodedpoint)(EVP_PKEY *, cons |
173 |
size_t) = NULL; |
174 |
#endif |
175 |
|
176 |
-#if CRYPTOGRAPHY_OPENSSL_LESS_THAN_111 |
177 |
+#if CRYPTOGRAPHY_IS_LIBRESSL |
178 |
+static const long Cryptography_HAS_ONESHOT_EVP_DIGEST_SIGN_VERIFY = 1; |
179 |
+static const long Cryptography_HAS_RAW_KEY = 0; |
180 |
+static const long Cryptography_HAS_EVP_DIGESTFINAL_XOF = 0; |
181 |
+int (*EVP_DigestFinalXOF)(EVP_MD_CTX *, unsigned char *, size_t) = NULL; |
182 |
+EVP_PKEY *(*EVP_PKEY_new_raw_private_key)(int, ENGINE *, const unsigned char *, |
183 |
+ size_t) = NULL; |
184 |
+EVP_PKEY *(*EVP_PKEY_new_raw_public_key)(int, ENGINE *, const unsigned char *, |
185 |
+ size_t) = NULL; |
186 |
+int (*EVP_PKEY_get_raw_private_key)(const EVP_PKEY *, unsigned char *, |
187 |
+ size_t *) = NULL; |
188 |
+int (*EVP_PKEY_get_raw_public_key)(const EVP_PKEY *, unsigned char *, |
189 |
+ size_t *) = NULL; |
190 |
+#elif CRYPTOGRAPHY_OPENSSL_LESS_THAN_111 |
191 |
static const long Cryptography_HAS_ONESHOT_EVP_DIGEST_SIGN_VERIFY = 0; |
192 |
static const long Cryptography_HAS_RAW_KEY = 0; |
193 |
static const long Cryptography_HAS_EVP_DIGESTFINAL_XOF = 0; |
194 |
--- src/_cffi_src/openssl/fips.py.orig 2021-08-24 17:17:17 UTC |
195 |
+++ src/_cffi_src/openssl/fips.py |
196 |
@@ -17,11 +17,5 @@ int FIPS_mode(void); |
197 |
""" |
198 |
|
199 |
CUSTOMIZATIONS = """ |
200 |
-#if CRYPTOGRAPHY_IS_LIBRESSL |
201 |
-static const long Cryptography_HAS_FIPS = 0; |
202 |
-int (*FIPS_mode_set)(int) = NULL; |
203 |
-int (*FIPS_mode)(void) = NULL; |
204 |
-#else |
205 |
static const long Cryptography_HAS_FIPS = 1; |
206 |
-#endif |
207 |
""" |
208 |
--- src/_cffi_src/openssl/ocsp.py.orig 2021-08-24 17:17:17 UTC |
209 |
+++ src/_cffi_src/openssl/ocsp.py |
210 |
@@ -77,7 +77,6 @@ int i2d_OCSP_RESPDATA(OCSP_RESPDATA *, unsigned char * |
211 |
|
212 |
CUSTOMIZATIONS = """ |
213 |
#if ( \ |
214 |
- !CRYPTOGRAPHY_IS_LIBRESSL && \ |
215 |
CRYPTOGRAPHY_OPENSSL_LESS_THAN_110J \ |
216 |
) |
217 |
/* These structs come from ocsp_lcl.h and are needed to de-opaque the struct |
218 |
@@ -104,62 +103,15 @@ struct ocsp_basic_response_st { |
219 |
}; |
220 |
#endif |
221 |
|
222 |
-#if CRYPTOGRAPHY_IS_LIBRESSL |
223 |
-/* These functions are all taken from ocsp_cl.c in OpenSSL 1.1.0 */ |
224 |
-const OCSP_CERTID *OCSP_SINGLERESP_get0_id(const OCSP_SINGLERESP *single) |
225 |
-{ |
226 |
- return single->certId; |
227 |
-} |
228 |
-const Cryptography_STACK_OF_X509 *OCSP_resp_get0_certs( |
229 |
- const OCSP_BASICRESP *bs) |
230 |
-{ |
231 |
- return bs->certs; |
232 |
-} |
233 |
-int OCSP_resp_get0_id(const OCSP_BASICRESP *bs, |
234 |
- const ASN1_OCTET_STRING **pid, |
235 |
- const X509_NAME **pname) |
236 |
-{ |
237 |
- const OCSP_RESPID *rid = bs->tbsResponseData->responderId; |
238 |
- |
239 |
- if (rid->type == V_OCSP_RESPID_NAME) { |
240 |
- *pname = rid->value.byName; |
241 |
- *pid = NULL; |
242 |
- } else if (rid->type == V_OCSP_RESPID_KEY) { |
243 |
- *pid = rid->value.byKey; |
244 |
- *pname = NULL; |
245 |
- } else { |
246 |
- return 0; |
247 |
- } |
248 |
- return 1; |
249 |
-} |
250 |
-const ASN1_GENERALIZEDTIME *OCSP_resp_get0_produced_at( |
251 |
- const OCSP_BASICRESP* bs) |
252 |
-{ |
253 |
- return bs->tbsResponseData->producedAt; |
254 |
-} |
255 |
-const ASN1_OCTET_STRING *OCSP_resp_get0_signature(const OCSP_BASICRESP *bs) |
256 |
-{ |
257 |
- return bs->signature; |
258 |
-} |
259 |
-#endif |
260 |
- |
261 |
#if CRYPTOGRAPHY_OPENSSL_LESS_THAN_110J |
262 |
const X509_ALGOR *OCSP_resp_get0_tbs_sigalg(const OCSP_BASICRESP *bs) |
263 |
{ |
264 |
-#if CRYPTOGRAPHY_IS_LIBRESSL |
265 |
- return bs->signatureAlgorithm; |
266 |
-#else |
267 |
return &bs->signatureAlgorithm; |
268 |
-#endif |
269 |
} |
270 |
|
271 |
const OCSP_RESPDATA *OCSP_resp_get0_respdata(const OCSP_BASICRESP *bs) |
272 |
{ |
273 |
-#if CRYPTOGRAPHY_IS_LIBRESSL |
274 |
- return bs->tbsResponseData; |
275 |
-#else |
276 |
return &bs->tbsResponseData; |
277 |
-#endif |
278 |
} |
279 |
#endif |
280 |
""" |
281 |
--- src/_cffi_src/openssl/ssl.py.orig 2021-08-24 17:17:17 UTC |
282 |
+++ src/_cffi_src/openssl/ssl.py |
283 |
@@ -515,12 +515,7 @@ CUSTOMIZATIONS = """ |
284 |
// users have upgraded. PersistentlyDeprecated2020 |
285 |
static const long Cryptography_HAS_TLSEXT_HOSTNAME = 1; |
286 |
|
287 |
-#if CRYPTOGRAPHY_IS_LIBRESSL |
288 |
-static const long Cryptography_HAS_VERIFIED_CHAIN = 0; |
289 |
-Cryptography_STACK_OF_X509 *(*SSL_get0_verified_chain)(const SSL *) = NULL; |
290 |
-#else |
291 |
static const long Cryptography_HAS_VERIFIED_CHAIN = 1; |
292 |
-#endif |
293 |
|
294 |
#if CRYPTOGRAPHY_OPENSSL_LESS_THAN_111 |
295 |
static const long Cryptography_HAS_KEYLOG = 0; |
296 |
@@ -586,8 +581,6 @@ static const long TLS_ST_OK = 0; |
297 |
#endif |
298 |
|
299 |
#if CRYPTOGRAPHY_IS_LIBRESSL |
300 |
-static const long SSL_OP_NO_DTLSv1 = 0; |
301 |
-static const long SSL_OP_NO_DTLSv1_2 = 0; |
302 |
long (*DTLS_set_link_mtu)(SSL *, long) = NULL; |
303 |
long (*DTLS_get_link_min_mtu)(SSL *) = NULL; |
304 |
#endif |
305 |
--- src/_cffi_src/openssl/x509.py.orig 2021-08-24 17:02:37 UTC |
306 |
+++ src/_cffi_src/openssl/x509.py |
307 |
@@ -276,33 +276,8 @@ void X509_REQ_get0_signature(const X509_REQ *, const A |
308 |
""" |
309 |
|
310 |
CUSTOMIZATIONS = """ |
311 |
-#if CRYPTOGRAPHY_IS_LIBRESSL |
312 |
-int i2d_re_X509_tbs(X509 *x, unsigned char **pp) |
313 |
-{ |
314 |
- /* in 1.0.2+ this function also sets x->cert_info->enc.modified = 1 |
315 |
- but older OpenSSLs don't have the enc ASN1_ENCODING member in the |
316 |
- X509 struct. Setting modified to 1 marks the encoding |
317 |
- (x->cert_info->enc.enc) as invalid, but since the entire struct isn't |
318 |
- present we don't care. */ |
319 |
- return i2d_X509_CINF(x->cert_info, pp); |
320 |
-} |
321 |
-#endif |
322 |
- |
323 |
/* Being kept around for pyOpenSSL */ |
324 |
X509_REVOKED *Cryptography_X509_REVOKED_dup(X509_REVOKED *rev) { |
325 |
return X509_REVOKED_dup(rev); |
326 |
} |
327 |
-/* Added in 1.1.0 but we need it in all versions now due to the great |
328 |
- opaquing. */ |
329 |
-#if CRYPTOGRAPHY_IS_LIBRESSL |
330 |
-int i2d_re_X509_REQ_tbs(X509_REQ *req, unsigned char **pp) |
331 |
-{ |
332 |
- req->req_info->enc.modified = 1; |
333 |
- return i2d_X509_REQ_INFO(req->req_info, pp); |
334 |
-} |
335 |
-int i2d_re_X509_CRL_tbs(X509_CRL *crl, unsigned char **pp) { |
336 |
- crl->crl->enc.modified = 1; |
337 |
- return i2d_X509_CRL_INFO(crl->crl, pp); |
338 |
-} |
339 |
-#endif |
340 |
""" |