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
16
17#ifdef USE_OPENSSL
20#endif
21
22#ifdef USE_APPLE_SSL
25#endif
26
27#ifdef USE_MBEDTLS
28#include <mbedtls/platform.h>
29#include <mbedtls/debug.h> // for debug_set_threshold
32#ifdef OPENVPN_PLATFORM_UWP
33#include <openvpn/mbedtls/util/uwprand.hpp>
34#endif
35#endif
36
37#ifdef USE_MBEDTLS_APPLE_HYBRID
40#endif
41
42namespace openvpn::SSLLib {
43#if defined(USE_MBEDTLS)
44#define SSL_LIB_NAME "MbedTLS"
45using CryptoAPI = MbedTLSCryptoAPI;
46#if defined OPENVPN_PLATFORM_UWP
47using RandomAPI = MbedTLSRandomWithUWPEntropy;
48#else
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"
54using CryptoAPI = AppleCryptoAPI;
56#elif defined(USE_APPLE_SSL)
57#define SSL_LIB_NAME "AppleSSL"
58typedef AppleCryptoAPI CryptoAPI;
60#elif defined(USE_OPENSSL)
61#define SSL_LIB_NAME "OpenSSL"
62using CryptoAPI = OpenSSLCryptoAPI;
64#else
65#error no SSL library defined
66#endif
67} // namespace openvpn::SSLLib
68
69#endif
Abstract base class for random number generators.
Definition randapi.hpp:39