View | Details | Raw Unified | Return to bug 226906 | Differences between
and this patch

Collapse All | Expand All

(-)security/py-cryptography/Makefile (-3 / +6 lines)
Lines 2-8 Link Here
2
# $FreeBSD$
2
# $FreeBSD$
3
3
4
PORTNAME=	cryptography
4
PORTNAME=	cryptography
5
PORTVERSION=	2.1.4
5
PORTVERSION=	2.2.2
6
CATEGORIES=	security python
6
CATEGORIES=	security python
7
MASTER_SITES=	CHEESESHOP
7
MASTER_SITES=	CHEESESHOP
8
PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
8
PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
Lines 21-28 RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}six>=1.4.1:devel/py-six@${FLAVOR} \ Link Here
21
		${PYTHON_PKGNAMEPREFIX}cffi>=1.7:devel/py-cffi@${FLAVOR} \
21
		${PYTHON_PKGNAMEPREFIX}cffi>=1.7:devel/py-cffi@${FLAVOR} \
22
		${PY_ENUM34} ${PY_IPADDRESS} \
22
		${PY_ENUM34} ${PY_IPADDRESS} \
23
		${PYTHON_PKGNAMEPREFIX}idna>=2.1:dns/py-idna@${FLAVOR}
23
		${PYTHON_PKGNAMEPREFIX}idna>=2.1:dns/py-idna@${FLAVOR}
24
TEST_DEPENDS=	${PYTHON_PKGNAMEPREFIX}pytest>=2.9.0:devel/py-pytest@${FLAVOR} \
24
TEST_DEPENDS=	${PYTHON_PKGNAMEPREFIX}pytest>=3.2.1:devel/py-pytest@${FLAVOR} \
25
		${PYTHON_PKGNAMEPREFIX}iso8601>0:devel/py-iso8601@${FLAVOR}
25
		${PYTHON_PKGNAMEPREFIX}pretend>0:devel/py-pretend@${FLAVOR} \
26
		${PYTHON_PKGNAMEPREFIX}iso8601>0:devel/py-iso8601@${FLAVOR} \
27
		${PYTHON_PKGNAMEPREFIX}pytz>0:devel/py-pytz@${FLAVOR} \
28
		${PYTHON_PKGNAMEPREFIX}hypothesis>=1.11.4:devel/py-hypothesis@${FLAVOR}
26
29
27
# Python 2.7, 3.4-3.6
30
# Python 2.7, 3.4-3.6
28
USES=		compiler:env python ssl
31
USES=		compiler:env python ssl
(-)security/py-cryptography/distinfo (-3 / +3 lines)
Lines 1-3 Link Here
1
TIMESTAMP = 1516631948
1
TIMESTAMP = 1526081245
2
SHA256 (cryptography-2.1.4.tar.gz) = e4d967371c5b6b2e67855066471d844c5d52d210c36c28d49a8507b96e2c5291
2
SHA256 (cryptography-2.2.2.tar.gz) = 9fc295bf69130a342e7a19a39d7bbeb15c0bcaabc7382ec33ef3b2b7d18d2f63
3
SIZE (cryptography-2.1.4.tar.gz) = 441557
3
SIZE (cryptography-2.2.2.tar.gz) = 443822
(-)security/py-cryptography/files/patch-src___cffi__src_openssl_bignum.py (+94 lines)
Added Link Here
1
--- src/_cffi_src/openssl/bignum.py.orig	2018-03-27 14:12:05 UTC
2
+++ src/_cffi_src/openssl/bignum.py
3
@@ -10,17 +10,21 @@ INCLUDES = """
4
 
5
 TYPES = """
6
 typedef ... BN_CTX;
7
+typedef ... BN_MONT_CTX;
8
 typedef ... BIGNUM;
9
 typedef int... BN_ULONG;
10
 """
11
 
12
 FUNCTIONS = """
13
+#define BN_FLG_CONSTTIME ...
14
+
15
+void BN_set_flags(BIGNUM *, int);
16
+
17
 BIGNUM *BN_new(void);
18
 void BN_free(BIGNUM *);
19
 void BN_clear_free(BIGNUM *);
20
 
21
-int BN_rand(BIGNUM *, int, int, int);
22
-int BN_rand_range(BIGNUM *, BIGNUM *);
23
+int BN_rand_range(BIGNUM *, const BIGNUM *);
24
 
25
 BN_CTX *BN_CTX_new(void);
26
 void BN_CTX_free(BN_CTX *);
27
@@ -29,17 +33,18 @@ void BN_CTX_start(BN_CTX *);
28
 BIGNUM *BN_CTX_get(BN_CTX *);
29
 void BN_CTX_end(BN_CTX *);
30
 
31
-BIGNUM *BN_copy(BIGNUM *, const BIGNUM *);
32
+BN_MONT_CTX *BN_MONT_CTX_new(void);
33
+int BN_MONT_CTX_set(BN_MONT_CTX *, const BIGNUM *, BN_CTX *);
34
+void BN_MONT_CTX_free(BN_MONT_CTX *);
35
+
36
 BIGNUM *BN_dup(const BIGNUM *);
37
 
38
 int BN_set_word(BIGNUM *, BN_ULONG);
39
-BN_ULONG BN_get_word(const BIGNUM *);
40
 
41
 const BIGNUM *BN_value_one(void);
42
 
43
 char *BN_bn2hex(const BIGNUM *);
44
 int BN_hex2bn(BIGNUM **, const char *);
45
-int BN_dec2bn(BIGNUM **, const char *);
46
 
47
 int BN_bn2bin(const BIGNUM *, unsigned char *);
48
 BIGNUM *BN_bin2bn(const unsigned char *, int, BIGNUM *);
49
@@ -49,9 +54,6 @@ int BN_num_bits(const BIGNUM *);
50
 int BN_cmp(const BIGNUM *, const BIGNUM *);
51
 int BN_add(BIGNUM *, const BIGNUM *, const BIGNUM *);
52
 int BN_sub(BIGNUM *, const BIGNUM *, const BIGNUM *);
53
-int BN_mul(BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *);
54
-int BN_sqr(BIGNUM *, const BIGNUM *, BN_CTX *);
55
-int BN_div(BIGNUM *, BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *);
56
 int BN_nnmod(BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *);
57
 int BN_mod_add(BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *,
58
                BN_CTX *);
59
@@ -59,31 +61,17 @@ int BN_mod_sub(BIGNUM *, const BIGNUM *, const BIGNUM 
60
                BN_CTX *);
61
 int BN_mod_mul(BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *,
62
                BN_CTX *);
63
-int BN_mod_sqr(BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *);
64
-int BN_exp(BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *);
65
 int BN_mod_exp(BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *,
66
                BN_CTX *);
67
-int BN_gcd(BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *);
68
+int BN_mod_exp_mont(BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *,
69
+                    BN_CTX *, BN_MONT_CTX *);
70
+int BN_mod_exp_mont_consttime(BIGNUM *, const BIGNUM *, const BIGNUM *,
71
+                              const BIGNUM *, BN_CTX *, BN_MONT_CTX *);
72
 BIGNUM *BN_mod_inverse(BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *);
73
 
74
-int BN_set_bit(BIGNUM *, int);
75
-int BN_clear_bit(BIGNUM *, int);
76
-
77
-int BN_is_bit_set(const BIGNUM *, int);
78
-
79
-int BN_mask_bits(BIGNUM *, int);
80
-
81
 int BN_num_bytes(const BIGNUM *);
82
 
83
-int BN_zero(BIGNUM *);
84
-int BN_one(BIGNUM *);
85
 int BN_mod(BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *);
86
-
87
-int BN_lshift(BIGNUM *, const BIGNUM *, int);
88
-int BN_lshift1(BIGNUM *, BIGNUM *);
89
-
90
-int BN_rshift(BIGNUM *, BIGNUM *, int);
91
-int BN_rshift1(BIGNUM *, BIGNUM *);
92
 """
93
 
94
 CUSTOMIZATIONS = """
(-)security/py-cryptography/files/patch-src___cffi__src_openssl_bio.py (+149 lines)
Added Link Here
1
--- src/_cffi_src/openssl/bio.py.orig	2018-03-27 14:12:05 UTC
2
+++ src/_cffi_src/openssl/bio.py
3
@@ -9,142 +9,38 @@ INCLUDES = """
4
 """
5
 
6
 TYPES = """
7
-typedef struct bio_st BIO;
8
-typedef void bio_info_cb(BIO *, int, const char *, int, long, long);
9
-typedef ... bio_st;
10
+typedef ... BIO;
11
 typedef ... BIO_METHOD;
12
-typedef ... BUF_MEM;
13
-
14
-static const int BIO_TYPE_MEM;
15
-static const int BIO_TYPE_FILE;
16
-static const int BIO_TYPE_FD;
17
-static const int BIO_TYPE_SOCKET;
18
-static const int BIO_TYPE_CONNECT;
19
-static const int BIO_TYPE_ACCEPT;
20
-static const int BIO_TYPE_NULL;
21
-static const int BIO_CLOSE;
22
-static const int BIO_NOCLOSE;
23
-static const int BIO_TYPE_SOURCE_SINK;
24
-static const int BIO_CTRL_RESET;
25
-static const int BIO_CTRL_EOF;
26
-static const int BIO_CTRL_SET;
27
-static const int BIO_CTRL_SET_CLOSE;
28
-static const int BIO_CTRL_FLUSH;
29
-static const int BIO_CTRL_DUP;
30
-static const int BIO_CTRL_GET_CLOSE;
31
-static const int BIO_CTRL_INFO;
32
-static const int BIO_CTRL_GET;
33
-static const int BIO_CTRL_PENDING;
34
-static const int BIO_CTRL_WPENDING;
35
-static const int BIO_CTRL_DGRAM_SET_CONNECTED;
36
-static const int BIO_CTRL_DGRAM_SET_RECV_TIMEOUT;
37
-static const int BIO_CTRL_DGRAM_GET_RECV_TIMEOUT;
38
-static const int BIO_CTRL_DGRAM_SET_SEND_TIMEOUT;
39
-static const int BIO_CTRL_DGRAM_GET_SEND_TIMEOUT;
40
-static const int BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP;
41
-static const int BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP;
42
-static const int BIO_C_FILE_SEEK;
43
-static const int BIO_C_FILE_TELL;
44
-static const int BIO_TYPE_NONE;
45
-static const int BIO_TYPE_NBIO_TEST;
46
-static const int BIO_TYPE_BIO;
47
-static const int BIO_TYPE_DESCRIPTOR;
48
-static const int BIO_FLAGS_READ;
49
-static const int BIO_FLAGS_WRITE;
50
-static const int BIO_FLAGS_IO_SPECIAL;
51
-static const int BIO_FLAGS_RWS;
52
-static const int BIO_FLAGS_SHOULD_RETRY;
53
-static const int BIO_TYPE_NULL_FILTER;
54
-static const int BIO_TYPE_SSL;
55
-static const int BIO_TYPE_MD;
56
-static const int BIO_TYPE_BUFFER;
57
-static const int BIO_TYPE_CIPHER;
58
-static const int BIO_TYPE_BASE64;
59
-static const int BIO_TYPE_FILTER;
60
 """
61
 
62
 FUNCTIONS = """
63
 int BIO_free(BIO *);
64
-void BIO_vfree(BIO *);
65
-void BIO_free_all(BIO *);
66
-BIO *BIO_push(BIO *, BIO *);
67
-BIO *BIO_pop(BIO *);
68
-BIO *BIO_next(BIO *);
69
-BIO *BIO_find_type(BIO *, int);
70
 BIO *BIO_new_file(const char *, const char *);
71
-BIO *BIO_new_fp(FILE *, int);
72
-BIO *BIO_new_fd(int, int);
73
-BIO *BIO_new_socket(int, int);
74
 BIO *BIO_new_dgram(int, int);
75
-long BIO_ctrl(BIO *, int, long, void *);
76
-long BIO_callback_ctrl(
77
-    BIO *,
78
-    int,
79
-    void (*)(struct bio_st *, int, const char *, int, long, long)
80
-);
81
-long BIO_int_ctrl(BIO *, int, long, int);
82
 size_t BIO_ctrl_pending(BIO *);
83
-size_t BIO_ctrl_wpending(BIO *);
84
 int BIO_read(BIO *, void *, int);
85
 int BIO_gets(BIO *, char *, int);
86
 int BIO_write(BIO *, const void *, int);
87
-int BIO_puts(BIO *, const char *);
88
-int BIO_method_type(const BIO *);
89
 /* Added in 1.1.0 */
90
 int BIO_up_ref(BIO *);
91
 
92
-/* These added const to BIO_METHOD in 1.1.0 */
93
-BIO *BIO_new(BIO_METHOD *);
94
+BIO *BIO_new(const BIO_METHOD *);
95
 BIO_METHOD *BIO_s_mem(void);
96
-BIO_METHOD *BIO_s_file(void);
97
-BIO_METHOD *BIO_s_fd(void);
98
-BIO_METHOD *BIO_s_socket(void);
99
 BIO_METHOD *BIO_s_datagram(void);
100
-BIO_METHOD *BIO_s_null(void);
101
-BIO_METHOD *BIO_f_null(void);
102
-BIO_METHOD *BIO_f_buffer(void);
103
-/* BIO_new_mem_buf became const void * in 1.0.2g */
104
-BIO *BIO_new_mem_buf(void *, int);
105
-long BIO_set_fd(BIO *, int, long);
106
-long BIO_get_fd(BIO *, char *);
107
+BIO *BIO_new_mem_buf(const void *, int);
108
 long BIO_set_mem_eof_return(BIO *, int);
109
 long BIO_get_mem_data(BIO *, char **);
110
-long BIO_set_mem_buf(BIO *, BUF_MEM *, int);
111
-long BIO_get_mem_ptr(BIO *, BUF_MEM **);
112
-long BIO_set_fp(BIO *, FILE *, int);
113
-long BIO_get_fp(BIO *, FILE **);
114
-long BIO_read_filename(BIO *, char *);
115
-long BIO_write_filename(BIO *, char *);
116
-long BIO_append_filename(BIO *, char *);
117
-long BIO_rw_filename(BIO *, char *);
118
 int BIO_should_read(BIO *);
119
 int BIO_should_write(BIO *);
120
 int BIO_should_io_special(BIO *);
121
-int BIO_retry_type(BIO *);
122
 int BIO_should_retry(BIO *);
123
 int BIO_reset(BIO *);
124
-int BIO_seek(BIO *, int);
125
-int BIO_tell(BIO *);
126
-int BIO_flush(BIO *);
127
-int BIO_eof(BIO *);
128
-int BIO_set_close(BIO *,long);
129
-int BIO_get_close(BIO *);
130
-int BIO_pending(BIO *);
131
-int BIO_wpending(BIO *);
132
-int BIO_get_info_callback(BIO *, bio_info_cb **);
133
-int BIO_set_info_callback(BIO *, bio_info_cb *);
134
-long BIO_get_buffer_num_lines(BIO *);
135
-long BIO_set_read_buffer_size(BIO *, long);
136
-long BIO_set_write_buffer_size(BIO *, long);
137
-long BIO_set_buffer_size(BIO *, long);
138
-long BIO_set_buffer_read_data(BIO *, void *, long);
139
-long BIO_set_nbio(BIO *, long);
140
 void BIO_set_retry_read(BIO *);
141
 void BIO_clear_retry_flags(BIO *);
142
 """
143
 
144
 CUSTOMIZATIONS = """
145
-#if CRYPTOGRAPHY_OPENSSL_LESS_THAN_110PRE4
146
+#if CRYPTOGRAPHY_OPENSSL_LESS_THAN_110 && !CRYPTOGRAPHY_LIBRESSL_27_OR_GREATER
147
 int BIO_up_ref(BIO *b) {
148
     CRYPTO_add(&b->references, 1, CRYPTO_LOCK_BIO);
149
     return 1;
(-)security/py-cryptography/files/patch-src___cffi__src_openssl_callbacks.py (+13 lines)
Added Link Here
1
--- src/_cffi_src/openssl/callbacks.py.orig	2018-03-27 14:12:05 UTC
2
+++ src/_cffi_src/openssl/callbacks.py
3
@@ -11,7 +11,10 @@ INCLUDES = """
4
 #include <openssl/crypto.h>
5
 
6
 #ifdef _WIN32
7
+#define WIN32_LEAN_AND_MEAN
8
 #include <Windows.h>
9
+#include <Wincrypt.h>
10
+#include <Winsock2.h>
11
 #else
12
 #include <stdio.h>
13
 #include <stdlib.h>
(-)security/py-cryptography/files/patch-src___cffi__src_openssl_crypto.py (+10 lines)
Added Link Here
1
--- src/_cffi_src/openssl/crypto.py.orig	2018-03-27 14:12:05 UTC
2
+++ src/_cffi_src/openssl/crypto.py
3
@@ -143,6 +143,6 @@ void *Cryptography_realloc_wrapper(void *ptr, size_t s
4
 }
5
 
6
 void Cryptography_free_wrapper(void *ptr, const char *path, int line) {
7
-    return free(ptr);
8
+    free(ptr);
9
 }
10
 """
(-)security/py-cryptography/files/patch-src___cffi__src_openssl_cryptography.py (+31 lines)
Added Link Here
1
--- src/_cffi_src/openssl/cryptography.py.orig	2018-03-27 14:12:05 UTC
2
+++ src/_cffi_src/openssl/cryptography.py
3
@@ -22,9 +22,15 @@ INCLUDES = """
4
 #include <openssl/e_os2.h>
5
 #endif
6
 #if defined(_WIN32)
7
+#define WIN32_LEAN_AND_MEAN
8
 #include <windows.h>
9
+#include <Wincrypt.h>
10
+#include <Winsock2.h>
11
 #endif
12
 
13
+#define CRYPTOGRAPHY_LIBRESSL_27_OR_GREATER \
14
+    (CRYPTOGRAPHY_IS_LIBRESSL && LIBRESSL_VERSION_NUMBER >= 0x2070000fL)
15
+
16
 #define CRYPTOGRAPHY_OPENSSL_102_OR_GREATER \
17
     (OPENSSL_VERSION_NUMBER >= 0x10002000 && !CRYPTOGRAPHY_IS_LIBRESSL)
18
 #define CRYPTOGRAPHY_OPENSSL_102L_OR_GREATER \
19
@@ -40,12 +46,6 @@ INCLUDES = """
20
     (OPENSSL_VERSION_NUMBER < 0x1000209f || CRYPTOGRAPHY_IS_LIBRESSL)
21
 #define CRYPTOGRAPHY_OPENSSL_LESS_THAN_110 \
22
     (OPENSSL_VERSION_NUMBER < 0x10100000 || CRYPTOGRAPHY_IS_LIBRESSL)
23
-#define CRYPTOGRAPHY_OPENSSL_LESS_THAN_110PRE4 \
24
-    (OPENSSL_VERSION_NUMBER < 0x10100004 || CRYPTOGRAPHY_IS_LIBRESSL)
25
-#define CRYPTOGRAPHY_OPENSSL_LESS_THAN_110PRE5 \
26
-    (OPENSSL_VERSION_NUMBER < 0x10100005 || CRYPTOGRAPHY_IS_LIBRESSL)
27
-#define CRYPTOGRAPHY_OPENSSL_LESS_THAN_110PRE6 \
28
-    (OPENSSL_VERSION_NUMBER < 0x10100006 || CRYPTOGRAPHY_IS_LIBRESSL)
29
 """
30
 
31
 TYPES = """
(-)security/py-cryptography/files/patch-src___cffi__src_openssl_dh.py (+13 lines)
Added Link Here
1
--- src/_cffi_src/openssl/dh.py.orig	2018-03-27 14:12:05 UTC
2
+++ src/_cffi_src/openssl/dh.py
3
@@ -45,8 +45,8 @@ int Cryptography_i2d_DHxparams_bio(BIO *bp, DH *x);
4
 """
5
 
6
 CUSTOMIZATIONS = """
7
-/* These functions were added in OpenSSL 1.1.0-pre5 (beta2) */
8
-#if CRYPTOGRAPHY_OPENSSL_LESS_THAN_110PRE5
9
+/* These functions were added in OpenSSL 1.1.0 */
10
+#if CRYPTOGRAPHY_OPENSSL_LESS_THAN_110 && !CRYPTOGRAPHY_LIBRESSL_27_OR_GREATER
11
 void DH_get0_pqg(const DH *dh,
12
                  const BIGNUM **p, const BIGNUM **q, const BIGNUM **g)
13
 {
(-)security/py-cryptography/files/patch-src___cffi__src_openssl_dsa.py (+13 lines)
Added Link Here
1
--- src/_cffi_src/openssl/dsa.py.orig	2018-03-27 14:12:05 UTC
2
+++ src/_cffi_src/openssl/dsa.py
3
@@ -34,8 +34,8 @@ int DSA_generate_parameters_ex(DSA *, int, unsigned ch
4
 """
5
 
6
 CUSTOMIZATIONS = """
7
-/* These functions were added in OpenSSL 1.1.0-pre5 (beta2) */
8
-#if CRYPTOGRAPHY_OPENSSL_LESS_THAN_110PRE5
9
+/* These functions were added in OpenSSL 1.1.0 */
10
+#if CRYPTOGRAPHY_OPENSSL_LESS_THAN_110 && !CRYPTOGRAPHY_LIBRESSL_27_OR_GREATER
11
 void DSA_get0_pqg(const DSA *d,
12
                   const BIGNUM **p, const BIGNUM **q, const BIGNUM **g)
13
 {
(-)security/py-cryptography/files/patch-src___cffi__src_openssl_ec.py (+153 lines)
Added Link Here
1
--- src/_cffi_src/openssl/ec.py.orig	2018-03-27 14:12:05 UTC
2
+++ src/_cffi_src/openssl/ec.py
3
@@ -27,34 +27,16 @@ typedef struct {
4
 typedef enum {
5
     POINT_CONVERSION_COMPRESSED,
6
     POINT_CONVERSION_UNCOMPRESSED,
7
-    POINT_CONVERSION_HYBRID,
8
     ...
9
 } point_conversion_form_t;
10
 """
11
 
12
 FUNCTIONS = """
13
-EC_GROUP *EC_GROUP_new(const EC_METHOD *);
14
 void EC_GROUP_free(EC_GROUP *);
15
-void EC_GROUP_clear_free(EC_GROUP *);
16
 
17
-EC_GROUP *EC_GROUP_new_curve_GFp(
18
-    const BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *);
19
-EC_GROUP *EC_GROUP_new_curve_GF2m(
20
-    const BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *);
21
 EC_GROUP *EC_GROUP_new_by_curve_name(int);
22
 
23
-int EC_GROUP_set_curve_GFp(
24
-    EC_GROUP *, const BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *);
25
-int EC_GROUP_get_curve_GFp(
26
-    const EC_GROUP *, BIGNUM *, BIGNUM *, BIGNUM *, BN_CTX *);
27
-int EC_GROUP_set_curve_GF2m(
28
-    EC_GROUP *, const BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *);
29
-int EC_GROUP_get_curve_GF2m(
30
-    const EC_GROUP *, BIGNUM *, BIGNUM *, BIGNUM *, BN_CTX *);
31
-
32
 int EC_GROUP_get_degree(const EC_GROUP *);
33
-void EC_GROUP_set_asn1_flag(EC_GROUP *, int);
34
-void EC_GROUP_set_point_conversion_form(EC_GROUP *, point_conversion_form_t);
35
 
36
 const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *);
37
 const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *);
38
@@ -65,13 +47,7 @@ size_t EC_get_builtin_curves(EC_builtin_curve *, size_
39
 EC_KEY *EC_KEY_new(void);
40
 void EC_KEY_free(EC_KEY *);
41
 
42
-int EC_KEY_get_flags(const EC_KEY *);
43
-void EC_KEY_set_flags(EC_KEY *, int);
44
-void EC_KEY_clear_flags(EC_KEY *, int);
45
 EC_KEY *EC_KEY_new_by_curve_name(int);
46
-EC_KEY *EC_KEY_copy(EC_KEY *, EC_KEY *);
47
-EC_KEY *EC_KEY_dup(EC_KEY *);
48
-int EC_KEY_up_ref(EC_KEY *);
49
 const EC_GROUP *EC_KEY_get0_group(const EC_KEY *);
50
 int EC_GROUP_get_order(const EC_GROUP *, BIGNUM *, BN_CTX *);
51
 int EC_KEY_set_group(EC_KEY *, const EC_GROUP *);
52
@@ -79,31 +55,15 @@ const BIGNUM *EC_KEY_get0_private_key(const EC_KEY *);
53
 int EC_KEY_set_private_key(EC_KEY *, const BIGNUM *);
54
 const EC_POINT *EC_KEY_get0_public_key(const EC_KEY *);
55
 int EC_KEY_set_public_key(EC_KEY *, const EC_POINT *);
56
-unsigned int EC_KEY_get_enc_flags(const EC_KEY *);
57
-void EC_KEY_set_enc_flags(EC_KEY *eckey, unsigned int);
58
-point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *);
59
-void EC_KEY_set_conv_form(EC_KEY *, point_conversion_form_t);
60
 void EC_KEY_set_asn1_flag(EC_KEY *, int);
61
-int EC_KEY_precompute_mult(EC_KEY *, BN_CTX *);
62
 int EC_KEY_generate_key(EC_KEY *);
63
-int EC_KEY_check_key(const EC_KEY *);
64
 int EC_KEY_set_public_key_affine_coordinates(EC_KEY *, BIGNUM *, BIGNUM *);
65
 
66
 EC_POINT *EC_POINT_new(const EC_GROUP *);
67
 void EC_POINT_free(EC_POINT *);
68
 void EC_POINT_clear_free(EC_POINT *);
69
-int EC_POINT_copy(EC_POINT *, const EC_POINT *);
70
 EC_POINT *EC_POINT_dup(const EC_POINT *, const EC_GROUP *);
71
-const EC_METHOD *EC_POINT_method_of(const EC_POINT *);
72
 
73
-int EC_POINT_set_to_infinity(const EC_GROUP *, EC_POINT *);
74
-
75
-int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *, EC_POINT *,
76
-    const BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *);
77
-
78
-int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *,
79
-    const EC_POINT *, BIGNUM *, BIGNUM *, BIGNUM *, BN_CTX *);
80
-
81
 int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *, EC_POINT *,
82
     const BIGNUM *, const BIGNUM *, BN_CTX *);
83
 
84
@@ -129,18 +89,6 @@ size_t EC_POINT_point2oct(const EC_GROUP *, const EC_P
85
 int EC_POINT_oct2point(const EC_GROUP *, EC_POINT *,
86
     const unsigned char *, size_t, BN_CTX *);
87
 
88
-BIGNUM *EC_POINT_point2bn(const EC_GROUP *, const EC_POINT *,
89
-    point_conversion_form_t form, BIGNUM *, BN_CTX *);
90
-
91
-EC_POINT *EC_POINT_bn2point(const EC_GROUP *, const BIGNUM *,
92
-    EC_POINT *, BN_CTX *);
93
-
94
-char *EC_POINT_point2hex(const EC_GROUP *, const EC_POINT *,
95
-    point_conversion_form_t form, BN_CTX *);
96
-
97
-EC_POINT *EC_POINT_hex2point(const EC_GROUP *, const char *,
98
-    EC_POINT *, BN_CTX *);
99
-
100
 int EC_POINT_add(const EC_GROUP *, EC_POINT *, const EC_POINT *,
101
     const EC_POINT *, BN_CTX *);
102
 
103
@@ -152,25 +100,9 @@ int EC_POINT_is_on_curve(const EC_GROUP *, const EC_PO
104
 int EC_POINT_cmp(
105
     const EC_GROUP *, const EC_POINT *, const EC_POINT *, BN_CTX *);
106
 
107
-int EC_POINT_make_affine(const EC_GROUP *, EC_POINT *, BN_CTX *);
108
-int EC_POINTs_make_affine(const EC_GROUP *, size_t, EC_POINT *[], BN_CTX *);
109
-
110
-int EC_POINTs_mul(
111
-    const EC_GROUP *, EC_POINT *, const BIGNUM *,
112
-    size_t, const EC_POINT *[], const BIGNUM *[], BN_CTX *);
113
-
114
 int EC_POINT_mul(const EC_GROUP *, EC_POINT *, const BIGNUM *,
115
     const EC_POINT *, const BIGNUM *, BN_CTX *);
116
 
117
-int EC_GROUP_precompute_mult(EC_GROUP *, BN_CTX *);
118
-int EC_GROUP_have_precompute_mult(const EC_GROUP *);
119
-
120
-const EC_METHOD *EC_GFp_simple_method();
121
-const EC_METHOD *EC_GFp_mont_method();
122
-const EC_METHOD *EC_GFp_nist_method();
123
-
124
-const EC_METHOD *EC_GF2m_simple_method();
125
-
126
 int EC_METHOD_get_field_type(const EC_METHOD *);
127
 
128
 const char *EC_curve_nid2nist(int);
129
@@ -182,8 +114,6 @@ static const long Cryptography_HAS_EC = 1;
130
 #if defined(OPENSSL_NO_EC2M)
131
 static const long Cryptography_HAS_EC2M = 0;
132
 
133
-const EC_METHOD *(*EC_GF2m_simple_method)() = NULL;
134
-
135
 int (*EC_POINT_set_affine_coordinates_GF2m)(const EC_GROUP *, EC_POINT *,
136
     const BIGNUM *, const BIGNUM *, BN_CTX *) = NULL;
137
 
138
@@ -192,15 +122,6 @@ int (*EC_POINT_get_affine_coordinates_GF2m)(const EC_G
139
 
140
 int (*EC_POINT_set_compressed_coordinates_GF2m)(const EC_GROUP *, EC_POINT *,
141
     const BIGNUM *, int, BN_CTX *) = NULL;
142
-
143
-int (*EC_GROUP_set_curve_GF2m)(
144
-    EC_GROUP *, const BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *);
145
-
146
-int (*EC_GROUP_get_curve_GF2m)(
147
-    const EC_GROUP *, BIGNUM *, BIGNUM *, BIGNUM *, BN_CTX *);
148
-
149
-EC_GROUP *(*EC_GROUP_new_curve_GF2m)(
150
-    const BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *);
151
 #else
152
 static const long Cryptography_HAS_EC2M = 1;
153
 #endif
(-)security/py-cryptography/files/patch-src___cffi__src_openssl_ecdsa.py (+17 lines)
Added Link Here
1
--- src/_cffi_src/openssl/ecdsa.py.orig	2018-03-27 14:12:05 UTC
2
+++ src/_cffi_src/openssl/ecdsa.py
3
@@ -24,14 +24,9 @@ void ECDSA_SIG_free(ECDSA_SIG *);
4
 int i2d_ECDSA_SIG(const ECDSA_SIG *, unsigned char **);
5
 ECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **s, const unsigned char **, long);
6
 ECDSA_SIG *ECDSA_do_sign(const unsigned char *, int, EC_KEY *);
7
-ECDSA_SIG *ECDSA_do_sign_ex(const unsigned char *, int, const BIGNUM *,
8
-                            const BIGNUM *, EC_KEY *);
9
 int ECDSA_do_verify(const unsigned char *, int, const ECDSA_SIG *, EC_KEY *);
10
-int ECDSA_sign_setup(EC_KEY *, BN_CTX *, BIGNUM **, BIGNUM **);
11
 int ECDSA_sign(int, const unsigned char *, int, unsigned char *,
12
                unsigned int *, EC_KEY *);
13
-int ECDSA_sign_ex(int, const unsigned char *, int dgstlen, unsigned char *,
14
-                  unsigned int *, const BIGNUM *, const BIGNUM *, EC_KEY *);
15
 int ECDSA_verify(int, const unsigned char *, int, const unsigned char *, int,
16
                  EC_KEY *);
17
 int ECDSA_size(const EC_KEY *);
(-)security/py-cryptography/files/patch-src___cffi__src_openssl_err.py (+168 lines)
Added Link Here
1
--- src/_cffi_src/openssl/err.py.orig	2018-03-27 14:12:05 UTC
2
+++ src/_cffi_src/openssl/err.py
3
@@ -12,13 +12,6 @@ TYPES = """
4
 static const int Cryptography_HAS_EC_CODES;
5
 static const int Cryptography_HAS_RSA_R_PKCS_DECODING_ERROR;
6
 
7
-struct ERR_string_data_st {
8
-    unsigned long error;
9
-    const char *string;
10
-};
11
-typedef struct ERR_string_data_st ERR_STRING_DATA;
12
-typedef ... ERR_STATE;
13
-
14
 static const int ERR_LIB_DH;
15
 static const int ERR_LIB_EVP;
16
 static const int ERR_LIB_EC;
17
@@ -29,36 +22,6 @@ static const int ERR_LIB_PKCS12;
18
 static const int ERR_LIB_SSL;
19
 static const int ERR_LIB_X509;
20
 
21
-static const int ASN1_F_ASN1_EX_C2I;
22
-static const int ASN1_F_ASN1_FIND_END;
23
-static const int ASN1_F_ASN1_GENERATE_V3;
24
-static const int ASN1_F_ASN1_GET_OBJECT;
25
-static const int ASN1_F_ASN1_ITEM_I2D_FP;
26
-static const int ASN1_F_ASN1_ITEM_PACK;
27
-static const int ASN1_F_ASN1_ITEM_SIGN;
28
-static const int ASN1_F_ASN1_ITEM_UNPACK;
29
-static const int ASN1_F_ASN1_ITEM_VERIFY;
30
-static const int ASN1_F_ASN1_MBSTRING_NCOPY;
31
-static const int ASN1_F_ASN1_TEMPLATE_EX_D2I;
32
-static const int ASN1_F_ASN1_TEMPLATE_NEW;
33
-static const int ASN1_F_ASN1_TEMPLATE_NOEXP_D2I;
34
-static const int ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING;
35
-static const int ASN1_F_ASN1_TYPE_GET_OCTETSTRING;
36
-static const int ASN1_F_ASN1_VERIFY;
37
-static const int ASN1_F_BITSTR_CB;
38
-static const int ASN1_F_D2I_ASN1_UINTEGER;
39
-static const int ASN1_F_D2I_PRIVATEKEY;
40
-static const int ASN1_F_I2D_DSA_PUBKEY;
41
-static const int ASN1_F_LONG_C2I;
42
-static const int ASN1_F_OID_MODULE_INIT;
43
-static const int ASN1_F_PARSE_TAGGING;
44
-static const int ASN1_F_PKCS5_PBE_SET;
45
-static const int ASN1_F_B64_READ_ASN1;
46
-static const int ASN1_F_B64_WRITE_ASN1;
47
-static const int ASN1_F_SMIME_READ_ASN1;
48
-static const int ASN1_F_SMIME_TEXT;
49
-static const int ASN1_F_ASN1_CHECK_TLEN;
50
-
51
 static const int ASN1_R_BOOLEAN_IS_WRONG_LENGTH;
52
 static const int ASN1_R_BUFFER_TOO_SMALL;
53
 static const int ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER;
54
@@ -84,33 +47,9 @@ static const int ASN1_R_NO_MULTIPART_BODY_FAILURE;
55
 static const int ASN1_R_NO_MULTIPART_BOUNDARY;
56
 static const int ASN1_R_HEADER_TOO_LONG;
57
 
58
-static const int DH_F_COMPUTE_KEY;
59
-
60
 static const int DH_R_INVALID_PUBKEY;
61
 
62
-static const int EVP_F_AES_INIT_KEY;
63
-static const int EVP_F_EVP_CIPHER_CTX_CTRL;
64
-static const int EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH;
65
-static const int EVP_F_EVP_CIPHERINIT_EX;
66
-static const int EVP_F_EVP_DECRYPTFINAL_EX;
67
-static const int EVP_F_EVP_DIGESTINIT_EX;
68
 static const int EVP_F_EVP_ENCRYPTFINAL_EX;
69
-static const int EVP_F_EVP_MD_CTX_COPY_EX;
70
-static const int EVP_F_EVP_OPENINIT;
71
-static const int EVP_F_EVP_PBE_ALG_ADD;
72
-static const int EVP_F_EVP_PBE_CIPHERINIT;
73
-static const int EVP_F_EVP_PKCS82PKEY;
74
-static const int EVP_F_EVP_PKEY_COPY_PARAMETERS;
75
-static const int EVP_F_EVP_PKEY_DECRYPT;
76
-static const int EVP_F_EVP_PKEY_ENCRYPT;
77
-static const int EVP_F_EVP_PKEY_NEW;
78
-static const int EVP_F_EVP_SIGNFINAL;
79
-static const int EVP_F_EVP_VERIFYFINAL;
80
-static const int EVP_F_PKCS5_PBE_KEYIVGEN;
81
-static const int EVP_F_PKCS5_V2_PBE_KEYIVGEN;
82
-static const int EVP_F_RC2_MAGIC_TO_METH;
83
-static const int EVP_F_RC5_CTRL;
84
-static const int EVP_F_CAMELLIA_INIT_KEY;
85
 
86
 static const int EVP_R_AES_KEY_SETUP_FAILED;
87
 static const int EVP_R_BAD_DECRYPT;
88
@@ -137,33 +76,8 @@ static const int EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORIT
89
 static const int EVP_R_WRONG_FINAL_BLOCK_LENGTH;
90
 static const int EVP_R_CAMELLIA_KEY_SETUP_FAILED;
91
 
92
-static const int EC_F_EC_GROUP_NEW_BY_CURVE_NAME;
93
-
94
 static const int EC_R_UNKNOWN_GROUP;
95
 
96
-static const int PEM_F_D2I_PKCS8PRIVATEKEY_BIO;
97
-static const int PEM_F_D2I_PKCS8PRIVATEKEY_FP;
98
-static const int PEM_F_DO_PK8PKEY;
99
-static const int PEM_F_DO_PK8PKEY_FP;
100
-static const int PEM_F_LOAD_IV;
101
-static const int PEM_F_PEM_ASN1_READ;
102
-static const int PEM_F_PEM_ASN1_READ_BIO;
103
-static const int PEM_F_PEM_ASN1_WRITE;
104
-static const int PEM_F_PEM_ASN1_WRITE_BIO;
105
-static const int PEM_F_PEM_DEF_CALLBACK;
106
-static const int PEM_F_PEM_DO_HEADER;
107
-static const int PEM_F_PEM_GET_EVP_CIPHER_INFO;
108
-static const int PEM_F_PEM_READ;
109
-static const int PEM_F_PEM_READ_BIO;
110
-static const int PEM_F_PEM_READ_BIO_PRIVATEKEY;
111
-static const int PEM_F_PEM_READ_PRIVATEKEY;
112
-static const int PEM_F_PEM_SIGNFINAL;
113
-static const int PEM_F_PEM_WRITE;
114
-static const int PEM_F_PEM_WRITE_BIO;
115
-static const int PEM_F_PEM_X509_INFO_READ;
116
-static const int PEM_F_PEM_X509_INFO_READ_BIO;
117
-static const int PEM_F_PEM_X509_INFO_WRITE_BIO;
118
-
119
 static const int PEM_R_BAD_BASE64_DECODE;
120
 static const int PEM_R_BAD_DECRYPT;
121
 static const int PEM_R_BAD_END_LINE;
122
@@ -180,8 +94,6 @@ static const int PEM_R_SHORT_HEADER;
123
 static const int PEM_R_UNSUPPORTED_CIPHER;
124
 static const int PEM_R_UNSUPPORTED_ENCRYPTION;
125
 
126
-static const int PKCS12_F_PKCS12_PBE_CRYPT;
127
-
128
 static const int PKCS12_R_PKCS12_CIPHERFINAL_ERROR;
129
 
130
 static const int RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE;
131
@@ -191,7 +103,6 @@ static const int RSA_R_BLOCK_TYPE_IS_NOT_01;
132
 static const int RSA_R_BLOCK_TYPE_IS_NOT_02;
133
 static const int RSA_R_PKCS_DECODING_ERROR;
134
 static const int RSA_R_OAEP_DECODING_ERROR;
135
-static const int RSA_F_RSA_SIGN;
136
 
137
 static const int SSL_TLSEXT_ERR_OK;
138
 static const int SSL_TLSEXT_ERR_ALERT_WARNING;
139
@@ -235,29 +146,12 @@ void ERR_error_string_n(unsigned long, char *, size_t)
140
 const char *ERR_lib_error_string(unsigned long);
141
 const char *ERR_func_error_string(unsigned long);
142
 const char *ERR_reason_error_string(unsigned long);
143
-void ERR_print_errors(BIO *);
144
-void ERR_print_errors_fp(FILE *);
145
 unsigned long ERR_get_error(void);
146
 unsigned long ERR_peek_error(void);
147
 unsigned long ERR_peek_last_error(void);
148
-unsigned long ERR_get_error_line(const char **, int *);
149
-unsigned long ERR_peek_error_line(const char **, int *);
150
-unsigned long ERR_peek_last_error_line(const char **, int *);
151
-unsigned long ERR_get_error_line_data(const char **, int *,
152
-                                      const char **, int *);
153
 void ERR_clear_error(void);
154
-unsigned long ERR_peek_error_line_data(const char **,
155
-                                       int *, const char **, int *);
156
-unsigned long ERR_peek_last_error_line_data(const char **,
157
-                                            int *, const char **, int *);
158
 void ERR_put_error(int, int, int, const char *, int);
159
-void ERR_add_error_data(int, ...);
160
-int ERR_get_next_error_library(void);
161
-ERR_STATE *ERR_get_state(void);
162
-/* ERR_free_strings became a macro in 1.1.0 */
163
-void ERR_free_strings(void);
164
 
165
-unsigned long ERR_PACK(int, int, int);
166
 int ERR_GET_LIB(unsigned long);
167
 int ERR_GET_FUNC(unsigned long);
168
 int ERR_GET_REASON(unsigned long);
(-)security/py-cryptography/files/patch-src___cffi__src_openssl_rand.py (+15 lines)
Added Link Here
1
--- src/_cffi_src/openssl/rand.py.orig	2018-03-27 14:12:05 UTC
2
+++ src/_cffi_src/openssl/rand.py
3
@@ -13,12 +13,8 @@ static const long Cryptography_HAS_EGD;
4
 """
5
 
6
 FUNCTIONS = """
7
-void RAND_seed(const void *, int);
8
 void RAND_add(const void *, int, double);
9
 int RAND_status(void);
10
-const char *RAND_file_name(char *, size_t);
11
-int RAND_load_file(const char *, long);
12
-int RAND_write_file(const char *);
13
 int RAND_bytes(unsigned char *, int);
14
 /* ERR_load_RAND_strings started returning an int in 1.1.0. Unfortunately we
15
    can't declare a conditional signature like that. Since it always returns
(-)security/py-cryptography/files/patch-src___cffi__src_openssl_rsa.py (+47 lines)
Added Link Here
1
--- src/_cffi_src/openssl/rsa.py.orig	2018-03-27 14:12:05 UTC
2
+++ src/_cffi_src/openssl/rsa.py
3
@@ -12,10 +12,8 @@ TYPES = """
4
 typedef ... RSA;
5
 typedef ... BN_GENCB;
6
 static const int RSA_PKCS1_PADDING;
7
-static const int RSA_SSLV23_PADDING;
8
 static const int RSA_NO_PADDING;
9
 static const int RSA_PKCS1_OAEP_PADDING;
10
-static const int RSA_X931_PADDING;
11
 static const int RSA_PKCS1_PSS_PADDING;
12
 static const int RSA_F4;
13
 
14
@@ -32,7 +30,6 @@ int RSA_generate_key_ex(RSA *, int, BIGNUM *, BN_GENCB
15
 int RSA_check_key(const RSA *);
16
 RSA *RSAPublicKey_dup(RSA *);
17
 int RSA_blinding_on(RSA *, BN_CTX *);
18
-void RSA_blinding_off(RSA *);
19
 int RSA_public_encrypt(int, const unsigned char *, unsigned char *,
20
                        RSA *, int);
21
 int RSA_private_encrypt(int, const unsigned char *, unsigned char *,
22
@@ -42,14 +39,6 @@ int RSA_public_decrypt(int, const unsigned char *, uns
23
 int RSA_private_decrypt(int, const unsigned char *, unsigned char *,
24
                         RSA *, int);
25
 int RSA_print(BIO *, const RSA *, int);
26
-int RSA_verify_PKCS1_PSS(RSA *, const unsigned char *, const EVP_MD *,
27
-                         const unsigned char *, int);
28
-int RSA_padding_add_PKCS1_PSS(RSA *, unsigned char *, const unsigned char *,
29
-                              const EVP_MD *, int);
30
-int RSA_padding_add_PKCS1_OAEP(unsigned char *, int, const unsigned char *,
31
-                               int, const unsigned char *, int);
32
-int RSA_padding_check_PKCS1_OAEP(unsigned char *, int, const unsigned char *,
33
-                                 int, int, const unsigned char *, int);
34
 
35
 /* added in 1.1.0 when the RSA struct was opaqued */
36
 int RSA_set0_key(RSA *, BIGNUM *, BIGNUM *, BIGNUM *);
37
@@ -86,8 +75,8 @@ int (*EVP_PKEY_CTX_set0_rsa_oaep_label)(EVP_PKEY_CTX *
38
                                         int) = NULL;
39
 #endif
40
 
41
-/* These functions were added in OpenSSL 1.1.0-pre5 (beta2) */
42
-#if CRYPTOGRAPHY_OPENSSL_LESS_THAN_110PRE5
43
+/* These functions were added in OpenSSL 1.1.0 */
44
+#if CRYPTOGRAPHY_OPENSSL_LESS_THAN_110 && !CRYPTOGRAPHY_LIBRESSL_27_OR_GREATER
45
 int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d)
46
 {
47
     /* If the fields n and e in r are NULL, the corresponding input
(-)security/py-cryptography/files/patch-src___cffi__src_openssl_ssl.py (+154 lines)
Added Link Here
1
--- src/_cffi_src/openssl/ssl.py.orig	2018-03-27 14:12:05 UTC
2
+++ src/_cffi_src/openssl/ssl.py
3
@@ -48,6 +48,7 @@ static const long Cryptography_HAS_SSL_OP_NO_TICKET;
4
 static const long Cryptography_HAS_ALPN;
5
 static const long Cryptography_HAS_NEXTPROTONEG;
6
 static const long Cryptography_HAS_SET_CERT_CB;
7
+static const long Cryptography_HAS_CUSTOM_EXT;
8
 
9
 static const long SSL_FILETYPE_PEM;
10
 static const long SSL_FILETYPE_ASN1;
11
@@ -251,7 +252,7 @@ void SSL_CTX_set_psk_server_callback(SSL_CTX *,
12
                                          SSL *,
13
                                          const char *,
14
                                          unsigned char *,
15
-                                         int
16
+                                         unsigned int
17
                                      ));
18
 void SSL_CTX_set_psk_client_callback(SSL_CTX *,
19
                                      unsigned int (*)(
20
@@ -305,6 +306,10 @@ int SSL_CTX_set_ex_data(SSL_CTX *, int, void *);
21
 
22
 SSL_SESSION *SSL_get_session(const SSL *);
23
 const unsigned char *SSL_SESSION_get_id(const SSL_SESSION *, unsigned int *);
24
+long SSL_SESSION_get_time(const SSL_SESSION *);
25
+long SSL_SESSION_get_timeout(const SSL_SESSION *);
26
+int SSL_SESSION_has_ticket(const SSL_SESSION *);
27
+long SSL_SESSION_get_ticket_lifetime_hint(const SSL_SESSION *);
28
 
29
 /* not a macro, but older OpenSSLs don't pass the args as const */
30
 char *SSL_CIPHER_description(const SSL_CIPHER *, char *, int);
31
@@ -396,7 +401,7 @@ void *SSL_get_ex_data(const SSL *, int);
32
 void SSL_set_tlsext_host_name(SSL *, char *);
33
 void SSL_CTX_set_tlsext_servername_callback(
34
     SSL_CTX *,
35
-    int (*)(const SSL *, int *, void *));
36
+    int (*)(SSL *, int *, void *));
37
 void SSL_CTX_set_tlsext_servername_arg(
38
     SSL_CTX *, void *);
39
 
40
@@ -488,6 +493,35 @@ long Cryptography_DTLSv1_get_timeout(SSL *, time_t *, 
41
 long DTLSv1_handle_timeout(SSL *);
42
 long DTLS_set_link_mtu(SSL *, long);
43
 long DTLS_get_link_min_mtu(SSL *);
44
+
45
+/* Custom extensions. */
46
+typedef int (*custom_ext_add_cb)(SSL *, unsigned int,
47
+                                 const unsigned char **,
48
+                                 size_t *, int *,
49
+                                 void *);
50
+
51
+typedef void (*custom_ext_free_cb)(SSL *, unsigned int,
52
+                                   const unsigned char *,
53
+                                   void *);
54
+
55
+typedef int (*custom_ext_parse_cb)(SSL *, unsigned int,
56
+                                   const unsigned char *,
57
+                                   size_t, int *,
58
+                                   void *);
59
+
60
+int SSL_CTX_add_client_custom_ext(SSL_CTX *, unsigned int,
61
+                                  custom_ext_add_cb,
62
+                                  custom_ext_free_cb, void *,
63
+                                  custom_ext_parse_cb,
64
+                                  void *);
65
+
66
+int SSL_CTX_add_server_custom_ext(SSL_CTX *, unsigned int,
67
+                                  custom_ext_add_cb,
68
+                                  custom_ext_free_cb, void *,
69
+                                  custom_ext_parse_cb,
70
+                                  void *);
71
+
72
+int SSL_extension_supported(unsigned int);
73
 """
74
 
75
 CUSTOMIZATIONS = """
76
@@ -502,7 +536,7 @@ const SSL_METHOD *SSL_CTX_get_ssl_method(SSL_CTX *ctx)
77
 
78
 /* Added in 1.1.0 in the great opaquing, but we need to define it for older
79
    OpenSSLs. Such is our burden. */
80
-#if CRYPTOGRAPHY_OPENSSL_LESS_THAN_110
81
+#if CRYPTOGRAPHY_OPENSSL_LESS_THAN_110 && !CRYPTOGRAPHY_LIBRESSL_27_OR_GREATER
82
 /* from ssl/ssl_lib.c */
83
 size_t SSL_get_client_random(const SSL *ssl, unsigned char *out, size_t outlen)
84
 {
85
@@ -540,6 +574,16 @@ size_t SSL_SESSION_get_master_key(const SSL_SESSION *s
86
     memcpy(out, session->master_key, outlen);
87
     return outlen;
88
 }
89
+/* from ssl/ssl_sess.c */
90
+int SSL_SESSION_has_ticket(const SSL_SESSION *s)
91
+{
92
+    return (s->tlsext_ticklen > 0) ? 1 : 0;
93
+}
94
+/* from ssl/ssl_sess.c */
95
+unsigned long SSL_SESSION_get_ticket_lifetime_hint(const SSL_SESSION *s)
96
+{
97
+    return s->tlsext_tick_lifetime_hint;
98
+}
99
 #endif
100
 
101
 static const long Cryptography_HAS_SECURE_RENEGOTIATION = 1;
102
@@ -694,7 +738,7 @@ void (*SSL_CTX_set_psk_server_callback)(SSL_CTX *,
103
                                             SSL *,
104
                                             const char *,
105
                                             unsigned char *,
106
-                                            int
107
+                                            unsigned int
108
                                         )) = NULL;
109
 void (*SSL_CTX_set_psk_client_callback)(SSL_CTX *,
110
                                         unsigned int (*)(
111
@@ -707,5 +751,43 @@ void (*SSL_CTX_set_psk_client_callback)(SSL_CTX *,
112
                                         )) = NULL;
113
 #else
114
 static const long Cryptography_HAS_PSK = 1;
115
+#endif
116
+
117
+/*
118
+ * Custom extensions were added in 1.0.2. 1.1.1 is adding a more general
119
+ * SSL_CTX_add_custom_ext function, but we're not binding that yet.
120
+ */
121
+#if CRYPTOGRAPHY_OPENSSL_102_OR_GREATER
122
+static const long Cryptography_HAS_CUSTOM_EXT = 1;
123
+#else
124
+static const long Cryptography_HAS_CUSTOM_EXT = 0;
125
+
126
+typedef int (*custom_ext_add_cb)(SSL *, unsigned int,
127
+                                 const unsigned char **,
128
+                                 size_t *, int *,
129
+                                 void *);
130
+
131
+typedef void (*custom_ext_free_cb)(SSL *, unsigned int,
132
+                                   const unsigned char *,
133
+                                   void *);
134
+
135
+typedef int (*custom_ext_parse_cb)(SSL *, unsigned int,
136
+                                   const unsigned char *,
137
+                                   size_t, int *,
138
+                                   void *);
139
+
140
+int (*SSL_CTX_add_client_custom_ext)(SSL_CTX *, unsigned int,
141
+                                     custom_ext_add_cb,
142
+                                     custom_ext_free_cb, void *,
143
+                                     custom_ext_parse_cb,
144
+                                     void *) = NULL;
145
+
146
+int (*SSL_CTX_add_server_custom_ext)(SSL_CTX *, unsigned int,
147
+                                     custom_ext_add_cb,
148
+                                     custom_ext_free_cb, void *,
149
+                                     custom_ext_parse_cb,
150
+                                     void *) = NULL;
151
+
152
+int (*SSL_extension_supported)(unsigned int) = NULL;
153
 #endif
154
 """
(-)security/py-cryptography/files/patch-src___cffi__src_openssl_x509.py (+53 lines)
Added Link Here
1
--- src/_cffi_src/openssl/x509.py.orig	2018-03-27 14:12:05 UTC
2
+++ src/_cffi_src/openssl/x509.py
3
@@ -340,7 +340,7 @@ void X509_REQ_get0_signature(const X509_REQ *, const A
4
 CUSTOMIZATIONS = """
5
 /* Added in 1.0.2 beta but we need it in all versions now due to the great
6
    opaquing. */
7
-#if CRYPTOGRAPHY_OPENSSL_LESS_THAN_102
8
+#if CRYPTOGRAPHY_OPENSSL_LESS_THAN_102 && !CRYPTOGRAPHY_LIBRESSL_27_OR_GREATER
9
 /* from x509/x_x509.c version 1.0.2 */
10
 void X509_get0_signature(ASN1_BIT_STRING **psig, X509_ALGOR **palg,
11
                          const X509 *x)
12
@@ -387,7 +387,17 @@ X509_REVOKED *Cryptography_X509_REVOKED_dup(X509_REVOK
13
 /* Added in 1.1.0 but we need it in all versions now due to the great
14
    opaquing. */
15
 #if CRYPTOGRAPHY_OPENSSL_LESS_THAN_110
16
+int i2d_re_X509_REQ_tbs(X509_REQ *req, unsigned char **pp)
17
+{
18
+    req->req_info->enc.modified = 1;
19
+    return i2d_X509_REQ_INFO(req->req_info, pp);
20
+}
21
+int i2d_re_X509_CRL_tbs(X509_CRL *crl, unsigned char **pp) {
22
+    crl->crl->enc.modified = 1;
23
+    return i2d_X509_CRL_INFO(crl->crl, pp);
24
+}
25
 
26
+#if !CRYPTOGRAPHY_LIBRESSL_27_OR_GREATER
27
 int X509_up_ref(X509 *x) {
28
    return CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509);
29
 }
30
@@ -406,16 +416,6 @@ void X509_REQ_get0_signature(const X509_REQ *req, cons
31
     if (palg != NULL)
32
         *palg = req->sig_alg;
33
 }
34
-int i2d_re_X509_REQ_tbs(X509_REQ *req, unsigned char **pp)
35
-{
36
-    req->req_info->enc.modified = 1;
37
-    return i2d_X509_REQ_INFO(req->req_info, pp);
38
-}
39
-int i2d_re_X509_CRL_tbs(X509_CRL *crl, unsigned char **pp) {
40
-    crl->crl->enc.modified = 1;
41
-    return i2d_X509_CRL_INFO(crl->crl, pp);
42
-}
43
-
44
 void X509_CRL_get0_signature(const X509_CRL *crl, const ASN1_BIT_STRING **psig,
45
                              const X509_ALGOR **palg)
46
 {
47
@@ -432,5 +432,6 @@ const ASN1_INTEGER *X509_REVOKED_get0_serialNumber(con
48
 {
49
     return x->serialNumber;
50
 }
51
+#endif
52
 #endif
53
 """
(-)security/py-cryptography/files/patch-src___cffi__src_openssl_x509__vfy.py (+37 lines)
Added Link Here
1
--- src/_cffi_src/openssl/x509_vfy.py.orig	2018-03-27 14:12:05 UTC
2
+++ src/_cffi_src/openssl/x509_vfy.py
3
@@ -246,6 +246,7 @@ static const long X509_V_FLAG_SUITEB_128_LOS_ONLY = 0;
4
 static const long X509_V_FLAG_SUITEB_192_LOS = 0;
5
 static const long X509_V_FLAG_SUITEB_128_LOS = 0;
6
 
7
+#if !CRYPTOGRAPHY_LIBRESSL_27_OR_GREATER
8
 int (*X509_VERIFY_PARAM_set1_host)(X509_VERIFY_PARAM *, const char *,
9
                                    size_t) = NULL;
10
 int (*X509_VERIFY_PARAM_set1_email)(X509_VERIFY_PARAM *, const char *,
11
@@ -256,6 +257,7 @@ int (*X509_VERIFY_PARAM_set1_ip_asc)(X509_VERIFY_PARAM
12
 void (*X509_VERIFY_PARAM_set_hostflags)(X509_VERIFY_PARAM *,
13
                                         unsigned int) = NULL;
14
 #endif
15
+#endif
16
 
17
 /* OpenSSL 1.0.2+ or Solaris's backport */
18
 #ifdef X509_V_FLAG_PARTIAL_CHAIN
19
@@ -273,7 +275,7 @@ static const long Cryptography_HAS_X509_V_FLAG_TRUSTED
20
 static const long X509_V_FLAG_TRUSTED_FIRST = 0;
21
 #endif
22
 
23
-#if CRYPTOGRAPHY_OPENSSL_LESS_THAN_110PRE6
24
+#if CRYPTOGRAPHY_OPENSSL_LESS_THAN_110 && !CRYPTOGRAPHY_LIBRESSL_27_OR_GREATER
25
 Cryptography_STACK_OF_X509_OBJECT *X509_STORE_get0_objects(X509_STORE *ctx) {
26
     return ctx->objs;
27
 }
28
@@ -283,9 +285,7 @@ X509_VERIFY_PARAM *X509_STORE_get0_param(X509_STORE *s
29
 int X509_OBJECT_get_type(const X509_OBJECT *x) {
30
     return x->type;
31
 }
32
-#endif
33
 
34
-#if CRYPTOGRAPHY_OPENSSL_LESS_THAN_110PRE5
35
 /* from x509/x509_vfy.c */
36
 X509 *X509_STORE_CTX_get0_cert(X509_STORE_CTX *ctx)
37
 {
(-)security/py-cryptography/files/patch-src___cffi__src_openssl_x509name.py (+10 lines)
Added Link Here
1
--- src/_cffi_src/openssl/x509name.py.orig	2018-03-27 14:12:05 UTC
2
+++ src/_cffi_src/openssl/x509name.py
3
@@ -40,6 +40,7 @@ int Cryptography_X509_NAME_ENTRY_set(X509_NAME_ENTRY *
4
 int X509_NAME_entry_count(X509_NAME *);
5
 X509_NAME_ENTRY *X509_NAME_get_entry(X509_NAME *, int);
6
 char *X509_NAME_oneline(X509_NAME *, char *, int);
7
+int X509_NAME_print_ex(BIO *, X509_NAME *, int, unsigned long);
8
 
9
 /* These became const X509_NAME_ENTRY * in 1.1.0 */
10
 ASN1_OBJECT *X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *);

Return to bug 226906