OpenVPN 3 Core Library
Loading...
Searching...
No Matches
selftest.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// Call various mbed TLS self-test functions
13
14#ifndef OPENVPN_MBEDTLS_UTIL_SELFTEST_H
15#define OPENVPN_MBEDTLS_UTIL_SELFTEST_H
16
17#include <sstream>
18
19#include <mbedtls/bignum.h>
20#if MBEDTLS_VERSION_NUMBER < 0x03000000
21#include <mbedtls/config.h>
22#endif
23#include <mbedtls/cipher.h>
24#include <mbedtls/aes.h>
25#include <mbedtls/sha1.h>
26#include <mbedtls/sha256.h>
27#include <mbedtls/sha512.h>
28
29namespace openvpn {
30inline std::string crypto_self_test_mbedtls()
31{
32 std::ostringstream os;
33#ifdef MBEDTLS_SELF_TEST
34 const int verbose = 1;
35 os << "mbed TLS self test (tests return 0 if successful):" << std::endl;
36 os << " mbedlts_aes_self_test status=" << mbedtls_aes_self_test(verbose) << std::endl;
37 os << " mbedtls_sha1_self_test status=" << mbedtls_sha1_self_test(verbose) << std::endl;
38 os << " mbedtls_sha256_self_test status=" << mbedtls_sha256_self_test(verbose) << std::endl;
39 os << " mbedtls_sha512_self_test status=" << mbedtls_sha512_self_test(verbose) << std::endl;
40 os << " mbedtls_mpi_self_test status=" << mbedtls_mpi_self_test(verbose) << std::endl;
41#else
42 os << "mbed TLS self test: not compiled" << std::endl;
43#endif
44 return os.str();
45}
46} // namespace openvpn
47
48#endif
Support deferred server-side state creation when client connects.
Definition ovpncli.cpp:95
std::string crypto_self_test_mbedtls()
Definition selftest.hpp:30
static bool verbose
Definition test_ip.cpp:31