blob: 36255b523983fa21227385138a141a211d15dc74 [file] [log] [blame]
Alex Stapletonc368ac22013-12-31 13:43:38 +00001.. hazmat::
2
Alex Stapletonc5fffd32014-03-18 15:29:00 +00003OpenSSL binding
Alex Stapletonc368ac22013-12-31 13:43:38 +00004===============
5
6.. currentmodule:: cryptography.hazmat.bindings.openssl.binding
7
Paul Kehrer12649af2014-03-10 12:45:19 -04008These are `CFFI`_ bindings to the `OpenSSL`_ C library. Cryptography supports
9version ``0.9.8e`` (present in Red Hat Enterprise Linux 5) and greater. Earlier
10versions may work but are **not tested or supported**.
Alex Stapletonc368ac22013-12-31 13:43:38 +000011
12.. class:: cryptography.hazmat.bindings.openssl.binding.Binding()
13
14 This is the exposed API for the OpenSSL bindings. It has two public
15 attributes:
16
17 .. attribute:: ffi
18
19 This is a :class:`cffi.FFI` instance. It can be used to allocate and
20 otherwise manipulate OpenSSL structures.
21
22 .. attribute:: lib
23
24 This is a ``cffi`` library. It can be used to call OpenSSL functions,
25 and access constants.
26
Alex Stapletonfcae1502014-01-23 20:43:34 +000027 .. classmethod:: init_static_locks
28
29 Enables the best available locking callback for OpenSSL.
30 See :ref:`openssl-threading`.
31
32.. _openssl-threading:
33
34Threading
35---------
36
Alex Stapleton5fb7eb42014-01-24 19:02:33 +000037``cryptography`` enables OpenSSLs `thread safety facilities`_ in two different
Alex Stapletonfcae1502014-01-23 20:43:34 +000038ways depending on the configuration of your system. Normally the locking
39callbacks provided by your Python implementation specifically for OpenSSL will
Alex Stapleton5fb7eb42014-01-24 19:02:33 +000040be used. However if you have linked ``cryptography`` to a different version of
Alex Stapletonfcae1502014-01-23 20:43:34 +000041OpenSSL than that used by your Python implementation we enable an alternative
42locking callback. This version is implemented in Python and so may result in
43lower performance in some situations. In particular parallelism is reduced
44because it has to acquire the GIL whenever any lock operations occur within
45OpenSSL.
Alex Stapletonc368ac22013-12-31 13:43:38 +000046
47.. _`CFFI`: https://cffi.readthedocs.org/
48.. _`OpenSSL`: https://www.openssl.org/
Alex Gaynore9df2942014-12-12 10:56:26 -080049.. _`thread safety facilities`: https://www.openssl.org/docs/crypto/threads.html