diff options
author | lloyd <[email protected]> | 2012-02-20 21:59:14 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2012-02-20 21:59:14 +0000 |
commit | 8a31da4d60490753031267b18957c0c599bbee3b (patch) | |
tree | 0b6b4dc2ab8f070cd9ce9f2bfdd52aff8800bd10 | |
parent | 4e74f4482e42743cbe078df20612baf81ca555bf (diff) |
Enable TLS again (bad merge)
Fixes for examples.
Remove locking from session manager in the asio example, now done by
default in the lib.
-rw-r--r-- | doc/examples/GNUmakefile | 4 | ||||
-rw-r--r-- | doc/examples/asio_tls_server.cpp | 39 | ||||
-rw-r--r-- | doc/examples/benchmark.cpp | 5 | ||||
-rw-r--r-- | doc/examples/hash_quickly.cpp | 2 | ||||
-rw-r--r-- | src/tls/info.txt | 2 |
5 files changed, 7 insertions, 45 deletions
diff --git a/doc/examples/GNUmakefile b/doc/examples/GNUmakefile index 947db8fec..77b5c67c7 100644 --- a/doc/examples/GNUmakefile +++ b/doc/examples/GNUmakefile @@ -18,10 +18,10 @@ clean: $(CXX) $(CFLAGS) $? $(LIBS) -o $@ eax_test: eax_test.cpp - $(CXX) $(CFLAGS) $? $(LIBS) -lboost_regex -o $@ + echo $(CXX) $(CFLAGS) $? $(LIBS) -lboost_regex -o $@ asio_tls_server.o: asio_tls_server.cpp - g++-4.6.0 -c $(CFLAGS) -I/usr/local/asio-1.5.3/include $? -o $@ + g++-4.6.0 -c $(CFLAGS) -pthread $? -o $@ asio_tls_server: asio_tls_server.o $(CXX) $? $(LIBS) -lboost_thread -lboost_system -lpthread -o $@ diff --git a/doc/examples/asio_tls_server.cpp b/doc/examples/asio_tls_server.cpp index fff83f5f8..efd150cae 100644 --- a/doc/examples/asio_tls_server.cpp +++ b/doc/examples/asio_tls_server.cpp @@ -186,41 +186,6 @@ class tls_server_session : public boost::enable_shared_from_this<tls_server_sess std::vector<byte> m_outbox; }; -class Session_Manager_Locked : public Botan::TLS::Session_Manager - { - public: - bool load_from_session_id(const Botan::MemoryRegion<byte>& session_id, - Botan::TLS::Session& session) - { - boost::lock_guard<boost::mutex> lock(m_mutex); - return m_session_manager.load_from_session_id(session_id, session); - } - - bool load_from_host_info(const std::string& hostname, Botan::u16bit port, - Botan::TLS::Session& session) - { - boost::lock_guard<boost::mutex> lock(m_mutex); - return m_session_manager.load_from_host_info(hostname, port, session); - }; - - void remove_entry(const Botan::MemoryRegion<byte>& session_id) - { - boost::lock_guard<boost::mutex> lock(m_mutex); - m_session_manager.remove_entry(session_id); - } - - void save(const Botan::TLS::Session& session) - { - boost::lock_guard<boost::mutex> lock(m_mutex); - m_session_manager.save(session); - } - - private: - boost::mutex m_mutex; - Botan::TLS::Session_Manager_In_Memory m_session_manager; - - }; - class tls_server { public: @@ -277,7 +242,7 @@ class tls_server tcp::acceptor m_acceptor; Botan::AutoSeeded_RNG m_rng; - Session_Manager_Locked m_session_manager; + Botan::TLS::Session_Manager_In_Memory m_session_manager; Botan::TLS::Policy m_policy; Credentials_Manager_Simple m_creds; }; @@ -299,7 +264,7 @@ int main() std::cout << "Using " << num_threads << " threads\n"; - std::vector<boost::shared_ptr<boost::thread> > threads; + std::vector<boost::shared_ptr<boost::thread>> threads; for(size_t i = 0; i != num_threads; ++i) { diff --git a/doc/examples/benchmark.cpp b/doc/examples/benchmark.cpp index b5adb3d4f..a11054c0c 100644 --- a/doc/examples/benchmark.cpp +++ b/doc/examples/benchmark.cpp @@ -26,14 +26,13 @@ int main(int argc, char* argv[]) Botan::Algorithm_Factory& af = Botan::global_state().algorithm_factory(); - double ms = 1000 * std::atof(argv[1]); + std::chrono::milliseconds ms(static_cast<std::chrono::milliseconds::rep>(1000 * std::atof(argv[1]))); for(size_t i = 2; argv[i]; ++i) { std::string algo = argv[i]; - std::map<std::string, double> results = - algorithm_benchmark(algo, af, rng, ms, 16); + auto results = algorithm_benchmark(algo, af, rng, ms, 16); std::cout << algo << ":\n"; for(std::map<std::string, double>::iterator r = results.begin(); diff --git a/doc/examples/hash_quickly.cpp b/doc/examples/hash_quickly.cpp index a18ab4fa6..87937efff 100644 --- a/doc/examples/hash_quickly.cpp +++ b/doc/examples/hash_quickly.cpp @@ -29,7 +29,7 @@ namespace { void set_fastest_implementation(const std::string& algo, Botan::RandomNumberGenerator& rng, - double ms = 30) + std::chrono::milliseconds ms = std::chrono::milliseconds(30)) { Botan::Algorithm_Factory& af = Botan::global_state().algorithm_factory(); diff --git a/src/tls/info.txt b/src/tls/info.txt index f3c64cd05..68ca026d5 100644 --- a/src/tls/info.txt +++ b/src/tls/info.txt @@ -1,7 +1,5 @@ define TLS -load_on request - <comment> The TLS code is complex, new, and not yet reviewed, there may be serious bugs or security issues. |