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