Debian Codegraph @

lib_pypy/_cffi_ssl/_cffi_src/openssl/cryptography.py

raw symbols SCIP
1 # This file is dual licensed under the terms of the Apache License, Version
2 # 2.0, and the BSD License. See the LICENSE file in the root of this repository
3 # for complete details.
4
5 from __future__ import absolute_import, division, print_function
6
7 INCLUDES = """
8 /* define our OpenSSL API compatibility level to 1.0.1. Any symbols older than
9 that will raise an error during compilation. We can raise this number again
10 after we drop 1.0.2 support in the distant future. */
11 #define OPENSSL_API_COMPAT 0x10001000L
12
13 #include <openssl/opensslv.h>
14
15
16 #if defined(LIBRESSL_VERSION_NUMBER)
17 #define CRYPTOGRAPHY_IS_LIBRESSL 1
18 #else
19 #define CRYPTOGRAPHY_IS_LIBRESSL 0
20 #endif
21
22 /*
23 LibreSSL removed e_os2.h from the public headers so we'll only include it
24 if we're using vanilla OpenSSL.
25 */
26 #if !CRYPTOGRAPHY_IS_LIBRESSL
27 #include <openssl/e_os2.h>
28 #endif
29 #if defined(_WIN32)
30 #define WIN32_LEAN_AND_MEAN
31 #include <windows.h>
32 #include <Wincrypt.h>
33 #include <Winsock2.h>
34 #endif
35
36 #if CRYPTOGRAPHY_IS_LIBRESSL
37 #define CRYPTOGRAPHY_LIBRESSL_27_OR_GREATER \
38 (LIBRESSL_VERSION_NUMBER >= 0x2070000f)
39 #define CRYPTOGRAPHY_LIBRESSL_28_OR_GREATER \
40 (LIBRESSL_VERSION_NUMBER >= 0x2080000f)
41 #define CRYPTOGRAPHY_LIBRESSL_291_OR_GREATER \
42 (LIBRESSL_VERSION_NUMBER >= 0x2090100f)
43 #define CRYPTOGRAPHY_LIBRESSL_LESS_THAN_332 \
44 (LIBRESSL_VERSION_NUMBER < 0x3030200f)
45 #define CRYPTOGRAPHY_LIBRESSL_LESS_THAN_340 \
46 (LIBRESSL_VERSION_NUMBER < 0x3040000f)
47 #else
48 #define CRYPTOGRAPHY_LIBRESSL_27_OR_GREATER (0)
49 #define CRYPTOGRAPHY_LIBRESSL_28_OR_GREATER (0)
50 #define CRYPTOGRAPHY_LIBRESSL_291_OR_GREATER (0)
51 #define CRYPTOGRAPHY_LIBRESSL_LESS_THAN_332 (0)
52 #define CRYPTOGRAPHY_LIBRESSL_LESS_THAN_340 (0)
53 #endif
54
55 #define CRYPTOGRAPHY_OPENSSL_102_OR_GREATER \
56 (OPENSSL_VERSION_NUMBER >= 0x10002000 && !CRYPTOGRAPHY_IS_LIBRESSL)
57 #define CRYPTOGRAPHY_OPENSSL_102L_OR_GREATER \
58 (OPENSSL_VERSION_NUMBER >= 0x100020cf && !CRYPTOGRAPHY_IS_LIBRESSL)
59 #define CRYPTOGRAPHY_OPENSSL_110_OR_GREATER \
60 (OPENSSL_VERSION_NUMBER >= 0x10100000 && !CRYPTOGRAPHY_IS_LIBRESSL)
61 #define CRYPTOGRAPHY_OPENSSL_110F_OR_GREATER \
62 (OPENSSL_VERSION_NUMBER >= 0x1010006f && !CRYPTOGRAPHY_IS_LIBRESSL)
63 #define CRYPTOGRAPHY_OPENSSL_111D_OR_GREATER \
64 (OPENSSL_VERSION_NUMBER >= 0x10101040 && !CRYPTOGRAPHY_IS_LIBRESSL)
65 #define CRYPTOGRAPHY_OPENSSL_300_OR_GREATER \
66 (OPENSSL_VERSION_NUMBER >= 0x30000000 && !CRYPTOGRAPHY_IS_LIBRESSL)
67
68 #define CRYPTOGRAPHY_OPENSSL_LESS_THAN_102 \
69 (OPENSSL_VERSION_NUMBER < 0x10002000 || CRYPTOGRAPHY_IS_LIBRESSL)
70 #define CRYPTOGRAPHY_OPENSSL_LESS_THAN_102I \
71 (OPENSSL_VERSION_NUMBER < 0x1000209f || CRYPTOGRAPHY_IS_LIBRESSL)
72 #define CRYPTOGRAPHY_OPENSSL_LESS_THAN_110 \
73 (OPENSSL_VERSION_NUMBER < 0x10100000 || CRYPTOGRAPHY_IS_LIBRESSL)
74 #define CRYPTOGRAPHY_OPENSSL_LESS_THAN_110J \
75 (OPENSSL_VERSION_NUMBER < 0x101000af || CRYPTOGRAPHY_IS_LIBRESSL)
76 #define CRYPTOGRAPHY_OPENSSL_LESS_THAN_111 \
77 (OPENSSL_VERSION_NUMBER < 0x10101000 || CRYPTOGRAPHY_IS_LIBRESSL)
78 #define CRYPTOGRAPHY_OPENSSL_LESS_THAN_111B \
79 (OPENSSL_VERSION_NUMBER < 0x10101020 || CRYPTOGRAPHY_IS_LIBRESSL)
80 #define CRYPTOGRAPHY_OPENSSL_LESS_THAN_300 \
81 (OPENSSL_VERSION_NUMBER < 0x30000000 || CRYPTOGRAPHY_IS_LIBRESSL)
82 #define CRYPTOGRAPHY_OPENSSL_LESS_THAN_330 \
83 (OPENSSL_VERSION_NUMBER < 0x30300000 || CRYPTOGRAPHY_IS_LIBRESSL)
84 #define CRYPTOGRAPHY_OPENSSL_LESS_THAN_111D \
85 (OPENSSL_VERSION_NUMBER < 0x10101040 || CRYPTOGRAPHY_IS_LIBRESSL)
86 #if (CRYPTOGRAPHY_OPENSSL_LESS_THAN_111D && !CRYPTOGRAPHY_IS_LIBRESSL && \
87 !defined(OPENSSL_NO_ENGINE)) || defined(USE_OSRANDOM_RNG_FOR_TESTING)
88 #define CRYPTOGRAPHY_NEEDS_OSRANDOM_ENGINE 1
89 #else
90 #define CRYPTOGRAPHY_NEEDS_OSRANDOM_ENGINE 0
91 #endif
92 """
93
94 TYPES = """
95 static const int CRYPTOGRAPHY_OPENSSL_102L_OR_GREATER;
96 static const int CRYPTOGRAPHY_OPENSSL_110_OR_GREATER;
97 static const int CRYPTOGRAPHY_OPENSSL_110F_OR_GREATER;
98 static const int CRYPTOGRAPHY_OPENSSL_111D_OR_GREATER;
99 static const int CRYPTOGRAPHY_OPENSSL_300_OR_GREATER;
100
101 static const int CRYPTOGRAPHY_OPENSSL_LESS_THAN_102I;
102 static const int CRYPTOGRAPHY_OPENSSL_LESS_THAN_102;
103 static const int CRYPTOGRAPHY_OPENSSL_LESS_THAN_111;
104 static const int CRYPTOGRAPHY_OPENSSL_LESS_THAN_111B;
105 static const int CRYPTOGRAPHY_OPENSSL_LESS_THAN_300;
106 static const int CRYPTOGRAPHY_NEEDS_OSRANDOM_ENGINE;
107
108 static const int CRYPTOGRAPHY_IS_LIBRESSL;
109
110 static const int CRYPTOGRAPHY_LIBRESSL_28_OR_GREATER;
111 """
112
113 FUNCTIONS = """
114 """
115
116 CUSTOMIZATIONS = """
117 """