diff options
Diffstat (limited to 'cryptography/hazmat')
-rw-r--r-- | cryptography/hazmat/backends/openssl/backend.py | 10 | ||||
-rw-r--r-- | cryptography/hazmat/bindings/openssl/err.py | 2 |
2 files changed, 12 insertions, 0 deletions
diff --git a/cryptography/hazmat/backends/openssl/backend.py b/cryptography/hazmat/backends/openssl/backend.py index 0d27bc7f..1586bf71 100644 --- a/cryptography/hazmat/backends/openssl/backend.py +++ b/cryptography/hazmat/backends/openssl/backend.py @@ -544,6 +544,11 @@ class Backend(object): if res <= 0: errors = self._consume_errors() assert errors + assert errors[0].lib == self._lib.ERR_LIB_RSA + assert (errors[0].reason == + self._lib.RSA_R_BLOCK_TYPE_IS_NOT_01 or + errors[0].reason == + self._lib.RSA_R_BLOCK_TYPE_IS_NOT_02) raise InvalidDecryption return self._ffi.buffer(buf)[:outlen[0]] @@ -566,6 +571,11 @@ class Backend(object): if res < 0: errors = self._consume_errors() assert errors + assert errors[0].lib == self._lib.ERR_LIB_RSA + assert (errors[0].reason == + self._lib.RSA_R_BLOCK_TYPE_IS_NOT_01 or + errors[0].reason == + self._lib.RSA_R_BLOCK_TYPE_IS_NOT_02) raise InvalidDecryption return self._ffi.buffer(buf)[:res] diff --git a/cryptography/hazmat/bindings/openssl/err.py b/cryptography/hazmat/bindings/openssl/err.py index f51393aa..c08c880c 100644 --- a/cryptography/hazmat/bindings/openssl/err.py +++ b/cryptography/hazmat/bindings/openssl/err.py @@ -216,6 +216,8 @@ static const int PEM_R_UNSUPPORTED_ENCRYPTION; static const int RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE; static const int RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY; +static const int RSA_R_BLOCK_TYPE_IS_NOT_01; +static const int RSA_R_BLOCK_TYPE_IS_NOT_02; """ FUNCTIONS = """ |