aboutsummaryrefslogtreecommitdiffstats
path: root/src/cryptography
diff options
context:
space:
mode:
Diffstat (limited to 'src/cryptography')
-rw-r--r--src/cryptography/hazmat/bindings/openssl/binding.py31
1 files changed, 2 insertions, 29 deletions
diff --git a/src/cryptography/hazmat/bindings/openssl/binding.py b/src/cryptography/hazmat/bindings/openssl/binding.py
index e788502d..25849bf3 100644
--- a/src/cryptography/hazmat/bindings/openssl/binding.py
+++ b/src/cryptography/hazmat/bindings/openssl/binding.py
@@ -118,8 +118,6 @@ class Binding(object):
lib = None
ffi = ffi
_lib_loaded = False
- _locks = None
- _lock_cb_handle = None
_init_lock = threading.Lock()
_lock_init_lock = threading.Lock()
@@ -178,14 +176,6 @@ class Binding(object):
def init_static_locks(cls):
with cls._lock_init_lock:
cls._ensure_ffi_initialized()
-
- if not cls._lock_cb_handle:
- wrapper = ffi_callback(
- "void(int, int, const char *, int)",
- name="Cryptography_locking_cb",
- )
- cls._lock_cb_handle = wrapper(cls._lock_cb)
-
# Use Python's implementation if available, importing _ssl triggers
# the setup for this.
__import__("_ssl")
@@ -195,25 +185,8 @@ class Binding(object):
# If nothing else has setup a locking callback already, we set up
# our own
- num_locks = cls.lib.CRYPTO_num_locks()
- cls._locks = [threading.Lock() for n in range(num_locks)]
-
- cls.lib.CRYPTO_set_locking_callback(cls._lock_cb_handle)
-
- @classmethod
- def _lock_cb(cls, mode, n, file, line):
- lock = cls._locks[n]
-
- if mode & cls.lib.CRYPTO_LOCK:
- lock.acquire()
- elif mode & cls.lib.CRYPTO_UNLOCK:
- lock.release()
- else:
- raise RuntimeError(
- "Unknown lock mode {0}: lock={1}, file={2}, line={3}.".format(
- mode, n, file, line
- )
- )
+ res = lib._setup_ssl_threads()
+ _openssl_assert(cls.lib, res == 1)
def _verify_openssl_version(version):