We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Build failed on OpenBSD 7.2
OpenBSD 7.2 upgraded LibreSSL to 3.6.0 (LIBRESSL_VERSION_NUMBER 0x3060000fL) that has OPENSSL_cleanup function.

Please update version check in src/_cffi_src/openssl/crypto.py to:
```
#if CRYPTOGRAPHY_IS_LIBRESSL && LIBRESSL_VERSION_NUMBER < 0x3060000fL
static const long Cryptography_HAS_OPENSSL_CLEANUP = 0;
void (*OPENSSL_cleanup)(void) = NULL;
#else
static const long Cryptography_HAS_OPENSSL_CLEANUP = 1;
#endif
```

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/_cffi_src/openssl/crypto.py`
Content:
```
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 
6 INCLUDES = """
7 #include <openssl/crypto.h>
8 """
9 
10 TYPES = """
11 static const long Cryptography_HAS_MEM_FUNCTIONS;
12 static const long Cryptography_HAS_OPENSSL_CLEANUP;
13 
14 static const int SSLEAY_VERSION;
15 static const int SSLEAY_CFLAGS;
16 static const int SSLEAY_PLATFORM;
17 static const int SSLEAY_DIR;
18 static const int SSLEAY_BUILT_ON;
19 static const int OPENSSL_VERSION;
20 static const int OPENSSL_CFLAGS;
21 static const int OPENSSL_BUILT_ON;
22 static const int OPENSSL_PLATFORM;
23 static const int OPENSSL_DIR;
24 """
25 
26 FUNCTIONS = """
27 void OPENSSL_cleanup(void);
28 
29 /* SSLeay was removed in 1.1.0 */
30 unsigned long SSLeay(void);
31 const char *SSLeay_version(int);
32 /* these functions were added to replace the SSLeay functions in 1.1.0 */
33 unsigned long OpenSSL_version_num(void);
34 const char *OpenSSL_version(int);
35 
36 void *OPENSSL_malloc(size_t);
37 void OPENSSL_free(void *);
38 
39 
40 /* Signature is significantly different in LibreSSL, so expose via different
41    symbol name */
42 int Cryptography_CRYPTO_set_mem_functions(
43     void *(*)(size_t, const char *, int),
44     void *(*)(void *, size_t, const char *, int),
45     void (*)(void *, const char *, int));
46 
47 void *Cryptography_malloc_wrapper(size_t, const char *, int);
48 void *Cryptography_realloc_wrapper(void *, size_t, const char *, int);
49 void Cryptography_free_wrapper(void *, const char *, int);
50 """
51 
52 CUSTOMIZATIONS = """
53 /* In 1.1.0 SSLeay has finally been retired. We bidirectionally define the
54    values so you can use either one. This is so we can use the new function
55    names no matter what OpenSSL we're running on, but users on older pyOpenSSL
56    releases won't see issues if they're running OpenSSL 1.1.0 */
57 #if !defined(SSLEAY_VERSION)
58 # define SSLeay                  OpenSSL_version_num
59 # define SSLeay_version          OpenSSL_version
60 # define SSLEAY_VERSION_NUMBER   OPENSSL_VERSION_NUMBER
61 # define SSLEAY_VERSION          OPENSSL_VERSION
62 # define SSLEAY_CFLAGS           OPENSSL_CFLAGS
63 # define SSLEAY_BUILT_ON         OPENSSL_BUILT_ON
64 # define SSLEAY_PLATFORM         OPENSSL_PLATFORM
65 # define SSLEAY_DIR              OPENSSL_DIR
66 #endif
67 #if !defined(OPENSSL_VERSION)
68 # define OpenSSL_version_num     SSLeay
69 # define OpenSSL_version         SSLeay_version
70 # define OPENSSL_VERSION         SSLEAY_VERSION
71 # define OPENSSL_CFLAGS          SSLEAY_CFLAGS
72 # define OPENSSL_BUILT_ON        SSLEAY_BUILT_ON
73 # define OPENSSL_PLATFORM        SSLEAY_PLATFORM
74 # define OPENSSL_DIR             SSLEAY_DIR
75 #endif
76 
77 #if CRYPTOGRAPHY_IS_LIBRESSL
78 static const long Cryptography_HAS_OPENSSL_CLEANUP = 0;
79 void (*OPENSSL_cleanup)(void) = NULL;
80 #else
81 static const long Cryptography_HAS_OPENSSL_CLEANUP = 1;
82 #endif
83 
84 #if CRYPTOGRAPHY_IS_LIBRESSL || CRYPTOGRAPHY_IS_BORINGSSL
85 static const long Cryptography_HAS_MEM_FUNCTIONS = 0;
86 int (*Cryptography_CRYPTO_set_mem_functions)(
87     void *(*)(size_t, const char *, int),
88     void *(*)(void *, size_t, const char *, int),
89     void (*)(void *, const char *, int)) = NULL;
90 
91 #else
92 static const long Cryptography_HAS_MEM_FUNCTIONS = 1;
93 
94 int Cryptography_CRYPTO_set_mem_functions(
95     void *(*m)(size_t, const char *, int),
96     void *(*r)(void *, size_t, const char *, int),
97     void (*f)(void *, const char *, int)
98 ) {
99     return CRYPTO_set_mem_functions(m, r, f);
100 }
101 #endif
102 
103 void *Cryptography_malloc_wrapper(size_t size, const char *path, int line) {
104     return malloc(size);
105 }
106 
107 void *Cryptography_realloc_wrapper(void *ptr, size_t size, const char *path,
108                                    int line) {
109     return realloc(ptr, size);
110 }
111 
112 void Cryptography_free_wrapper(void *ptr, const char *path, int line) {
113     free(ptr);
114 }
115 """
116
```

Path: `src/_cffi_src/openssl/cryptography.py`
Content:
```
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 
6 INCLUDES = """
7 /* define our OpenSSL API compatibility level to 1.0.1. Any symbols older than
8    that will raise an error during compilation. We can raise this number again
9    after we drop 1.0.2 support in the distant future.  */
10 #define OPENSSL_API_COMPAT 0x10001000L
11 
12 #if defined(_WIN32)
13 #define WIN32_LEAN_AND_MEAN
14 #include <windows.h>
15 #include <Wincrypt.h>
16 #include <Winsock2.h>
17 /*
18     undef some macros that are defined by wincrypt.h but are also types in
19     boringssl. openssl has worked around this but boring has not yet. see:
20     https://chromium.googlesource.com/chromium/src/+/refs/heads/main/base
21     /win/wincrypt_shim.h
22 */
23 #undef X509_NAME
24 #undef X509_EXTENSIONS
25 #undef PKCS7_SIGNER_INFO
26 #endif
27 
28 #include <openssl/opensslv.h>
29 
30 
31 #if defined(LIBRESSL_VERSION_NUMBER)
32 #define CRYPTOGRAPHY_IS_LIBRESSL 1
33 #else
34 #define CRYPTOGRAPHY_IS_LIBRESSL 0
35 #endif
36 
37 #if defined(OPENSSL_IS_BORINGSSL)
38 #define CRYPTOGRAPHY_IS_BORINGSSL 1
39 #else
40 #define CRYPTOGRAPHY_IS_BORINGSSL 0
41 #endif
42 
43 #if CRYPTOGRAPHY_IS_LIBRESSL
44 #define CRYPTOGRAPHY_LIBRESSL_LESS_THAN_350 \
45     (LIBRESSL_VERSION_NUMBER < 0x3050000f)
46 
47 #else
48 #define CRYPTOGRAPHY_LIBRESSL_LESS_THAN_350 (0)
49 #endif
50 
51 #if OPENSSL_VERSION_NUMBER < 0x10101000
52     #error "pyca/cryptography MUST be linked with Openssl 1.1.1 or later"
53 #endif
54 
55 #define CRYPTOGRAPHY_OPENSSL_111D_OR_GREATER \
56     (OPENSSL_VERSION_NUMBER >= 0x10101040 && !CRYPTOGRAPHY_IS_LIBRESSL)
57 #define CRYPTOGRAPHY_OPENSSL_300_OR_GREATER \
58     (OPENSSL_VERSION_NUMBER >= 0x30000000 && !CRYPTOGRAPHY_IS_LIBRESSL)
59 
60 #define CRYPTOGRAPHY_OPENSSL_LESS_THAN_111B \
61     (OPENSSL_VERSION_NUMBER < 0x10101020 || CRYPTOGRAPHY_IS_LIBRESSL)
62 #define CRYPTOGRAPHY_OPENSSL_LESS_THAN_111D \
63     (OPENSSL_VERSION_NUMBER < 0x10101040 || CRYPTOGRAPHY_IS_LIBRESSL)
64 #define CRYPTOGRAPHY_OPENSSL_LESS_THAN_111E \
65     (OPENSSL_VERSION_NUMBER < 0x10101050 || CRYPTOGRAPHY_IS_LIBRESSL)
66 #if (CRYPTOGRAPHY_OPENSSL_LESS_THAN_111D && !CRYPTOGRAPHY_IS_LIBRESSL && \
67     !defined(OPENSSL_NO_ENGINE)) || defined(USE_OSRANDOM_RNG_FOR_TESTING)
68 #define CRYPTOGRAPHY_NEEDS_OSRANDOM_ENGINE 1
69 #else
70 #define CRYPTOGRAPHY_NEEDS_OSRANDOM_ENGINE 0
71 #endif
72 """
73 
74 TYPES = """
75 static const int CRYPTOGRAPHY_OPENSSL_111D_OR_GREATER;
76 static const int CRYPTOGRAPHY_OPENSSL_300_OR_GREATER;
77 
78 static const int CRYPTOGRAPHY_OPENSSL_LESS_THAN_111B;
79 static const int CRYPTOGRAPHY_OPENSSL_LESS_THAN_111E;
80 static const int CRYPTOGRAPHY_NEEDS_OSRANDOM_ENGINE;
81 
82 static const int CRYPTOGRAPHY_LIBRESSL_LESS_THAN_350;
83 
84 static const int CRYPTOGRAPHY_IS_LIBRESSL;
85 static const int CRYPTOGRAPHY_IS_BORINGSSL;
86 """
87 
88 FUNCTIONS = """
89 """
90 
91 CUSTOMIZATIONS = """
92 """
93
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/src/_cffi_src/openssl/crypto.py b/src/_cffi_src/openssl/crypto.py
--- a/src/_cffi_src/openssl/crypto.py
+++ b/src/_cffi_src/openssl/crypto.py
@@ -74,7 +74,7 @@
 # define OPENSSL_DIR             SSLEAY_DIR
 #endif
 
-#if CRYPTOGRAPHY_IS_LIBRESSL
+#if CRYPTOGRAPHY_LIBRESSL_LESS_THAN_360
 static const long Cryptography_HAS_OPENSSL_CLEANUP = 0;
 void (*OPENSSL_cleanup)(void) = NULL;
 #else
diff --git a/src/_cffi_src/openssl/cryptography.py b/src/_cffi_src/openssl/cryptography.py
--- a/src/_cffi_src/openssl/cryptography.py
+++ b/src/_cffi_src/openssl/cryptography.py
@@ -43,9 +43,12 @@
 #if CRYPTOGRAPHY_IS_LIBRESSL
 #define CRYPTOGRAPHY_LIBRESSL_LESS_THAN_350 \
     (LIBRESSL_VERSION_NUMBER < 0x3050000f)
+#define CRYPTOGRAPHY_LIBRESSL_LESS_THAN_360 \
+    (LIBRESSL_VERSION_NUMBER < 0x3060000f)
 
 #else
 #define CRYPTOGRAPHY_LIBRESSL_LESS_THAN_350 (0)
+#define CRYPTOGRAPHY_LIBRESSL_LESS_THAN_360 (0)
 #endif
 
 #if OPENSSL_VERSION_NUMBER < 0x10101000

{"golden_diff": "diff --git a/src/_cffi_src/openssl/crypto.py b/src/_cffi_src/openssl/crypto.py\n--- a/src/_cffi_src/openssl/crypto.py\n+++ b/src/_cffi_src/openssl/crypto.py\n@@ -74,7 +74,7 @@\n # define OPENSSL_DIR             SSLEAY_DIR\n #endif\n \n-#if CRYPTOGRAPHY_IS_LIBRESSL\n+#if CRYPTOGRAPHY_LIBRESSL_LESS_THAN_360\n static const long Cryptography_HAS_OPENSSL_CLEANUP = 0;\n void (*OPENSSL_cleanup)(void) = NULL;\n #else\ndiff --git a/src/_cffi_src/openssl/cryptography.py b/src/_cffi_src/openssl/cryptography.py\n--- a/src/_cffi_src/openssl/cryptography.py\n+++ b/src/_cffi_src/openssl/cryptography.py\n@@ -43,9 +43,12 @@\n #if CRYPTOGRAPHY_IS_LIBRESSL\n #define CRYPTOGRAPHY_LIBRESSL_LESS_THAN_350 \\\n     (LIBRESSL_VERSION_NUMBER < 0x3050000f)\n+#define CRYPTOGRAPHY_LIBRESSL_LESS_THAN_360 \\\n+    (LIBRESSL_VERSION_NUMBER < 0x3060000f)\n \n #else\n #define CRYPTOGRAPHY_LIBRESSL_LESS_THAN_350 (0)\n+#define CRYPTOGRAPHY_LIBRESSL_LESS_THAN_360 (0)\n #endif\n \n #if OPENSSL_VERSION_NUMBER < 0x10101000\n", "issue": "Build failed on OpenBSD 7.2\nOpenBSD 7.2 upgraded LibreSSL to 3.6.0 (LIBRESSL_VERSION_NUMBER 0x3060000fL) that has OPENSSL_cleanup function.\r\n\r\nPlease update version check in src/_cffi_src/openssl/crypto.py to:\r\n```\r\n#if CRYPTOGRAPHY_IS_LIBRESSL && LIBRESSL_VERSION_NUMBER < 0x3060000fL\r\nstatic const long Cryptography_HAS_OPENSSL_CLEANUP = 0;\r\nvoid (*OPENSSL_cleanup)(void) = NULL;\r\n#else\r\nstatic const long Cryptography_HAS_OPENSSL_CLEANUP = 1;\r\n#endif\r\n```\n", "before_files": [{"content": "# This file is dual licensed under the terms of the Apache License, Version\n# 2.0, and the BSD License. See the LICENSE file in the root of this repository\n# for complete details.\n\n\nINCLUDES = \"\"\"\n#include <openssl/crypto.h>\n\"\"\"\n\nTYPES = \"\"\"\nstatic const long Cryptography_HAS_MEM_FUNCTIONS;\nstatic const long Cryptography_HAS_OPENSSL_CLEANUP;\n\nstatic const int SSLEAY_VERSION;\nstatic const int SSLEAY_CFLAGS;\nstatic const int SSLEAY_PLATFORM;\nstatic const int SSLEAY_DIR;\nstatic const int SSLEAY_BUILT_ON;\nstatic const int OPENSSL_VERSION;\nstatic const int OPENSSL_CFLAGS;\nstatic const int OPENSSL_BUILT_ON;\nstatic const int OPENSSL_PLATFORM;\nstatic const int OPENSSL_DIR;\n\"\"\"\n\nFUNCTIONS = \"\"\"\nvoid OPENSSL_cleanup(void);\n\n/* SSLeay was removed in 1.1.0 */\nunsigned long SSLeay(void);\nconst char *SSLeay_version(int);\n/* these functions were added to replace the SSLeay functions in 1.1.0 */\nunsigned long OpenSSL_version_num(void);\nconst char *OpenSSL_version(int);\n\nvoid *OPENSSL_malloc(size_t);\nvoid OPENSSL_free(void *);\n\n\n/* Signature is significantly different in LibreSSL, so expose via different\n   symbol name */\nint Cryptography_CRYPTO_set_mem_functions(\n    void *(*)(size_t, const char *, int),\n    void *(*)(void *, size_t, const char *, int),\n    void (*)(void *, const char *, int));\n\nvoid *Cryptography_malloc_wrapper(size_t, const char *, int);\nvoid *Cryptography_realloc_wrapper(void *, size_t, const char *, int);\nvoid Cryptography_free_wrapper(void *, const char *, int);\n\"\"\"\n\nCUSTOMIZATIONS = \"\"\"\n/* In 1.1.0 SSLeay has finally been retired. We bidirectionally define the\n   values so you can use either one. This is so we can use the new function\n   names no matter what OpenSSL we're running on, but users on older pyOpenSSL\n   releases won't see issues if they're running OpenSSL 1.1.0 */\n#if !defined(SSLEAY_VERSION)\n# define SSLeay                  OpenSSL_version_num\n# define SSLeay_version          OpenSSL_version\n# define SSLEAY_VERSION_NUMBER   OPENSSL_VERSION_NUMBER\n# define SSLEAY_VERSION          OPENSSL_VERSION\n# define SSLEAY_CFLAGS           OPENSSL_CFLAGS\n# define SSLEAY_BUILT_ON         OPENSSL_BUILT_ON\n# define SSLEAY_PLATFORM         OPENSSL_PLATFORM\n# define SSLEAY_DIR              OPENSSL_DIR\n#endif\n#if !defined(OPENSSL_VERSION)\n# define OpenSSL_version_num     SSLeay\n# define OpenSSL_version         SSLeay_version\n# define OPENSSL_VERSION         SSLEAY_VERSION\n# define OPENSSL_CFLAGS          SSLEAY_CFLAGS\n# define OPENSSL_BUILT_ON        SSLEAY_BUILT_ON\n# define OPENSSL_PLATFORM        SSLEAY_PLATFORM\n# define OPENSSL_DIR             SSLEAY_DIR\n#endif\n\n#if CRYPTOGRAPHY_IS_LIBRESSL\nstatic const long Cryptography_HAS_OPENSSL_CLEANUP = 0;\nvoid (*OPENSSL_cleanup)(void) = NULL;\n#else\nstatic const long Cryptography_HAS_OPENSSL_CLEANUP = 1;\n#endif\n\n#if CRYPTOGRAPHY_IS_LIBRESSL || CRYPTOGRAPHY_IS_BORINGSSL\nstatic const long Cryptography_HAS_MEM_FUNCTIONS = 0;\nint (*Cryptography_CRYPTO_set_mem_functions)(\n    void *(*)(size_t, const char *, int),\n    void *(*)(void *, size_t, const char *, int),\n    void (*)(void *, const char *, int)) = NULL;\n\n#else\nstatic const long Cryptography_HAS_MEM_FUNCTIONS = 1;\n\nint Cryptography_CRYPTO_set_mem_functions(\n    void *(*m)(size_t, const char *, int),\n    void *(*r)(void *, size_t, const char *, int),\n    void (*f)(void *, const char *, int)\n) {\n    return CRYPTO_set_mem_functions(m, r, f);\n}\n#endif\n\nvoid *Cryptography_malloc_wrapper(size_t size, const char *path, int line) {\n    return malloc(size);\n}\n\nvoid *Cryptography_realloc_wrapper(void *ptr, size_t size, const char *path,\n                                   int line) {\n    return realloc(ptr, size);\n}\n\nvoid Cryptography_free_wrapper(void *ptr, const char *path, int line) {\n    free(ptr);\n}\n\"\"\"\n", "path": "src/_cffi_src/openssl/crypto.py"}, {"content": "# This file is dual licensed under the terms of the Apache License, Version\n# 2.0, and the BSD License. See the LICENSE file in the root of this repository\n# for complete details.\n\n\nINCLUDES = \"\"\"\n/* define our OpenSSL API compatibility level to 1.0.1. Any symbols older than\n   that will raise an error during compilation. We can raise this number again\n   after we drop 1.0.2 support in the distant future.  */\n#define OPENSSL_API_COMPAT 0x10001000L\n\n#if defined(_WIN32)\n#define WIN32_LEAN_AND_MEAN\n#include <windows.h>\n#include <Wincrypt.h>\n#include <Winsock2.h>\n/*\n    undef some macros that are defined by wincrypt.h but are also types in\n    boringssl. openssl has worked around this but boring has not yet. see:\n    https://chromium.googlesource.com/chromium/src/+/refs/heads/main/base\n    /win/wincrypt_shim.h\n*/\n#undef X509_NAME\n#undef X509_EXTENSIONS\n#undef PKCS7_SIGNER_INFO\n#endif\n\n#include <openssl/opensslv.h>\n\n\n#if defined(LIBRESSL_VERSION_NUMBER)\n#define CRYPTOGRAPHY_IS_LIBRESSL 1\n#else\n#define CRYPTOGRAPHY_IS_LIBRESSL 0\n#endif\n\n#if defined(OPENSSL_IS_BORINGSSL)\n#define CRYPTOGRAPHY_IS_BORINGSSL 1\n#else\n#define CRYPTOGRAPHY_IS_BORINGSSL 0\n#endif\n\n#if CRYPTOGRAPHY_IS_LIBRESSL\n#define CRYPTOGRAPHY_LIBRESSL_LESS_THAN_350 \\\n    (LIBRESSL_VERSION_NUMBER < 0x3050000f)\n\n#else\n#define CRYPTOGRAPHY_LIBRESSL_LESS_THAN_350 (0)\n#endif\n\n#if OPENSSL_VERSION_NUMBER < 0x10101000\n    #error \"pyca/cryptography MUST be linked with Openssl 1.1.1 or later\"\n#endif\n\n#define CRYPTOGRAPHY_OPENSSL_111D_OR_GREATER \\\n    (OPENSSL_VERSION_NUMBER >= 0x10101040 && !CRYPTOGRAPHY_IS_LIBRESSL)\n#define CRYPTOGRAPHY_OPENSSL_300_OR_GREATER \\\n    (OPENSSL_VERSION_NUMBER >= 0x30000000 && !CRYPTOGRAPHY_IS_LIBRESSL)\n\n#define CRYPTOGRAPHY_OPENSSL_LESS_THAN_111B \\\n    (OPENSSL_VERSION_NUMBER < 0x10101020 || CRYPTOGRAPHY_IS_LIBRESSL)\n#define CRYPTOGRAPHY_OPENSSL_LESS_THAN_111D \\\n    (OPENSSL_VERSION_NUMBER < 0x10101040 || CRYPTOGRAPHY_IS_LIBRESSL)\n#define CRYPTOGRAPHY_OPENSSL_LESS_THAN_111E \\\n    (OPENSSL_VERSION_NUMBER < 0x10101050 || CRYPTOGRAPHY_IS_LIBRESSL)\n#if (CRYPTOGRAPHY_OPENSSL_LESS_THAN_111D && !CRYPTOGRAPHY_IS_LIBRESSL && \\\n    !defined(OPENSSL_NO_ENGINE)) || defined(USE_OSRANDOM_RNG_FOR_TESTING)\n#define CRYPTOGRAPHY_NEEDS_OSRANDOM_ENGINE 1\n#else\n#define CRYPTOGRAPHY_NEEDS_OSRANDOM_ENGINE 0\n#endif\n\"\"\"\n\nTYPES = \"\"\"\nstatic const int CRYPTOGRAPHY_OPENSSL_111D_OR_GREATER;\nstatic const int CRYPTOGRAPHY_OPENSSL_300_OR_GREATER;\n\nstatic const int CRYPTOGRAPHY_OPENSSL_LESS_THAN_111B;\nstatic const int CRYPTOGRAPHY_OPENSSL_LESS_THAN_111E;\nstatic const int CRYPTOGRAPHY_NEEDS_OSRANDOM_ENGINE;\n\nstatic const int CRYPTOGRAPHY_LIBRESSL_LESS_THAN_350;\n\nstatic const int CRYPTOGRAPHY_IS_LIBRESSL;\nstatic const int CRYPTOGRAPHY_IS_BORINGSSL;\n\"\"\"\n\nFUNCTIONS = \"\"\"\n\"\"\"\n\nCUSTOMIZATIONS = \"\"\"\n\"\"\"\n", "path": "src/_cffi_src/openssl/cryptography.py"}], "after_files": [{"content": "# This file is dual licensed under the terms of the Apache License, Version\n# 2.0, and the BSD License. See the LICENSE file in the root of this repository\n# for complete details.\n\n\nINCLUDES = \"\"\"\n#include <openssl/crypto.h>\n\"\"\"\n\nTYPES = \"\"\"\nstatic const long Cryptography_HAS_MEM_FUNCTIONS;\nstatic const long Cryptography_HAS_OPENSSL_CLEANUP;\n\nstatic const int SSLEAY_VERSION;\nstatic const int SSLEAY_CFLAGS;\nstatic const int SSLEAY_PLATFORM;\nstatic const int SSLEAY_DIR;\nstatic const int SSLEAY_BUILT_ON;\nstatic const int OPENSSL_VERSION;\nstatic const int OPENSSL_CFLAGS;\nstatic const int OPENSSL_BUILT_ON;\nstatic const int OPENSSL_PLATFORM;\nstatic const int OPENSSL_DIR;\n\"\"\"\n\nFUNCTIONS = \"\"\"\nvoid OPENSSL_cleanup(void);\n\n/* SSLeay was removed in 1.1.0 */\nunsigned long SSLeay(void);\nconst char *SSLeay_version(int);\n/* these functions were added to replace the SSLeay functions in 1.1.0 */\nunsigned long OpenSSL_version_num(void);\nconst char *OpenSSL_version(int);\n\nvoid *OPENSSL_malloc(size_t);\nvoid OPENSSL_free(void *);\n\n\n/* Signature is significantly different in LibreSSL, so expose via different\n   symbol name */\nint Cryptography_CRYPTO_set_mem_functions(\n    void *(*)(size_t, const char *, int),\n    void *(*)(void *, size_t, const char *, int),\n    void (*)(void *, const char *, int));\n\nvoid *Cryptography_malloc_wrapper(size_t, const char *, int);\nvoid *Cryptography_realloc_wrapper(void *, size_t, const char *, int);\nvoid Cryptography_free_wrapper(void *, const char *, int);\n\"\"\"\n\nCUSTOMIZATIONS = \"\"\"\n/* In 1.1.0 SSLeay has finally been retired. We bidirectionally define the\n   values so you can use either one. This is so we can use the new function\n   names no matter what OpenSSL we're running on, but users on older pyOpenSSL\n   releases won't see issues if they're running OpenSSL 1.1.0 */\n#if !defined(SSLEAY_VERSION)\n# define SSLeay                  OpenSSL_version_num\n# define SSLeay_version          OpenSSL_version\n# define SSLEAY_VERSION_NUMBER   OPENSSL_VERSION_NUMBER\n# define SSLEAY_VERSION          OPENSSL_VERSION\n# define SSLEAY_CFLAGS           OPENSSL_CFLAGS\n# define SSLEAY_BUILT_ON         OPENSSL_BUILT_ON\n# define SSLEAY_PLATFORM         OPENSSL_PLATFORM\n# define SSLEAY_DIR              OPENSSL_DIR\n#endif\n#if !defined(OPENSSL_VERSION)\n# define OpenSSL_version_num     SSLeay\n# define OpenSSL_version         SSLeay_version\n# define OPENSSL_VERSION         SSLEAY_VERSION\n# define OPENSSL_CFLAGS          SSLEAY_CFLAGS\n# define OPENSSL_BUILT_ON        SSLEAY_BUILT_ON\n# define OPENSSL_PLATFORM        SSLEAY_PLATFORM\n# define OPENSSL_DIR             SSLEAY_DIR\n#endif\n\n#if CRYPTOGRAPHY_LIBRESSL_LESS_THAN_360\nstatic const long Cryptography_HAS_OPENSSL_CLEANUP = 0;\nvoid (*OPENSSL_cleanup)(void) = NULL;\n#else\nstatic const long Cryptography_HAS_OPENSSL_CLEANUP = 1;\n#endif\n\n#if CRYPTOGRAPHY_IS_LIBRESSL || CRYPTOGRAPHY_IS_BORINGSSL\nstatic const long Cryptography_HAS_MEM_FUNCTIONS = 0;\nint (*Cryptography_CRYPTO_set_mem_functions)(\n    void *(*)(size_t, const char *, int),\n    void *(*)(void *, size_t, const char *, int),\n    void (*)(void *, const char *, int)) = NULL;\n\n#else\nstatic const long Cryptography_HAS_MEM_FUNCTIONS = 1;\n\nint Cryptography_CRYPTO_set_mem_functions(\n    void *(*m)(size_t, const char *, int),\n    void *(*r)(void *, size_t, const char *, int),\n    void (*f)(void *, const char *, int)\n) {\n    return CRYPTO_set_mem_functions(m, r, f);\n}\n#endif\n\nvoid *Cryptography_malloc_wrapper(size_t size, const char *path, int line) {\n    return malloc(size);\n}\n\nvoid *Cryptography_realloc_wrapper(void *ptr, size_t size, const char *path,\n                                   int line) {\n    return realloc(ptr, size);\n}\n\nvoid Cryptography_free_wrapper(void *ptr, const char *path, int line) {\n    free(ptr);\n}\n\"\"\"\n", "path": "src/_cffi_src/openssl/crypto.py"}, {"content": "# This file is dual licensed under the terms of the Apache License, Version\n# 2.0, and the BSD License. See the LICENSE file in the root of this repository\n# for complete details.\n\n\nINCLUDES = \"\"\"\n/* define our OpenSSL API compatibility level to 1.0.1. Any symbols older than\n   that will raise an error during compilation. We can raise this number again\n   after we drop 1.0.2 support in the distant future.  */\n#define OPENSSL_API_COMPAT 0x10001000L\n\n#if defined(_WIN32)\n#define WIN32_LEAN_AND_MEAN\n#include <windows.h>\n#include <Wincrypt.h>\n#include <Winsock2.h>\n/*\n    undef some macros that are defined by wincrypt.h but are also types in\n    boringssl. openssl has worked around this but boring has not yet. see:\n    https://chromium.googlesource.com/chromium/src/+/refs/heads/main/base\n    /win/wincrypt_shim.h\n*/\n#undef X509_NAME\n#undef X509_EXTENSIONS\n#undef PKCS7_SIGNER_INFO\n#endif\n\n#include <openssl/opensslv.h>\n\n\n#if defined(LIBRESSL_VERSION_NUMBER)\n#define CRYPTOGRAPHY_IS_LIBRESSL 1\n#else\n#define CRYPTOGRAPHY_IS_LIBRESSL 0\n#endif\n\n#if defined(OPENSSL_IS_BORINGSSL)\n#define CRYPTOGRAPHY_IS_BORINGSSL 1\n#else\n#define CRYPTOGRAPHY_IS_BORINGSSL 0\n#endif\n\n#if CRYPTOGRAPHY_IS_LIBRESSL\n#define CRYPTOGRAPHY_LIBRESSL_LESS_THAN_350 \\\n    (LIBRESSL_VERSION_NUMBER < 0x3050000f)\n#define CRYPTOGRAPHY_LIBRESSL_LESS_THAN_360 \\\n    (LIBRESSL_VERSION_NUMBER < 0x3060000f)\n\n#else\n#define CRYPTOGRAPHY_LIBRESSL_LESS_THAN_350 (0)\n#define CRYPTOGRAPHY_LIBRESSL_LESS_THAN_360 (0)\n#endif\n\n#if OPENSSL_VERSION_NUMBER < 0x10101000\n    #error \"pyca/cryptography MUST be linked with Openssl 1.1.1 or later\"\n#endif\n\n#define CRYPTOGRAPHY_OPENSSL_111D_OR_GREATER \\\n    (OPENSSL_VERSION_NUMBER >= 0x10101040 && !CRYPTOGRAPHY_IS_LIBRESSL)\n#define CRYPTOGRAPHY_OPENSSL_300_OR_GREATER \\\n    (OPENSSL_VERSION_NUMBER >= 0x30000000 && !CRYPTOGRAPHY_IS_LIBRESSL)\n\n#define CRYPTOGRAPHY_OPENSSL_LESS_THAN_111B \\\n    (OPENSSL_VERSION_NUMBER < 0x10101020 || CRYPTOGRAPHY_IS_LIBRESSL)\n#define CRYPTOGRAPHY_OPENSSL_LESS_THAN_111D \\\n    (OPENSSL_VERSION_NUMBER < 0x10101040 || CRYPTOGRAPHY_IS_LIBRESSL)\n#define CRYPTOGRAPHY_OPENSSL_LESS_THAN_111E \\\n    (OPENSSL_VERSION_NUMBER < 0x10101050 || CRYPTOGRAPHY_IS_LIBRESSL)\n#if (CRYPTOGRAPHY_OPENSSL_LESS_THAN_111D && !CRYPTOGRAPHY_IS_LIBRESSL && \\\n    !defined(OPENSSL_NO_ENGINE)) || defined(USE_OSRANDOM_RNG_FOR_TESTING)\n#define CRYPTOGRAPHY_NEEDS_OSRANDOM_ENGINE 1\n#else\n#define CRYPTOGRAPHY_NEEDS_OSRANDOM_ENGINE 0\n#endif\n\"\"\"\n\nTYPES = \"\"\"\nstatic const int CRYPTOGRAPHY_OPENSSL_111D_OR_GREATER;\nstatic const int CRYPTOGRAPHY_OPENSSL_300_OR_GREATER;\n\nstatic const int CRYPTOGRAPHY_OPENSSL_LESS_THAN_111B;\nstatic const int CRYPTOGRAPHY_OPENSSL_LESS_THAN_111E;\nstatic const int CRYPTOGRAPHY_NEEDS_OSRANDOM_ENGINE;\n\nstatic const int CRYPTOGRAPHY_LIBRESSL_LESS_THAN_350;\n\nstatic const int CRYPTOGRAPHY_IS_LIBRESSL;\nstatic const int CRYPTOGRAPHY_IS_BORINGSSL;\n\"\"\"\n\nFUNCTIONS = \"\"\"\n\"\"\"\n\nCUSTOMIZATIONS = \"\"\"\n\"\"\"\n", "path": "src/_cffi_src/openssl/cryptography.py"}]}