Skip to content

Commit

Permalink
Allow test_sslctx to work with mbed TLS
Browse files Browse the repository at this point in the history
Signed-off-by: Arne Schwabe <arne@openvpn.net>
  • Loading branch information
schwabe authored and flichtenheld committed Feb 23, 2024
1 parent c1bcf78 commit 282075f
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions test/unittests/test_sslctx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

#include <openvpn/ssl/sslchoose.hpp>

#ifdef USE_OPENSSL

#include <openvpn/ssl/sslapi.hpp>

Expand Down Expand Up @@ -256,6 +255,9 @@ TEST(sslctx_ut, config_new_factory_server)
SSLLib::SSLAPI::Config::Ptr config = new SSLLib::SSLAPI::Config;
EXPECT_TRUE(config);

StrongRandomAPI::Ptr rng(new SSLLib::RandomAPI());
config->set_rng(rng);

config->set_mode(Mode(Mode::SERVER));
config->load_cert(cert_txt);
config->load_private_key(pvt_key_txt);
Expand All @@ -273,6 +275,9 @@ TEST(sslctx_ut, config_new_factory_client)
SSLLib::SSLAPI::Config::Ptr config = new SSLLib::SSLAPI::Config;
EXPECT_TRUE(config);

StrongRandomAPI::Ptr rng(new SSLLib::RandomAPI());
config->set_rng(rng);

config->set_mode(Mode(Mode::CLIENT));
config->load_cert(cert_txt);
config->load_private_key(pvt_key_txt);
Expand Down Expand Up @@ -357,6 +362,9 @@ static inline auto MakeClient(Frame::Ptr frame)
SSLLib::SSLAPI::Config::Ptr config = new SSLLib::SSLAPI::Config;
EXPECT_TRUE(config);

StrongRandomAPI::Ptr rng(new SSLLib::RandomAPI());
config->set_rng(rng);

config->set_mode(Mode(Mode::CLIENT));
config->load_cert(cert_txt);
config->load_private_key(pvt_key_txt);
Expand All @@ -378,6 +386,9 @@ static inline auto MakeServer(Frame::Ptr frame, const std::string &pvt_key, cons
config->enable_legacy_algorithms(false);
EXPECT_TRUE(config);

StrongRandomAPI::Ptr rng(new SSLLib::RandomAPI());
config->set_rng(rng);

config->set_mode(Mode(Mode::SERVER));
config->load_cert(cert);
config->load_private_key(pvt_key);
Expand Down Expand Up @@ -469,6 +480,4 @@ TEST(sslctx_ut, clienthello)
EXPECT_TRUE(server->read_ciphertext_ready());
auto buf = server->read_ciphertext();
ASSERT_TRUE(buf->length() > 1);
}

#endif
}

0 comments on commit 282075f

Please sign in to comment.