tor  0.4.2.0-alpha-dev
compat_openssl.h
1 /* Copyright (c) 2001, Matej Pfajfar.
2  * Copyright (c) 2001-2004, Roger Dingledine.
3  * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
4  * Copyright (c) 2007-2019, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
6 
7 #ifndef TOR_COMPAT_OPENSSL_H
8 #define TOR_COMPAT_OPENSSL_H
9 
10 #include "orconfig.h"
11 
12 #ifdef ENABLE_OPENSSL
13 
14 #include <openssl/opensslv.h>
16 
23 #if !defined(LIBRESSL_VERSION_NUMBER) && \
24  OPENSSL_VERSION_NUMBER < OPENSSL_V_SERIES(1,0,1)
25 #error "We require OpenSSL >= 1.0.1"
26 #endif
27 
28 #if OPENSSL_VERSION_NUMBER >= OPENSSL_V_SERIES(1,1,0) && \
29  ! defined(LIBRESSL_VERSION_NUMBER)
30 /* We define this macro if we're trying to build with the majorly refactored
31  * API in OpenSSL 1.1 */
32 #define OPENSSL_1_1_API
33 #endif /* OPENSSL_VERSION_NUMBER >= OPENSSL_V_SERIES(1,1,0) && ... */
34 
35 #ifndef OPENSSL_VERSION
36 #define OPENSSL_VERSION SSLEAY_VERSION
37 #endif
38 
39 #ifndef OPENSSL_1_1_API
40 #define OpenSSL_version(v) SSLeay_version(v)
41 #define OpenSSL_version_num() SSLeay()
42 #define RAND_OpenSSL() RAND_SSLeay()
43 #define STATE_IS_SW_SERVER_HELLO(st) \
44  (((st) == SSL3_ST_SW_SRVR_HELLO_A) || \
45  ((st) == SSL3_ST_SW_SRVR_HELLO_B))
46 #define OSSL_HANDSHAKE_STATE int
47 #define CONST_IF_OPENSSL_1_1_API
48 #else /* !(!defined(OPENSSL_1_1_API)) */
49 #define STATE_IS_SW_SERVER_HELLO(st) \
50  ((st) == TLS_ST_SW_SRVR_HELLO)
51 #define CONST_IF_OPENSSL_1_1_API const
52 #endif /* !defined(OPENSSL_1_1_API) */
53 
54 #endif /* defined(ENABLE_OPENSSL) */
55 
56 #endif /* !defined(TOR_COMPAT_OPENSSL_H) */
57 
Headers for crypto_openssl_mgt.c.