aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGlyph <glyph@twistedmatrix.com>2015-06-27 15:41:08 -0700
committerGlyph <glyph@twistedmatrix.com>2015-06-27 15:41:08 -0700
commitc1d04467fdc58e4f97e7768f77706ac4c8099c42 (patch)
tree57405d4cfc9d4d0a2cd95db9d6cd14f2f8b6605c /src
parent885d688aae732042034fed4c7cab5dd6a70c6c26 (diff)
downloadcryptography-c1d04467fdc58e4f97e7768f77706ac4c8099c42.tar.gz
cryptography-c1d04467fdc58e4f97e7768f77706ac4c8099c42.tar.bz2
cryptography-c1d04467fdc58e4f97e7768f77706ac4c8099c42.zip
clear the error queue
make sure we're not in an error state when we start, because then all bets are off and we might consume an error we didn't cause. then clear the error queue, which restores the behavior of the way the C module was previously checking for existence of its engine.
Diffstat (limited to 'src')
-rw-r--r--src/cryptography/hazmat/bindings/openssl/binding.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cryptography/hazmat/bindings/openssl/binding.py b/src/cryptography/hazmat/bindings/openssl/binding.py
index d3999959..1fb7478d 100644
--- a/src/cryptography/hazmat/bindings/openssl/binding.py
+++ b/src/cryptography/hazmat/bindings/openssl/binding.py
@@ -42,10 +42,14 @@ method = ffi.new(
def _register_osrandom_engine():
+ assert lib.ERR_peek_error() == 0
looked_up_engine = lib.ENGINE_by_id(_osrandom_engine_id)
if looked_up_engine != ffi.NULL:
+ assert lib.ERR_peek_error() == 0
return 2
+ lib.ERR_clear_error()
+
engine = lib.ENGINE_new()
try:
result = lib.ENGINE_set_id(engine, _osrandom_engine_id)