summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrián Chaves <adrian@chaves.io>2020-03-31 16:14:50 +0200
committerGitHub <noreply@github.com>2020-03-31 09:14:50 -0500
commit98c57be751fe18fec6d05152965f53ed9ade0872 (patch)
tree90bee22e743f418b0af7dc324daebfb0aed715aa
parentd65d76490dd3e7384be7ee7eb03e858548aa7591 (diff)
downloadpyopenssl-git-98c57be751fe18fec6d05152965f53ed9ade0872.tar.gz
Remove asserts (#904)
-rw-r--r--src/OpenSSL/SSL.py6
-rw-r--r--src/OpenSSL/crypto.py4
2 files changed, 5 insertions, 5 deletions
diff --git a/src/OpenSSL/SSL.py b/src/OpenSSL/SSL.py
index ca39930..03f1455 100644
--- a/src/OpenSSL/SSL.py
+++ b/src/OpenSSL/SSL.py
@@ -2131,7 +2131,7 @@ class Connection(object):
if session == _ffi.NULL:
return None
length = _lib.SSL_get_server_random(self._ssl, _ffi.NULL, 0)
- assert length > 0
+ _openssl_assert(length > 0)
outp = _no_zero_allocator("unsigned char[]", length)
_lib.SSL_get_server_random(self._ssl, outp, length)
return _ffi.buffer(outp, length)[:]
@@ -2147,7 +2147,7 @@ class Connection(object):
return None
length = _lib.SSL_get_client_random(self._ssl, _ffi.NULL, 0)
- assert length > 0
+ _openssl_assert(length > 0)
outp = _no_zero_allocator("unsigned char[]", length)
_lib.SSL_get_client_random(self._ssl, outp, length)
return _ffi.buffer(outp, length)[:]
@@ -2163,7 +2163,7 @@ class Connection(object):
return None
length = _lib.SSL_SESSION_get_master_key(session, _ffi.NULL, 0)
- assert length > 0
+ _openssl_assert(length > 0)
outp = _no_zero_allocator("unsigned char[]", length)
_lib.SSL_SESSION_get_master_key(session, outp, length)
return _ffi.buffer(outp, length)[:]
diff --git a/src/OpenSSL/crypto.py b/src/OpenSSL/crypto.py
index e2956ae..30dd478 100644
--- a/src/OpenSSL/crypto.py
+++ b/src/OpenSSL/crypto.py
@@ -1819,7 +1819,7 @@ def dump_certificate(type, cert):
"type argument must be FILETYPE_PEM, FILETYPE_ASN1, or "
"FILETYPE_TEXT")
- assert result_code == 1
+ _openssl_assert(result_code == 1)
return _bio_to_string(bio)
@@ -2893,7 +2893,7 @@ def dump_crl(type, crl):
"type argument must be FILETYPE_PEM, FILETYPE_ASN1, or "
"FILETYPE_TEXT")
- assert ret == 1
+ _openssl_assert(ret == 1)
return _bio_to_string(bio)