summaryrefslogtreecommitdiff
path: root/src/cryptography
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2019-01-21 21:17:19 -0600
committerAlex Gaynor <alex.gaynor@gmail.com>2019-01-21 22:17:19 -0500
commit5b3e735253d4cc1c7f51dedc11c9ca5eeb6f451f (patch)
tree7cd2194ca80e8e748b983260b322c281f1c03f70 /src/cryptography
parent7a127a5d0a5c6018affc9c4bdf03f4be7e6e25f8 (diff)
downloadcryptography-5b3e735253d4cc1c7f51dedc11c9ca5eeb6f451f.tar.gz
bind EVP_R_MEMORY_LIMIT_EXCEEDED and update a test (#4726)
* bind EVP_R_MEMORY_LIMIT_EXCEEDED and update a test This will allow OpenSSL 1.1.1 on 32-bit (including our Windows 32-bit builders) to fail as expected. Technically this isn't a malloc error, but rather failing because the allocation requested is larger than 32-bits, but raising a MemoryError still seems appropriate * what you want an endif too?
Diffstat (limited to 'src/cryptography')
-rw-r--r--src/cryptography/hazmat/backends/openssl/backend.py4
-rw-r--r--src/cryptography/hazmat/bindings/openssl/_conditional.py9
2 files changed, 13 insertions, 0 deletions
diff --git a/src/cryptography/hazmat/backends/openssl/backend.py b/src/cryptography/hazmat/backends/openssl/backend.py
index 64a91f03c..1d1e04466 100644
--- a/src/cryptography/hazmat/backends/openssl/backend.py
+++ b/src/cryptography/hazmat/backends/openssl/backend.py
@@ -2210,6 +2210,10 @@ class Backend(object):
errors[0]._lib_reason_match(
self._lib.ERR_LIB_EVP,
self._lib.ERR_R_MALLOC_FAILURE
+ ) or
+ errors[0]._lib_reason_match(
+ self._lib.ERR_LIB_EVP,
+ self._lib.EVP_R_MEMORY_LIMIT_EXCEEDED
)
)
diff --git a/src/cryptography/hazmat/bindings/openssl/_conditional.py b/src/cryptography/hazmat/bindings/openssl/_conditional.py
index 764179347..c0238dcc2 100644
--- a/src/cryptography/hazmat/bindings/openssl/_conditional.py
+++ b/src/cryptography/hazmat/bindings/openssl/_conditional.py
@@ -335,6 +335,12 @@ def cryptography_has_raw_key():
]
+def cryptography_has_evp_r_memory_limit_exceeded():
+ return [
+ "EVP_R_MEMORY_LIMIT_EXCEEDED",
+ ]
+
+
# This is a mapping of
# {condition: function-returning-names-dependent-on-that-condition} so we can
# loop over them and delete unsupported names at runtime. It will be removed
@@ -403,4 +409,7 @@ CONDITIONAL_NAMES = {
"Cryptography_HAS_EVP_DIGESTFINAL_XOF": (
cryptography_has_evp_digestfinal_xof
),
+ "Cryptography_HAS_EVP_R_MEMORY_LIMIT_EXCEEDED": (
+ cryptography_has_evp_r_memory_limit_exceeded
+ ),
}