aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/bindings/test_openssl.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/hazmat/bindings/test_openssl.py')
-rw-r--r--tests/hazmat/bindings/test_openssl.py36
1 files changed, 35 insertions, 1 deletions
diff --git a/tests/hazmat/bindings/test_openssl.py b/tests/hazmat/bindings/test_openssl.py
index acab22b1..58d7602b 100644
--- a/tests/hazmat/bindings/test_openssl.py
+++ b/tests/hazmat/bindings/test_openssl.py
@@ -84,7 +84,7 @@ class TestOpenSSL(object):
with pytest.raises(RuntimeError):
b._lock_cb(0, b.lib.CRYPTO_LOCK_SSL, "<test>", 1)
- # errors shouldnt cause locking
+ # errors shouldn't cause locking
assert lock.acquire(False)
lock.release()
@@ -103,3 +103,37 @@ class TestOpenSSL(object):
b = Binding()
res = b.lib.Cryptography_add_osrandom_engine()
assert res == 2
+
+ def test_ssl_ctx_options(self):
+ # Test that we're properly handling 32-bit unsigned on all platforms.
+ b = Binding()
+ assert b.lib.SSL_OP_ALL > 0
+ ctx = b.lib.SSL_CTX_new(b.lib.TLSv1_method())
+ ctx = b.ffi.gc(ctx, b.lib.SSL_CTX_free)
+ resp = b.lib.SSL_CTX_set_options(ctx, b.lib.SSL_OP_ALL)
+ assert resp == b.lib.SSL_OP_ALL
+ assert b.lib.SSL_OP_ALL == b.lib.SSL_CTX_get_options(ctx)
+
+ def test_ssl_options(self):
+ # Test that we're properly handling 32-bit unsigned on all platforms.
+ b = Binding()
+ assert b.lib.SSL_OP_ALL > 0
+ ctx = b.lib.SSL_CTX_new(b.lib.TLSv1_method())
+ ctx = b.ffi.gc(ctx, b.lib.SSL_CTX_free)
+ ssl = b.lib.SSL_new(ctx)
+ ssl = b.ffi.gc(ssl, b.lib.SSL_free)
+ resp = b.lib.SSL_set_options(ssl, b.lib.SSL_OP_ALL)
+ assert resp == b.lib.SSL_OP_ALL
+ assert b.lib.SSL_OP_ALL == b.lib.SSL_get_options(ssl)
+
+ def test_ssl_mode(self):
+ # Test that we're properly handling 32-bit unsigned on all platforms.
+ b = Binding()
+ assert b.lib.SSL_OP_ALL > 0
+ ctx = b.lib.SSL_CTX_new(b.lib.TLSv1_method())
+ ctx = b.ffi.gc(ctx, b.lib.SSL_CTX_free)
+ ssl = b.lib.SSL_new(ctx)
+ ssl = b.ffi.gc(ssl, b.lib.SSL_free)
+ resp = b.lib.SSL_set_mode(ssl, b.lib.SSL_OP_ALL)
+ assert resp == b.lib.SSL_OP_ALL
+ assert b.lib.SSL_OP_ALL == b.lib.SSL_get_mode(ssl)