From 8bae7b013a27bd216a2c7f3dc7d06df3410699b6 Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Sun, 5 Jul 2015 00:33:13 -0400 Subject: More test coverage improvements. Specify expected server name on client side of TLS test so it checks the cert DNS name. Use AutoSeeded_RNG to generate server cert, as on platforms with a system rng it is otherwise not used currently. --- src/tests/unit_tls.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/tests') diff --git a/src/tests/unit_tls.cpp b/src/tests/unit_tls.cpp index 3b8be6ca1..116eb2cdf 100644 --- a/src/tests/unit_tls.cpp +++ b/src/tests/unit_tls.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -112,8 +113,9 @@ class Credentials_Manager_Test : public Botan::Credentials_Manager std::vector> m_stores; }; -Credentials_Manager* create_creds(RandomNumberGenerator& rng) +Credentials_Manager* create_creds() { + AutoSeeded_RNG rng; std::unique_ptr ca_key(new RSA_PrivateKey(rng, 1024)); X509_Cert_Options ca_opts; @@ -130,7 +132,7 @@ Credentials_Manager* create_creds(RandomNumberGenerator& rng) Private_Key* server_key = new RSA_PrivateKey(rng, 1024); X509_Cert_Options server_opts; - server_opts.common_name = "localhost"; + server_opts.common_name = "server.example.com"; server_opts.country = "US"; PKCS10_Request req = X509::create_cert_req(server_opts, @@ -217,7 +219,7 @@ size_t basic_test_handshake(RandomNumberGenerator& rng, creds, policy, rng, - TLS::Server_Information(), + TLS::Server_Information("server.example.com"), offer_version, protocols_offered); @@ -315,7 +317,7 @@ size_t test_tls() Test_Policy default_policy; auto& rng = test_rng(); - std::unique_ptr basic_creds(create_creds(rng)); + std::unique_ptr basic_creds(create_creds()); errors += basic_test_handshake(rng, TLS::Protocol_Version::TLS_V10, *basic_creds, default_policy); errors += basic_test_handshake(rng, TLS::Protocol_Version::TLS_V11, *basic_creds, default_policy); -- cgit v1.2.3