blob: 001a87396ad798a181a31f2ecabf08c2c329b23a [file] [log] [blame]
Jean-Paul Calderonee36b31a2014-01-08 16:55:06 -05001from cryptography.hazmat.bindings.openssl.binding import Binding
2binding = Binding()
3ffi = binding.ffi
4lib = binding.lib
Jean-Paul Calderonec86bb7d2013-12-29 10:25:59 -05005
6def exception_from_error_queue(exceptionType):
7 errors = []
8 while True:
9 error = lib.ERR_get_error()
10 if error == 0:
11 break
12 errors.append((
13 ffi.string(lib.ERR_lib_error_string(error)),
14 ffi.string(lib.ERR_func_error_string(error)),
15 ffi.string(lib.ERR_reason_error_string(error))))
16
17 raise exceptionType(errors)