aboutsummaryrefslogtreecommitdiffstats
path: root/src/_cffi_src/openssl/cryptography.py
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2016-07-11 17:03:13 -0400
committerPaul Kehrer <paul.l.kehrer@gmail.com>2016-07-11 21:03:13 +0000
commit3e3444fa96a3fa911e99e1c12f1a0d859563ce2c (patch)
tree0e31161fc63ceb82586c9fcd37851c77a41731a5 /src/_cffi_src/openssl/cryptography.py
parentdbb64bd2a4a63f6071b1ac982b96d5d07bbd8a63 (diff)
downloadcryptography-3e3444fa96a3fa911e99e1c12f1a0d859563ce2c.tar.gz
cryptography-3e3444fa96a3fa911e99e1c12f1a0d859563ce2c.tar.bz2
cryptography-3e3444fa96a3fa911e99e1c12f1a0d859563ce2c.zip
Use a series of constants for OpenSSL version checks (#3037)
* Use a series of constants for OpenSSL version checks. N.B. I removed several qualifiers that were being used to express beta vs. release in OpenSSL version numbers. Reviewers please look closely! * Convert some python as well, also add the file * flake8 * Simplify code, remove functionality that can be expressed more simply * clean up the tests as well * more constants * wrap long lines * reflect feedback * unused * add this back?
Diffstat (limited to 'src/_cffi_src/openssl/cryptography.py')
-rw-r--r--src/_cffi_src/openssl/cryptography.py54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/_cffi_src/openssl/cryptography.py b/src/_cffi_src/openssl/cryptography.py
new file mode 100644
index 00000000..c3b0a1dc
--- /dev/null
+++ b/src/_cffi_src/openssl/cryptography.py
@@ -0,0 +1,54 @@
+# This file is dual licensed under the terms of the Apache License, Version
+# 2.0, and the BSD License. See the LICENSE file in the root of this repository
+# for complete details.
+
+from __future__ import absolute_import, division, print_function
+
+INCLUDES = """
+#include <openssl/opensslv.h>
+/*
+ LibreSSL removed e_os2.h from the public headers so we'll only include it
+ if we're using vanilla OpenSSL.
+*/
+#if !defined(LIBRESSL_VERSION_NUMBER)
+#include <openssl/e_os2.h>
+#endif
+#if defined(_WIN32)
+#include <windows.h>
+#endif
+
+#define CRYPTOGRAPHY_OPENSSL_101_OR_GREATER \
+ (OPENSSL_VERSION_NUMBER >= 0x10001000)
+#define CRYPTOGRAPHY_OPENSSL_102_OR_GREATER \
+ (OPENSSL_VERSION_NUMBER >= 0x10002000)
+#define CRYPTOGRAPHY_OPENSSL_102BETA2_OR_GREATER \
+ (OPENSSL_VERSION_NUMBER >= 0x10002002)
+#define CRYPTOGRAPHY_OPENSSL_110_OR_GREATER \
+ (OPENSSL_VERSION_NUMBER >= 0x10100000)
+
+#define CRYPTOGRAPHY_OPENSSL_LESS_THAN_101 \
+ (OPENSSL_VERSION_NUMBER < 0x10001000)
+#define CRYPTOGRAPHY_OPENSSL_LESS_THAN_102 \
+ (OPENSSL_VERSION_NUMBER < 0x10002000)
+#define CRYPTOGRAPHY_OPENSSL_LESS_THAN_102BETA3 \
+ (OPENSSL_VERSION_NUMBER < 0x10002003)
+#define CRYPTOGRAPHY_OPENSSL_LESS_THAN_110 \
+ (OPENSSL_VERSION_NUMBER < 0x10100000)
+#define CRYPTOGRAPHY_OPENSSL_LESS_THAN_110PRE5 \
+ (OPENSSL_VERSION_NUMBER < 0x10100005)
+"""
+
+TYPES = """
+static const int CRYPTOGRAPHY_OPENSSL_101_OR_GREATER;
+
+static const int CRYPTOGRAPHY_OPENSSL_LESS_THAN_101;
+"""
+
+FUNCTIONS = """
+"""
+
+MACROS = """
+"""
+
+CUSTOMIZATIONS = """
+"""