diff options
author | Matthias Gierlings <[email protected]> | 2016-04-29 20:44:30 +0200 |
---|---|---|
committer | Matthias Gierlings <[email protected]> | 2016-06-19 18:25:46 +0200 |
commit | d4f3e7c4ac584daa9d7e1ae10cb3412e450e25cf (patch) | |
tree | 5541bf045d77110a55f1858e385f54d7b761851b /src/tests | |
parent | 23d6f67e76b633077b5de91945f61290ff091e1e (diff) |
Reduction of code complexity in TLS classes.
-reduced number of parameters in various methods
-reduced cyclomatic complexity (McCabe-Metric)
-removed "TLSEXT_HEARTBEAT_SUPPORT" from tls_extensions.h (leftover
from heartbeat extension removal?)
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/unit_tls.cpp | 52 |
1 files changed, 30 insertions, 22 deletions
diff --git a/src/tests/unit_tls.cpp b/src/tests/unit_tls.cpp index f125bfcb5..6e6ac29a0 100644 --- a/src/tests/unit_tls.cpp +++ b/src/tests/unit_tls.cpp @@ -1,5 +1,6 @@ /* * (C) 2014,2015 Jack Lloyd +* 2016 Matthias Gierlings * * Botan is released under the Simplified BSD License (see license.txt) */ @@ -218,10 +219,12 @@ Test::Result test_tls_handshake(Botan::TLS::Protocol_Version offer_version, { std::vector<byte> c2s_traffic, s2c_traffic, client_recv, server_recv, client_sent, server_sent; - Botan::TLS::Server server(queue_inserter(s2c_traffic), - queue_inserter(server_recv), - print_alert, - handshake_complete, + + Botan::TLS::Server server(Botan::TLS::Server::Callbacks( + queue_inserter(s2c_traffic), + queue_inserter(server_recv), + print_alert, + handshake_complete), server_sessions, creds, policy, @@ -229,17 +232,19 @@ Test::Result test_tls_handshake(Botan::TLS::Protocol_Version offer_version, next_protocol_chooser, false); - Botan::TLS::Client client(queue_inserter(c2s_traffic), - queue_inserter(client_recv), - print_alert, - handshake_complete, + Botan::TLS::Client::Callbacks client_callbacks(queue_inserter(c2s_traffic), + queue_inserter(client_recv), + print_alert, + handshake_complete); + Botan::TLS::Client client(client_callbacks, client_sessions, creds, policy, rng, - Botan::TLS::Server_Information("server.example.com"), - offer_version, - protocols_offered); + Botan::TLS::Client::Properties( + Botan::TLS::Server_Information("server.example.com"), + offer_version, + protocols_offered)); size_t rounds = 0; @@ -444,10 +449,11 @@ Test::Result test_dtls_handshake(Botan::TLS::Protocol_Version offer_version, { std::vector<byte> c2s_traffic, s2c_traffic, client_recv, server_recv, client_sent, server_sent; - Botan::TLS::Server server(queue_inserter(s2c_traffic), - queue_inserter(server_recv), - print_alert, - handshake_complete, + Botan::TLS::Server::Callbacks server_callbacks(queue_inserter(s2c_traffic), + queue_inserter(server_recv), + print_alert, + handshake_complete); + Botan::TLS::Server server(server_callbacks, server_sessions, creds, policy, @@ -455,17 +461,19 @@ Test::Result test_dtls_handshake(Botan::TLS::Protocol_Version offer_version, next_protocol_chooser, true); - Botan::TLS::Client client(queue_inserter(c2s_traffic), - queue_inserter(client_recv), - print_alert, - handshake_complete, + Botan::TLS::Client::Callbacks client_callbacks(queue_inserter(c2s_traffic), + queue_inserter(client_recv), + print_alert, + handshake_complete); + Botan::TLS::Client client(client_callbacks, client_sessions, creds, policy, rng, - Botan::TLS::Server_Information("server.example.com"), - offer_version, - protocols_offered); + Botan::TLS::Client::Properties( + Botan::TLS::Server_Information("server.example.com"), + offer_version, + protocols_offered)); size_t rounds = 0; |