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 5from __future__ import absolute_import, division, print_function 6 7INCLUDES = """ 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#define CRYPTOGRAPHY_OPENSSL_110F_OR_GREATER \ 37 (OPENSSL_VERSION_NUMBER >= 0x1010006f && !CRYPTOGRAPHY_IS_LIBRESSL) 38 39#define CRYPTOGRAPHY_OPENSSL_LESS_THAN_110J \ 40 (OPENSSL_VERSION_NUMBER < 0x101000af || CRYPTOGRAPHY_IS_LIBRESSL) 41#define CRYPTOGRAPHY_OPENSSL_LESS_THAN_111 \ 42 (OPENSSL_VERSION_NUMBER < 0x10101000 || CRYPTOGRAPHY_IS_LIBRESSL) 43#define CRYPTOGRAPHY_OPENSSL_LESS_THAN_111B \ 44 (OPENSSL_VERSION_NUMBER < 0x10101020 || CRYPTOGRAPHY_IS_LIBRESSL) 45#define CRYPTOGRAPHY_OPENSSL_LESS_THAN_111D \ 46 (OPENSSL_VERSION_NUMBER < 0x10101040 || CRYPTOGRAPHY_IS_LIBRESSL) 47#if (CRYPTOGRAPHY_OPENSSL_LESS_THAN_111D && !CRYPTOGRAPHY_IS_LIBRESSL && \ 48 !defined(OPENSSL_NO_ENGINE)) || defined(USE_OSRANDOM_RNG_FOR_TESTING) 49#define CRYPTOGRAPHY_NEEDS_OSRANDOM_ENGINE 1 50#else 51#define CRYPTOGRAPHY_NEEDS_OSRANDOM_ENGINE 0 52#endif 53""" 54 55TYPES = """ 56static const int CRYPTOGRAPHY_OPENSSL_110F_OR_GREATER; 57 58static const int CRYPTOGRAPHY_OPENSSL_LESS_THAN_111; 59static const int CRYPTOGRAPHY_OPENSSL_LESS_THAN_111B; 60static const int CRYPTOGRAPHY_NEEDS_OSRANDOM_ENGINE; 61 62static const int CRYPTOGRAPHY_IS_LIBRESSL; 63""" 64 65FUNCTIONS = """ 66""" 67 68CUSTOMIZATIONS = """ 69""" 70