aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2013-12-23 13:58:49 -0800
committerAlex Gaynor <alex.gaynor@gmail.com>2013-12-23 13:58:49 -0800
commitb8564e829306731f5133ac6bcbfc8e2f7e1a25f4 (patch)
tree9547c961611b8fd74d196b08bb1bda2e31a419c1
parent84b1f534791289dd855bde72bc512ee7e47f0f79 (diff)
parenta4ccb413f60ce08bdd955582a33448d00f83970c (diff)
downloadcryptography-b8564e829306731f5133ac6bcbfc8e2f7e1a25f4.tar.gz
cryptography-b8564e829306731f5133ac6bcbfc8e2f7e1a25f4.tar.bz2
cryptography-b8564e829306731f5133ac6bcbfc8e2f7e1a25f4.zip
Merge pull request #334 from exarkun/misc-simple-extras-with-optionals
Misc simple extras with optionals
-rw-r--r--cryptography/hazmat/backends/openssl/crypto.py6
-rw-r--r--cryptography/hazmat/backends/openssl/opensslv.py1
-rw-r--r--cryptography/hazmat/backends/openssl/rand.py1
-rw-r--r--cryptography/hazmat/backends/openssl/ssl.py37
4 files changed, 44 insertions, 1 deletions
diff --git a/cryptography/hazmat/backends/openssl/crypto.py b/cryptography/hazmat/backends/openssl/crypto.py
index 8d88c16e..71d32c52 100644
--- a/cryptography/hazmat/backends/openssl/crypto.py
+++ b/cryptography/hazmat/backends/openssl/crypto.py
@@ -16,6 +16,11 @@ INCLUDES = """
"""
TYPES = """
+static const int SSLEAY_VERSION;
+static const int SSLEAY_CFLAGS;
+static const int SSLEAY_PLATFORM;
+static const int SSLEAY_DIR;
+static const int SSLEAY_BUILT_ON;
"""
FUNCTIONS = """
@@ -32,6 +37,7 @@ MACROS = """
void CRYPTO_add(int *, int, int);
void CRYPTO_malloc_init();
void CRYPTO_malloc_debug_init();
+
#define CRYPTO_MEM_CHECK_ON ...
#define CRYPTO_MEM_CHECK_OFF ...
#define CRYPTO_MEM_CHECK_ENABLE ...
diff --git a/cryptography/hazmat/backends/openssl/opensslv.py b/cryptography/hazmat/backends/openssl/opensslv.py
index 37bbd2a7..4e110327 100644
--- a/cryptography/hazmat/backends/openssl/opensslv.py
+++ b/cryptography/hazmat/backends/openssl/opensslv.py
@@ -16,6 +16,7 @@ INCLUDES = """
"""
TYPES = """
+static const int OPENSSL_VERSION_NUMBER;
static char *const OPENSSL_VERSION_TEXT;
"""
diff --git a/cryptography/hazmat/backends/openssl/rand.py b/cryptography/hazmat/backends/openssl/rand.py
index ddd0a3d8..5ac36cac 100644
--- a/cryptography/hazmat/backends/openssl/rand.py
+++ b/cryptography/hazmat/backends/openssl/rand.py
@@ -19,6 +19,7 @@ TYPES = """
"""
FUNCTIONS = """
+void ERR_load_RAND_strings();
void RAND_seed(const void *, int);
void RAND_add(const void *, int, double);
int RAND_status();
diff --git a/cryptography/hazmat/backends/openssl/ssl.py b/cryptography/hazmat/backends/openssl/ssl.py
index bf1ffcc6..3fd0bf23 100644
--- a/cryptography/hazmat/backends/openssl/ssl.py
+++ b/cryptography/hazmat/backends/openssl/ssl.py
@@ -22,6 +22,16 @@ static const int Cryptography_HAS_SSL2;
/* Internally invented symbol to tell us if SNI is supported */
static const int Cryptography_HAS_TLSEXT_HOSTNAME;
+/* Internally invented symbol to tell us if SSL_MODE_RELEASE_BUFFERS is
+ * supported
+ */
+static const int Cryptography_HAS_RELEASE_BUFFERS;
+
+/* Internally invented symbol to tell us if SSL_OP_NO_COMPRESSION is
+ * supported
+ */
+static const int Cryptography_HAS_OP_NO_COMPRESSION;
+
static const int SSL_FILETYPE_PEM;
static const int SSL_FILETYPE_ASN1;
static const int SSL_ERROR_NONE;
@@ -36,6 +46,7 @@ static const int SSL_RECEIVED_SHUTDOWN;
static const int SSL_OP_NO_SSLv2;
static const int SSL_OP_NO_SSLv3;
static const int SSL_OP_NO_TLSv1;
+static const int SSL_OP_NO_COMPRESSION;
static const int SSL_OP_SINGLE_DH_USE;
static const int SSL_OP_EPHEMERAL_RSA;
static const int SSL_OP_MICROSOFT_SESS_ID_BUG;
@@ -90,6 +101,7 @@ static const int SSL_CB_CONNECT_LOOP;
static const int SSL_CB_CONNECT_EXIT;
static const int SSL_CB_HANDSHAKE_START;
static const int SSL_CB_HANDSHAKE_DONE;
+static const int SSL_MODE_RELEASE_BUFFERS;
static const int SSL_MODE_ENABLE_PARTIAL_WRITE;
static const int SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER;
static const int SSL_MODE_AUTO_RETRY;
@@ -261,6 +273,20 @@ void (*SSL_CTX_set_tlsext_servername_callback)(
SSL_CTX *,
int (*)(const SSL *, int *, void *)) = NULL;
#endif
+
+#ifdef SSL_MODE_RELEASE_BUFFERS
+static const int Cryptography_HAS_RELEASE_BUFFERS = 1;
+#else
+static const int Cryptography_HAS_RELEASE_BUFFERS = 0;
+const int SSL_MODE_RELEASE_BUFFERS = 0;
+#endif
+
+#ifdef SSL_OP_NO_COMPRESSION
+static const int Cryptography_HAS_OP_NO_COMPRESSION = 1;
+#else
+static const int Cryptography_HAS_OP_NO_COMPRESSION = 0;
+const int SSL_OP_NO_COMPRESSION = 0;
+#endif
"""
CONDITIONAL_NAMES = {
@@ -274,5 +300,14 @@ CONDITIONAL_NAMES = {
"SSL_set_tlsext_host_name",
"SSL_get_servername",
"SSL_CTX_set_tlsext_servername_callback",
- ]
+ ],
+
+ "Cryptography_HAS_RELEASE_BUFFERS": [
+ "SSL_MODE_RELEASE_BUFFERS",
+ ],
+
+ "Cryptography_HAS_OP_NO_COMPRESSION": [
+ "SSL_OP_NO_COMPRESSION",
+ ],
+
}