diff options
-rw-r--r-- | cryptography/hazmat/bindings/openssl/ssl.py | 4 | ||||
-rw-r--r-- | docs/index.rst | 6 | ||||
-rw-r--r-- | setup.py | 52 |
3 files changed, 42 insertions, 20 deletions
diff --git a/cryptography/hazmat/bindings/openssl/ssl.py b/cryptography/hazmat/bindings/openssl/ssl.py index ad102769..094310f3 100644 --- a/cryptography/hazmat/bindings/openssl/ssl.py +++ b/cryptography/hazmat/bindings/openssl/ssl.py @@ -180,6 +180,7 @@ int SSL_pending(const SSL *); int SSL_write(SSL *, const void *, int); int SSL_read(SSL *, void *, int); X509 *SSL_get_peer_certificate(const SSL *); +int SSL_get_ex_data_X509_STORE_CTX_idx(void); Cryptography_STACK_OF_X509 *SSL_get_peer_cert_chain(const SSL *); Cryptography_STACK_OF_X509_NAME *SSL_get_client_CA_list(const SSL *); @@ -219,6 +220,9 @@ int X509_STORE_CTX_get_error(X509_STORE_CTX *); void X509_STORE_CTX_set_error(X509_STORE_CTX *, int); int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *); X509 *X509_STORE_CTX_get_current_cert(X509_STORE_CTX *); +int X509_STORE_CTX_set_ex_data(X509_STORE_CTX *, int, void *); +void *X509_STORE_CTX_get_ex_data(X509_STORE_CTX *, int); + /* SSL_SESSION */ void SSL_SESSION_free(SSL_SESSION *); diff --git a/docs/index.rst b/docs/index.rst index 58424bfc..083533c9 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -2,7 +2,9 @@ Welcome to ``cryptography`` =========================== ``cryptography`` is a Python library which exposes cryptographic recipes and -primitives. Our goal is for it to be your "cryptographic standard library". +primitives. Our goal is for it to be your "cryptographic standard library". If +you are interested in learning more about the field of cryptography, we +recommend `Crypto 101, by Laurens Van Houtven`_. Installation ------------ @@ -98,4 +100,4 @@ The ``cryptography`` open source project documentation. If you're interested in discussing an audit please :doc:`get in touch </community>`. -.. _`pre-compiled binaries`: https://www.openssl.org/related/binaries.html +.. _`Crypto 101, by Laurens Van Houtven`: https://www.crypto101.io/ @@ -21,6 +21,7 @@ import subprocess import pkg_resources from setuptools import find_packages, setup +from setuptools.command.install import install from setuptools.command.test import test @@ -53,6 +54,25 @@ if not os.path.exists(os.path.join(base_dir, "vectors/setup.py")): test_requirements.append(VECTORS_DEPENDENCY) +def get_ext_modules(): + from cryptography.hazmat.bindings.commoncrypto.binding import ( + Binding as CommonCryptoBinding + ) + from cryptography.hazmat.bindings.openssl.binding import ( + Binding as OpenSSLBinding + ) + from cryptography.hazmat.primitives import constant_time, padding + + ext_modules = [ + OpenSSLBinding().ffi.verifier.get_extension(), + constant_time._ffi.verifier.get_extension(), + padding._ffi.verifier.get_extension() + ] + if CommonCryptoBinding.is_available(): + ext_modules.append(CommonCryptoBinding().ffi.verifier.get_extension()) + return ext_modules + + class CFFIBuild(build): """ This class exists, instead of just providing ``ext_modules=[...]`` directly @@ -64,27 +84,22 @@ class CFFIBuild(build): """ def finalize_options(self): - from cryptography.hazmat.bindings.commoncrypto.binding import ( - Binding as CommonCryptoBinding - ) - from cryptography.hazmat.bindings.openssl.binding import ( - Binding as OpenSSLBinding - ) - from cryptography.hazmat.primitives import constant_time, padding - - self.distribution.ext_modules = [ - OpenSSLBinding().ffi.verifier.get_extension(), - constant_time._ffi.verifier.get_extension(), - padding._ffi.verifier.get_extension() - ] - if CommonCryptoBinding.is_available(): - self.distribution.ext_modules.append( - CommonCryptoBinding().ffi.verifier.get_extension() - ) - + self.distribution.ext_modules = get_ext_modules() build.finalize_options(self) +class CFFIInstall(install): + """ + As a consequence of CFFIBuild and it's late addition of ext_modules, we + need the equivalent for the ``install`` command to install into platlib + install-dir rather than purelib. + """ + + def finalize_options(self): + self.distribution.ext_modules = get_ext_modules() + install.finalize_options(self) + + class PyTest(test): def finalize_options(self): test.finalize_options(self) @@ -154,6 +169,7 @@ setup( ext_package="cryptography", cmdclass={ "build": CFFIBuild, + "install": CFFIInstall, "test": PyTest, } ) |