1.. hazmat:: 2 3OpenSSL binding 4=============== 5 6.. currentmodule:: cryptography.hazmat.bindings.openssl.binding 7 8These are `CFFI`_ bindings to the `OpenSSL`_ C library. Cryptography supports 9OpenSSL version 1.0.1 and greater. 10 11.. class:: cryptography.hazmat.bindings.openssl.binding.Binding() 12 13 This is the exposed API for the OpenSSL bindings. It has two public 14 attributes: 15 16 .. attribute:: ffi 17 18 This is a ``cffi.FFI`` instance. It can be used to allocate and 19 otherwise manipulate OpenSSL structures. 20 21 .. attribute:: lib 22 23 This is a ``cffi`` library. It can be used to call OpenSSL functions, 24 and access constants. 25 26 .. classmethod:: init_static_locks 27 28 Enables the best available locking callback for OpenSSL. 29 See :ref:`openssl-threading`. 30 31.. _openssl-threading: 32 33Threading 34--------- 35 36``cryptography`` enables OpenSSLs `thread safety facilities`_ in two different 37ways depending on the configuration of your system. Normally the locking 38callbacks provided by your Python implementation specifically for OpenSSL will 39be used. However, if you have linked ``cryptography`` to a different version of 40OpenSSL than that used by your Python implementation we enable an alternative 41locking callback. This version is implemented in Python and so may result in 42lower performance in some situations. In particular parallelism is reduced 43because it has to acquire the GIL whenever any lock operations occur within 44OpenSSL. 45 46.. _`CFFI`: https://cffi.readthedocs.io 47.. _`OpenSSL`: https://www.openssl.org/ 48.. _`thread safety facilities`: https://www.openssl.org/docs/man1.0.2/crypto/threads.html 49