From dd55dffb0c7b330785903637c949a29056bb5d79 Mon Sep 17 00:00:00 2001 From: mcfreis Date: Mon, 20 Mar 2017 14:51:50 +0100 Subject: [PATCH] Added methods *_clear_options() and *_get_options() * dtls/openssl.py: - Added SSL_CTX_clear_options() and SSL_CTX_get_options() - Added SSL_clear_options() and SSL_get_options() --- ChangeLog | 8 ++++++++ dtls/openssl.py | 17 +++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 83e7251..f7538b0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-03-17 Björn Freise + + Added methods *_clear_options() and *_get_options() + + * dtls/openssl.py: + - Added SSL_CTX_clear_options() and SSL_CTX_get_options() + - Added SSL_clear_options() and SSL_get_options() + 2017-03-17 Björn Freise Added new methods for DTLSv1.2 diff --git a/dtls/openssl.py b/dtls/openssl.py index d2e872e..27e61e6 100644 --- a/dtls/openssl.py +++ b/dtls/openssl.py @@ -135,6 +135,7 @@ SSL_CTRL_SET_MTU = 17 SSL_CTRL_OPTIONS = 32 SSL_CTRL_SET_READ_AHEAD = 41 SSL_CTRL_SET_SESS_CACHE_MODE = 44 +SSL_CTRL_CLEAR_OPTIONS = 77 BIO_CTRL_INFO = 3 BIO_CTRL_DGRAM_SET_CONNECTED = 32 @@ -533,10 +534,10 @@ __all__ = [ "BIO_dgram_get_peer", "BIO_dgram_set_peer", "BIO_set_nbio", "SSL_CTX_set_session_cache_mode", "SSL_CTX_set_read_ahead", - "SSL_CTX_set_options", + "SSL_CTX_set_options", "SSL_CTX_clear_options", "SSL_CTX_get_options", "SSL_CTX_set_info_callback", "SSL_read", "SSL_write", - "SSL_set_options", + "SSL_set_options", "SSL_clear_options", "SSL_get_options", "SSL_set_mtu", "SSL_state_string_long", "SSL_alert_type_string_long", "SSL_alert_desc_string_long", "SSL_CTX_set_cookie_cb", @@ -734,6 +735,12 @@ def SSL_CTX_set_options(ctx, options): # Returns the new option bitmaks after adding the given options return _SSL_CTX_ctrl(ctx, SSL_CTRL_OPTIONS, options, None) +def SSL_CTX_clear_options(ctx, options): + return _SSL_CTX_ctrl(ctx, SSL_CTRL_CLEAR_OPTIONS, options, None) + +def SSL_CTX_get_options(ctx): + return _SSL_CTX_ctrl(ctx, SSL_CTRL_OPTIONS, 0, None) + _rvoid_voidp_int_int = CFUNCTYPE(None, c_void_p, c_int, c_int) _info_callback = dict() @@ -859,6 +866,12 @@ def SSL_write(ssl, data): def SSL_set_options(ssl, op): return _SSL_ctrl(ssl, SSL_CTRL_OPTIONS, op, None) +def SSL_clear_options(ssl, op): + return _SSL_ctrl(ssl, SSL_CTRL_CLEAR_OPTIONS, op, None) + +def SSL_get_options(ssl): + return _SSL_ctrl(ssl, SSL_CTRL_OPTIONS, 0, None) + def SSL_set_mtu(ssl, mtu): return _SSL_ctrl(ssl, SSL_CTRL_SET_MTU, mtu, None)