Skip to content

Commit d8db72f

Browse files
authored
Merge pull request #54 from rizlik/support-disabling-scr
wolfssl-py: support disabling secure renegotiation
2 parents bb2c6b2 + ab486a3 commit d8db72f

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

README.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,16 @@ wolfSSL library. For example:
6666
# Uses custom install location
6767
$ USE_LOCAL_WOLFSSL=/tmp/install pip install .
6868
69+
Disabling secure renegotiation
70+
------------------------------
71+
72+
When building wolfssl-py from source secure renegotiation is enabled by
73+
default. To disable secure renegotiation set the environment variable
74+
WOLFSSLPY_DISABLE_SCR during the build process. For example:
75+
76+
.. code-block:: bash
77+
$ WOLFSSLPY_DISABLE_SCR=1 pip install .
78+
6979
Testing
7080
=======
7181

wolfssl/_build_ffi.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ def make_flags(prefix, debug):
142142
"""
143143
flags = []
144144
cflags = []
145+
# defaults to None (that eval to False)
146+
disable_scr = os.getenv("WOLFSSLPY_DISABLE_SCR")
145147

146148
if get_platform() in ["linux-x86_64", "linux-i686"]:
147149
cflags.append("-fpic")
@@ -171,7 +173,8 @@ def make_flags(prefix, debug):
171173
cflags.append("-DKEEP_PEER_CERT")
172174

173175
# for pyOpenSSL
174-
flags.append("--enable-secure-renegotiation")
176+
if not disable_scr:
177+
flags.append("--enable-secure-renegotiation")
175178
flags.append("--enable-opensslall")
176179
cflags.append("-DFP_MAX_BITS=8192")
177180
cflags.append("-DHAVE_EX_DATA")

wolfssl/_openssl.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
2222

2323
# pylint: disable=missing-docstring, invalid-name
24+
import os
2425

2526
source = """
2627
#include <wolfssl/options.h>
@@ -248,7 +249,6 @@ def construct_cdef(optional_funcs, OLDTLS_ENABLED):
248249
X509* SSL_get_peer_certificate(SSL*);
249250
const char* SSL_alert_type_string_long(int);
250251
const char* SSL_alert_desc_string_long(int);
251-
int SSL_renegotiate(SSL*);
252252
void SSL_get0_next_proto_negotiated(const SSL*,
253253
const unsigned char**, unsigned*);
254254
const char* SSL_get_servername(SSL*, unsigned char);
@@ -306,6 +306,13 @@ def construct_cdef(optional_funcs, OLDTLS_ENABLED):
306306
int OBJ_txt2nid(const char*);
307307
"""
308308

309+
# defaults to None (that eval to False)
310+
disable_scr = os.getenv("WOLFSSLPY_DISABLE_SCR")
311+
if not disable_scr:
312+
cdef += """
313+
int SSL_renegotiate(SSL*);
314+
"""
315+
309316
for func in optional_funcs:
310317
cdef += "{};".format(func.ossl_sig)
311318

0 commit comments

Comments
 (0)