Skip to content

Commit 98c57be

Browse files
authored
Remove asserts (pyca#904)
1 parent d65d764 commit 98c57be

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/OpenSSL/SSL.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2131,7 +2131,7 @@ def server_random(self):
21312131
if session == _ffi.NULL:
21322132
return None
21332133
length = _lib.SSL_get_server_random(self._ssl, _ffi.NULL, 0)
2134-
assert length > 0
2134+
_openssl_assert(length > 0)
21352135
outp = _no_zero_allocator("unsigned char[]", length)
21362136
_lib.SSL_get_server_random(self._ssl, outp, length)
21372137
return _ffi.buffer(outp, length)[:]
@@ -2147,7 +2147,7 @@ def client_random(self):
21472147
return None
21482148

21492149
length = _lib.SSL_get_client_random(self._ssl, _ffi.NULL, 0)
2150-
assert length > 0
2150+
_openssl_assert(length > 0)
21512151
outp = _no_zero_allocator("unsigned char[]", length)
21522152
_lib.SSL_get_client_random(self._ssl, outp, length)
21532153
return _ffi.buffer(outp, length)[:]
@@ -2163,7 +2163,7 @@ def master_key(self):
21632163
return None
21642164

21652165
length = _lib.SSL_SESSION_get_master_key(session, _ffi.NULL, 0)
2166-
assert length > 0
2166+
_openssl_assert(length > 0)
21672167
outp = _no_zero_allocator("unsigned char[]", length)
21682168
_lib.SSL_SESSION_get_master_key(session, outp, length)
21692169
return _ffi.buffer(outp, length)[:]

src/OpenSSL/crypto.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1819,7 +1819,7 @@ def dump_certificate(type, cert):
18191819
"type argument must be FILETYPE_PEM, FILETYPE_ASN1, or "
18201820
"FILETYPE_TEXT")
18211821

1822-
assert result_code == 1
1822+
_openssl_assert(result_code == 1)
18231823
return _bio_to_string(bio)
18241824

18251825

@@ -2893,7 +2893,7 @@ def dump_crl(type, crl):
28932893
"type argument must be FILETYPE_PEM, FILETYPE_ASN1, or "
28942894
"FILETYPE_TEXT")
28952895

2896-
assert ret == 1
2896+
_openssl_assert(ret == 1)
28972897
return _bio_to_string(bio)
28982898

28992899

0 commit comments

Comments
 (0)