diff options
| author | Alex Gaynor <alex.gaynor@gmail.com> | 2015-09-04 09:18:59 -0400 |
|---|---|---|
| committer | Alex Gaynor <alex.gaynor@gmail.com> | 2015-09-04 09:18:59 -0400 |
| commit | b9521c8ec871abbe784af36467f46a7dd00c8d8a (patch) | |
| tree | 66dd6a6661740296f5176c918a7d28bb226961cf /OpenSSL | |
| parent | 63c82fc373f1df2d236b29d06120af2dd1755adc (diff) | |
| download | pyopenssl-b9521c8ec871abbe784af36467f46a7dd00c8d8a.tar.gz | |
Fixed #322 -- removed code that already exists in cryptography
Diffstat (limited to 'OpenSSL')
| -rw-r--r-- | OpenSSL/crypto.py | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/OpenSSL/crypto.py b/OpenSSL/crypto.py index a52862c..92ec815 100644 --- a/OpenSSL/crypto.py +++ b/OpenSSL/crypto.py @@ -10,6 +10,7 @@ from six import ( PY3 as _PY3) from OpenSSL._util import ( + binding as _binding, ffi as _ffi, lib as _lib, exception_from_error_queue as _exception_from_error_queue, @@ -2808,34 +2809,7 @@ def load_pkcs12(buffer, passphrase=None): return pkcs12 -def _initialize_openssl_threads(get_ident, Lock): - import _ssl - return - - locks = list(Lock() for n in range(_lib.CRYPTO_num_locks())) - - def locking_function(mode, index, filename, line): - if mode & _lib.CRYPTO_LOCK: - locks[index].acquire() - else: - locks[index].release() - - _lib.CRYPTO_set_id_callback( - _ffi.callback("unsigned long (*)(void)", get_ident)) - - _lib.CRYPTO_set_locking_callback( - _ffi.callback( - "void (*)(int, int, const char*, int)", locking_function)) - - -try: - from thread import get_ident - from threading import Lock -except ImportError: - pass -else: - _initialize_openssl_threads(get_ident, Lock) - del get_ident, Lock +_binding.init_static_locks() # There are no direct unit tests for this initialization. It is tested # indirectly since it is necessary for functions like dump_privatekey when |
