forked from EnerNOC/pyopenssl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path0001-Added-TLS-1.1-1.2-support.patch
77 lines (69 loc) · 3.03 KB
/
0001-Added-TLS-1.1-1.2-support.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
From 2bf22122239ea5b3a0d059a546679121f6a1d346 Mon Sep 17 00:00:00 2001
From: Ben Summerton <[email protected]>
Date: Fri, 9 Aug 2013 10:48:15 -0400
Subject: [PATCH] Added TLS 1.1 & 1.2 support.
---
OpenSSL/ssl/context.c | 10 ++++++++--
OpenSSL/ssl/context.h | 2 ++
OpenSSL/ssl/ssl.c | 4 ++++
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/OpenSSL/ssl/context.c b/OpenSSL/ssl/context.c
index e971c0a..5268ecb 100644
--- a/OpenSSL/ssl/context.c
+++ b/OpenSSL/ssl/context.c
@@ -292,8 +292,8 @@ Context(method) -> Context instance\n\
OpenSSL.SSL.Context instances define the parameters for setting up new SSL\n\
connections.\n\
\n\
-:param method: One of " SSLv2_METHOD_TEXT "SSLv3_METHOD, SSLv23_METHOD, or\n\
- TLSv1_METHOD.\n\
+:param method: One of " SSLv2_METHOD_TEXT "SSLv3_METHOD, SSLv23_METHOD,\n\
+ TLSv1_METHOD, TLSv1_1_METHOD, OR TLSv1_2_METHOD.\n\
";
#undef SSLv2_METHOD_TEXT
@@ -1262,6 +1262,12 @@ ssl_Context_init(ssl_ContextObj *self, int i_method) {
case ssl_TLSv1_METHOD:
method = TLSv1_method();
break;
+ case ssl_TLSv1_1_METHOD:
+ method = TLSv1_1_method();
+ break;
+ case ssl_TLSv1_2_METHOD:
+ method = TLSv1_2_method();
+ break;
default:
PyErr_SetString(PyExc_ValueError, "No such protocol");
return NULL;
diff --git a/OpenSSL/ssl/context.h b/OpenSSL/ssl/context.h
index 19b5e9e..989d8f1 100644
--- a/OpenSSL/ssl/context.h
+++ b/OpenSSL/ssl/context.h
@@ -38,6 +38,8 @@ typedef struct {
#define ssl_SSLv3_METHOD (2)
#define ssl_SSLv23_METHOD (3)
#define ssl_TLSv1_METHOD (4)
+#define ssl_TLSv1_1_METHOD (5)
+#define ssl_TLSv1_2_METHOD (6)
#endif
diff --git a/OpenSSL/ssl/ssl.c b/OpenSSL/ssl/ssl.c
index 5725d5d..3ad0d96 100644
--- a/OpenSSL/ssl/ssl.c
+++ b/OpenSSL/ssl/ssl.c
@@ -185,6 +185,8 @@ do { \
PyModule_AddIntConstant(module, "SSLv3_METHOD", ssl_SSLv3_METHOD);
PyModule_AddIntConstant(module, "SSLv23_METHOD", ssl_SSLv23_METHOD);
PyModule_AddIntConstant(module, "TLSv1_METHOD", ssl_TLSv1_METHOD);
+ PyModule_AddIntConstant(module, "TLSv1_1_METHOD", ssl_TLSv1_1_METHOD);
+ PyModule_AddIntConstant(module, "TLSv1_2_METHOD", ssl_TLSv1_2_METHOD);
/* Verify constants */
PyModule_AddIntConstant(module, "VERIFY_NONE", SSL_VERIFY_NONE);
@@ -204,6 +206,8 @@ do { \
PyModule_AddIntConstant(module, "OP_NO_SSLv2", SSL_OP_NO_SSLv2);
PyModule_AddIntConstant(module, "OP_NO_SSLv3", SSL_OP_NO_SSLv3);
PyModule_AddIntConstant(module, "OP_NO_TLSv1", SSL_OP_NO_TLSv1);
+ PyModule_AddIntConstant(module, "OP_NO_TLSv1_1", SSL_OP_NO_TLSv1_1);
+ PyModule_AddIntConstant(module, "OP_NO_TLSv1_2", SSL_OP_NO_TLSv1_2);
/* More SSL option constants */
PyModule_AddIntConstant(module, "OP_MICROSOFT_SESS_ID_BUG", SSL_OP_MICROSOFT_SESS_ID_BUG);
--
1.7.12.4 (Apple Git-37)