diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2019-02-25 13:32:05 +0800 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2019-02-25 00:32:05 -0500 |
commit | 76c784340c3851f402abc38dff8fa5f008cdc4d4 (patch) | |
tree | b08f245978f3ec2e5ffa8b1ace388944500c8650 /src/cryptography/hazmat/bindings/openssl | |
parent | 01a517919ce16cc9dd75db9d02dae00a4cc390bb (diff) | |
download | cryptography-76c784340c3851f402abc38dff8fa5f008cdc4d4.tar.gz cryptography-76c784340c3851f402abc38dff8fa5f008cdc4d4.tar.bz2 cryptography-76c784340c3851f402abc38dff8fa5f008cdc4d4.zip |
support NO_ENGINE (#4763)
* support OPENSSL_NO_ENGINE
* support some new openssl config args
* sigh
Diffstat (limited to 'src/cryptography/hazmat/bindings/openssl')
-rw-r--r-- | src/cryptography/hazmat/bindings/openssl/_conditional.py | 42 | ||||
-rw-r--r-- | src/cryptography/hazmat/bindings/openssl/binding.py | 5 |
2 files changed, 45 insertions, 2 deletions
diff --git a/src/cryptography/hazmat/bindings/openssl/_conditional.py b/src/cryptography/hazmat/bindings/openssl/_conditional.py index c0238dcc..3fecfe59 100644 --- a/src/cryptography/hazmat/bindings/openssl/_conditional.py +++ b/src/cryptography/hazmat/bindings/openssl/_conditional.py @@ -341,6 +341,47 @@ def cryptography_has_evp_r_memory_limit_exceeded(): ] +def cryptography_has_engine(): + return [ + "ENGINE_get_first", + "ENGINE_get_last", + "ENGINE_add", + "ENGINE_remove", + "ENGINE_by_id", + "ENGINE_init", + "ENGINE_finish", + "ENGINE_load_builtin_engines", + "ENGINE_get_default_RAND", + "ENGINE_set_default_RAND", + "ENGINE_register_RAND", + "ENGINE_unregister_RAND", + "ENGINE_register_all_RAND", + "ENGINE_ctrl", + "ENGINE_ctrl_cmd", + "ENGINE_ctrl_cmd_string", + "ENGINE_new", + "ENGINE_free", + "ENGINE_up_ref", + "ENGINE_set_id", + "ENGINE_set_name", + "ENGINE_set_RAND", + "ENGINE_set_destroy_function", + "ENGINE_set_init_function", + "ENGINE_set_finish_function", + "ENGINE_set_ctrl_function", + "ENGINE_get_id", + "ENGINE_get_name", + "ENGINE_get_RAND", + "ENGINE_add_conf_module", + "ENGINE_load_openssl", + "ENGINE_load_dynamic", + "ENGINE_cleanup", + "ENGINE_METHOD_RAND", + "ENGINE_R_CONFLICTING_ENGINE_ID", + "Cryptography_add_osrandom_engine", + ] + + # 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 @@ -412,4 +453,5 @@ CONDITIONAL_NAMES = { "Cryptography_HAS_EVP_R_MEMORY_LIMIT_EXCEEDED": ( cryptography_has_evp_r_memory_limit_exceeded ), + "Cryptography_HAS_ENGINE": cryptography_has_engine, } diff --git a/src/cryptography/hazmat/bindings/openssl/binding.py b/src/cryptography/hazmat/bindings/openssl/binding.py index c937afd4..ca4e33fa 100644 --- a/src/cryptography/hazmat/bindings/openssl/binding.py +++ b/src/cryptography/hazmat/bindings/openssl/binding.py @@ -115,8 +115,9 @@ class Binding(object): # reliably clear the error queue. Once we clear it here we will # error on any subsequent unexpected item in the stack. cls.lib.ERR_clear_error() - result = cls.lib.Cryptography_add_osrandom_engine() - _openssl_assert(cls.lib, result in (1, 2)) + if cls.lib.Cryptography_HAS_ENGINE: + result = cls.lib.Cryptography_add_osrandom_engine() + _openssl_assert(cls.lib, result in (1, 2)) @classmethod def _ensure_ffi_initialized(cls): |