OpenVPN 3 Core Library
Loading...
Searching...
No Matches
cryptochoose.hpp
Go to the documentation of this file.
1
// OpenVPN -- An application to securely tunnel IP networks
2
// over a single port, with support for SSL/TLS-based
3
// session authentication and key exchange,
4
// packet encryption, packet authentication, and
5
// packet compression.
6
//
7
// Copyright (C) 2012- OpenVPN Inc.
8
//
9
// SPDX-License-Identifier: MPL-2.0 OR AGPL-3.0-only WITH openvpn3-openssl-exception
10
//
11
12
#ifndef OPENVPN_CRYPTO_CRYPTO_CHOOSE_H
13
#define OPENVPN_CRYPTO_CRYPTO_CHOOSE_H
14
15
#include <
openvpn/crypto/definitions.hpp
>
16
17
#ifdef USE_OPENSSL
18
#include <
openvpn/openssl/crypto/api.hpp
>
19
#include <
openvpn/openssl/util/rand.hpp
>
20
#endif
21
22
#ifdef USE_APPLE_SSL
23
#include <
openvpn/applecrypto/crypto/api.hpp
>
24
#include <
openvpn/applecrypto/util/rand.hpp
>
25
#endif
26
27
#ifdef USE_MBEDTLS
28
#include <mbedtls/platform.h>
29
#include <mbedtls/debug.h>
// for debug_set_threshold
30
#include <
openvpn/mbedtls/crypto/api.hpp
>
31
#include <
openvpn/mbedtls/util/rand.hpp
>
32
#ifdef OPENVPN_PLATFORM_UWP
33
#include <openvpn/mbedtls/util/uwprand.hpp>
34
#endif
35
#endif
36
37
#ifdef USE_MBEDTLS_APPLE_HYBRID
38
#include <
openvpn/applecrypto/crypto/api.hpp
>
39
#include <
openvpn/mbedtls/util/rand.hpp
>
40
#endif
41
42
namespace
openvpn::SSLLib
{
43
#if defined(USE_MBEDTLS)
44
#define SSL_LIB_NAME "MbedTLS"
45
using
CryptoAPI =
MbedTLSCryptoAPI
;
46
#if defined OPENVPN_PLATFORM_UWP
47
using
RandomAPI
= MbedTLSRandomWithUWPEntropy;
48
#else
49
using
RandomAPI
=
MbedTLSRandom
;
50
#endif
51
#elif defined(USE_MBEDTLS_APPLE_HYBRID)
52
// Uses Apple framework for CryptoAPI and MbedTLS for SSLAPI and RandomAPI
53
#define SSL_LIB_NAME "MbedTLSAppleHybrid"
54
using
CryptoAPI =
AppleCryptoAPI
;
55
using
RandomAPI
=
MbedTLSRandom
;
56
#elif defined(USE_APPLE_SSL)
57
#define SSL_LIB_NAME "AppleSSL"
58
typedef
AppleCryptoAPI
CryptoAPI;
59
typedef
AppleRandom
RandomAPI
;
60
#elif defined(USE_OPENSSL)
61
#define SSL_LIB_NAME "OpenSSL"
62
using
CryptoAPI =
OpenSSLCryptoAPI
;
63
using
RandomAPI
=
OpenSSLRandom
;
64
#else
65
#error no SSL library defined
66
#endif
67
}
// namespace openvpn::SSLLib
68
69
#endif
api.hpp
rand.hpp
openvpn::AppleRandom
Definition
rand.hpp:25
openvpn::MbedTLSRandom
Definition
rand.hpp:31
openvpn::OpenSSLRandom
Definition
rand.hpp:26
openvpn::RandomAPI
Abstract base class for random number generators.
Definition
randapi.hpp:39
definitions.hpp
api.hpp
rand.hpp
openvpn::SSLLib
Definition
cryptochoose.hpp:42
api.hpp
rand.hpp
openvpn::AppleCryptoAPI
Definition
api.hpp:24
openvpn::MbedTLSCryptoAPI
Definition
api.hpp:25
openvpn::OpenSSLCryptoAPI
Definition
api.hpp:26
openvpn
crypto
cryptochoose.hpp
Generated by
1.9.8