diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-02-02 12:46:47 -0600 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-02-02 12:46:47 -0600 |
commit | e035ba978bf81c9dc17c33d7a8c6d61082ac4292 (patch) | |
tree | 12bd1e3f0d1d229c618aea7b9c73974e47a416ed /tests/hazmat/backends | |
parent | d52b89b4e881639bc68d9c30983e08a1b8085be8 (diff) | |
download | cryptography-e035ba978bf81c9dc17c33d7a8c6d61082ac4292.tar.gz cryptography-e035ba978bf81c9dc17c33d7a8c6d61082ac4292.tar.bz2 cryptography-e035ba978bf81c9dc17c33d7a8c6d61082ac4292.zip |
add catastrophic failure check to tests
Diffstat (limited to 'tests/hazmat/backends')
-rw-r--r-- | tests/hazmat/backends/test_openssl.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/hazmat/backends/test_openssl.py b/tests/hazmat/backends/test_openssl.py index daae2065..cef28af0 100644 --- a/tests/hazmat/backends/test_openssl.py +++ b/tests/hazmat/backends/test_openssl.py @@ -239,6 +239,13 @@ class TestOpenSSLRandomEngine(object): name = backend._lib.ENGINE_get_name(current_default) assert name == backend._lib.Cryptography_osrandom_engine_name + def test_osrandom_sanity_check(self): + # This test serves as a check against catastrophic failure. + buf = backend._ffi.new("char[]", 500) + res = backend._lib.RAND_bytes(buf, 500) + assert res == 1 + assert backend._ffi.buffer(buf)[:] != "\x00" * 500 + def test_activate_osrandom_already_default(self): e = backend._lib.ENGINE_get_default_RAND() name = backend._lib.ENGINE_get_name(e) |