2015-11-10 16:02:21 +01:00
|
|
|
/* Copyright (c) 2001, Matej Pfajfar.
|
|
|
|
* Copyright (c) 2001-2004, Roger Dingledine.
|
|
|
|
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
|
2017-03-15 21:13:17 +01:00
|
|
|
* Copyright (c) 2007-2017, The Tor Project, Inc. */
|
2015-11-10 16:02:21 +01:00
|
|
|
/* See LICENSE for licensing information */
|
|
|
|
|
|
|
|
#ifndef TOR_COMPAT_OPENSSL_H
|
|
|
|
#define TOR_COMPAT_OPENSSL_H
|
|
|
|
|
2015-11-10 16:40:19 +01:00
|
|
|
#include <openssl/opensslv.h>
|
2018-01-19 18:56:13 +01:00
|
|
|
#include "crypto_openssl_mgt.h"
|
2015-11-10 16:02:21 +01:00
|
|
|
/**
|
|
|
|
* \file compat_openssl.h
|
|
|
|
*
|
|
|
|
* \brief compatability definitions for working with different openssl forks
|
|
|
|
**/
|
|
|
|
|
2016-10-06 18:58:49 +02:00
|
|
|
#if !defined(LIBRESSL_VERSION_NUMBER) && \
|
|
|
|
OPENSSL_VERSION_NUMBER < OPENSSL_V_SERIES(1,0,1)
|
|
|
|
#error "We require OpenSSL >= 1.0.1"
|
2015-11-10 16:02:21 +01:00
|
|
|
#endif
|
|
|
|
|
2016-01-11 15:02:42 +01:00
|
|
|
#if OPENSSL_VERSION_NUMBER >= OPENSSL_V_SERIES(1,1,0) && \
|
|
|
|
! defined(LIBRESSL_VERSION_NUMBER)
|
|
|
|
/* We define this macro if we're trying to build with the majorly refactored
|
|
|
|
* API in OpenSSL 1.1 */
|
|
|
|
#define OPENSSL_1_1_API
|
2017-09-15 22:24:44 +02:00
|
|
|
#endif /* OPENSSL_VERSION_NUMBER >= OPENSSL_V_SERIES(1,1,0) && ... */
|
2016-01-11 15:02:42 +01:00
|
|
|
|
|
|
|
#ifndef OPENSSL_1_1_API
|
2015-11-10 16:02:21 +01:00
|
|
|
#define OPENSSL_VERSION SSLEAY_VERSION
|
|
|
|
#define OpenSSL_version(v) SSLeay_version(v)
|
|
|
|
#define OpenSSL_version_num() SSLeay()
|
|
|
|
#define RAND_OpenSSL() RAND_SSLeay()
|
|
|
|
#define STATE_IS_SW_SERVER_HELLO(st) \
|
|
|
|
(((st) == SSL3_ST_SW_SRVR_HELLO_A) || \
|
|
|
|
((st) == SSL3_ST_SW_SRVR_HELLO_B))
|
|
|
|
#define OSSL_HANDSHAKE_STATE int
|
2016-02-03 17:13:12 +01:00
|
|
|
#define CONST_IF_OPENSSL_1_1_API
|
2017-09-15 22:24:44 +02:00
|
|
|
#else /* !(!defined(OPENSSL_1_1_API)) */
|
2015-11-10 16:02:21 +01:00
|
|
|
#define STATE_IS_SW_SERVER_HELLO(st) \
|
|
|
|
((st) == TLS_ST_SW_SRVR_HELLO)
|
2016-02-03 17:13:12 +01:00
|
|
|
#define CONST_IF_OPENSSL_1_1_API const
|
2017-09-15 22:24:44 +02:00
|
|
|
#endif /* !defined(OPENSSL_1_1_API) */
|
2015-11-10 16:02:21 +01:00
|
|
|
|
2017-09-15 22:24:44 +02:00
|
|
|
#endif /* !defined(TOR_COMPAT_OPENSSL_H) */
|
2015-11-10 16:40:19 +01:00
|
|
|
|