blob: 99b327d9f49f412aee66fe04aa473758aeb37f63 [file] [log] [blame]
Alex Gaynoraf82d5e2013-10-29 17:07:24 -07001.. hazmat::
Alex Gaynor0f7f7812013-09-30 10:52:36 -07002
Alex Gaynor8f42fe42013-12-24 13:15:52 -08003OpenSSL Backend
4===============
Donald Stuffte51fb932013-10-27 17:26:17 -04005
Alex Gaynor6d02e2d2013-09-30 10:37:22 -07006These are `CFFI`_ bindings to the `OpenSSL`_ C library.
7
Alex Gaynorf8796b12013-12-13 20:28:55 -08008.. data:: cryptography.hazmat.backends.openssl.backend
Alex Gaynor6d02e2d2013-09-30 10:37:22 -07009
Paul Kehrer2c4873f2013-10-22 20:19:38 -050010 This is the exposed API for the OpenSSL bindings. It has two public
Alex Gaynor6d02e2d2013-09-30 10:37:22 -070011 attributes:
12
13 .. attribute:: ffi
14
15 This is a :class:`cffi.FFI` instance. It can be used to allocate and
16 otherwise manipulate OpenSSL structures.
17
18 .. attribute:: lib
19
20 This is a ``cffi`` library. It can be used to call OpenSSL functions,
21 and access constants.
22
23
Alex Stapletone68d73e2013-12-31 14:00:38 +000024Using your own OpenSSL on Linux
25-------------------------------
26
27Python links to OpenSSL for its own purposes and this can sometimes cause
28problems when you wish to use a different version of OpenSSL with cryptography.
29If you want to use cryptography with your own build of OpenSSL you will need to
30make sure that the build is configured correctly so that your version of
31OpenSSL doesn't conflict with Python's.
32
33The options you need to add allow the linker to identify every symbol correctly
34even when multiple versions of the library are linked into the same program. If
35you are using your distribution's source packages these will probably be
36patched in for you already, otherwise you'll need to use options something like
37this when configuring OpenSSL::
38
39 ./config -Wl,--version-script=openssl.ld -Wl,-Bsymbolic-functions -fPIC shared
40
41You'll also need to generate your own ``openssl.ld`` file. For example::
42
43 OPENSSL_1.0.1F_CUSTOM {
44 global:
45 *;
46 };
47
48You should replace the version string on the first line as appropriate for your
49build.
50
Alex Gaynorae9dc8b2013-12-12 10:13:32 -080051.. _`CFFI`: https://cffi.readthedocs.org/
Alex Gaynor6d02e2d2013-09-30 10:37:22 -070052.. _`OpenSSL`: https://www.openssl.org/