diff options
author | Christopher Grebs <cg@webshox.org> | 2015-09-04 23:14:33 +0200 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2015-12-27 22:53:23 -0600 |
commit | 6b22d6663dcba1a08a3662d9d0205005be6bcd86 (patch) | |
tree | 0a225251e463756b7e4abaa315c0d34731f98acf | |
parent | fb7659c5db43dd1e53d0934f27a3937bb4af3663 (diff) | |
download | cryptography-6b22d6663dcba1a08a3662d9d0205005be6bcd86.tar.gz cryptography-6b22d6663dcba1a08a3662d9d0205005be6bcd86.tar.bz2 cryptography-6b22d6663dcba1a08a3662d9d0205005be6bcd86.zip |
Add support for RSA_R_OAEP_DECODING_ERROR error flag.
-rw-r--r-- | src/_cffi_src/openssl/err.py | 9 | ||||
-rw-r--r-- | src/cryptography/hazmat/backends/openssl/rsa.py | 3 | ||||
-rw-r--r-- | src/cryptography/hazmat/bindings/openssl/_conditional.py | 3 |
3 files changed, 15 insertions, 0 deletions
diff --git a/src/_cffi_src/openssl/err.py b/src/_cffi_src/openssl/err.py index 6ec13775..3eb783ee 100644 --- a/src/_cffi_src/openssl/err.py +++ b/src/_cffi_src/openssl/err.py @@ -14,6 +14,7 @@ static const int Cryptography_HAS_098H_ERROR_CODES; static const int Cryptography_HAS_098C_CAMELLIA_CODES; static const int Cryptography_HAS_EC_CODES; static const int Cryptography_HAS_RSA_R_PKCS_DECODING_ERROR; +static const int Cryptography_HAS_RSA_R_OAEP_DECODING_ERROR; struct ERR_string_data_st { unsigned long error; @@ -230,6 +231,7 @@ 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; static const int RSA_R_PKCS_DECODING_ERROR; +static const int RSA_R_OAEP_DECODING_ERROR; static const int RSA_F_RSA_SIGN; """ @@ -334,4 +336,11 @@ static const long Cryptography_HAS_RSA_R_PKCS_DECODING_ERROR = 1; static const long Cryptography_HAS_RSA_R_PKCS_DECODING_ERROR = 0; static const long RSA_R_PKCS_DECODING_ERROR = 0; #endif + +#ifdef RSA_R_OAEP_DECODING_ERROR +static const long Cryptography_HAS_RSA_R_OAEP_DECODING_ERROR = 1; +#else +static const long Cryptography_HAS_RSA_R_OAEP_DECODING_ERROR = 0; +static const long RSA_R_OAEP_DECODING_ERROR = 0; +#endif """ diff --git a/src/cryptography/hazmat/backends/openssl/rsa.py b/src/cryptography/hazmat/backends/openssl/rsa.py index 664f6d35..1be6f059 100644 --- a/src/cryptography/hazmat/backends/openssl/rsa.py +++ b/src/cryptography/hazmat/backends/openssl/rsa.py @@ -142,6 +142,9 @@ def _handle_rsa_enc_dec_error(backend, key): if backend._lib.Cryptography_HAS_RSA_R_PKCS_DECODING_ERROR: decoding_errors.append(backend._lib.RSA_R_PKCS_DECODING_ERROR) + if backend._lib.Cryptography_HAS_RSA_R_OAEP_DECODING_ERROR: + decoding_errors.append(backend._lib.RSA_R_OAEP_DECODING_ERROR) + assert errors[0].reason in decoding_errors raise ValueError("Decryption failed.") diff --git a/src/cryptography/hazmat/bindings/openssl/_conditional.py b/src/cryptography/hazmat/bindings/openssl/_conditional.py index 206c2915..c4e39db9 100644 --- a/src/cryptography/hazmat/bindings/openssl/_conditional.py +++ b/src/cryptography/hazmat/bindings/openssl/_conditional.py @@ -219,6 +219,9 @@ CONDITIONAL_NAMES = { "Cryptography_HAS_RSA_R_PKCS_DECODING_ERROR": [ "RSA_R_PKCS_DECODING_ERROR" ], + "Cryptography_HAS_RSA_R_OAEP_DECODING_ERROR": [ + "RSA_R_OAEP_DECODING_ERROR" + ], "Cryptography_HAS_GCM": [ "EVP_CTRL_GCM_GET_TAG", "EVP_CTRL_GCM_SET_TAG", |