diff options
author | lloyd <[email protected]> | 2013-11-05 01:32:48 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2013-11-05 01:32:48 +0000 |
commit | bc25c9f1fec9945ac25492c1966fec0137f8993d (patch) | |
tree | 12e68bb6c5e70cdc78bcab60d5e021c362867a6d /checks | |
parent | db1aa0b6cf9d329f3aedeb0e3b89330fc1617cc9 (diff) |
Split TLS callbacks into a data callback and an alert callback.
In practice applications treated these two cases completely differently,
so there was no reason to combine them into a single callback.
Diffstat (limited to 'checks')
-rw-r--r-- | checks/tls.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/checks/tls.cpp b/checks/tls.cpp index f39316c7d..5dc140001 100644 --- a/checks/tls.cpp +++ b/checks/tls.cpp @@ -156,23 +156,26 @@ void test_handshake(RandomNumberGenerator& rng) return true; }; - auto save_server_data = [&](const byte buf[], size_t sz, TLS::Alert alert) + auto print_alert = [&](TLS::Alert alert, const byte buf[], size_t sz) { - c2s_data.insert(c2s_data.end(), buf, buf+sz); if(alert.is_valid()) std::cout << "Server recvd alert " << alert.type_string() << "\n"; }; - auto save_client_data = [&](const byte buf[], size_t sz, TLS::Alert alert) + auto save_server_data = [&](const byte buf[], size_t sz) + { + c2s_data.insert(c2s_data.end(), buf, buf+sz); + }; + + auto save_client_data = [&](const byte buf[], size_t sz) { s2c_data.insert(s2c_data.end(), buf, buf+sz); - if(alert.is_valid()) - std::cout << "Client recvd alert " << alert.type_string() << "\n"; }; TLS::Server server([&](const byte buf[], size_t sz) { s2c_q.insert(s2c_q.end(), buf, buf+sz); }, save_server_data, + print_alert, handshake_complete, server_sessions, *creds, @@ -182,6 +185,7 @@ void test_handshake(RandomNumberGenerator& rng) TLS::Client client([&](const byte buf[], size_t sz) { c2s_q.insert(c2s_q.end(), buf, buf+sz); }, save_client_data, + print_alert, handshake_complete, client_sessions, *creds, |