From 77fe8b89a3a1debe59051b21776c1c6cf67a6070 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Thu, 19 Jun 2014 01:04:40 +0200 Subject: Make the Botan rng, credential_manager etc be static This actually makes the session_manager be useful, and saves a few octets of memory for the other ones --- src/network/socket_handler.cpp | 13 ++++++------- src/network/socket_handler.hpp | 8 ++++---- 2 files changed, 10 insertions(+), 11 deletions(-) (limited to 'src/network') diff --git a/src/network/socket_handler.cpp b/src/network/socket_handler.cpp index a2c22e4..43a63f0 100644 --- a/src/network/socket_handler.cpp +++ b/src/network/socket_handler.cpp @@ -20,6 +20,12 @@ #ifdef BOTAN_FOUND # include + +Botan::AutoSeeded_RNG SocketHandler::rng; +Permissive_Credentials_Manager SocketHandler::credential_manager; +Botan::TLS::Policy SocketHandler::policy; +Botan::TLS::Session_Manager_In_Memory SocketHandler::session_manager(SocketHandler::rng); + #endif #ifndef UIO_FASTIOV @@ -37,13 +43,6 @@ SocketHandler::SocketHandler(std::shared_ptr poller): use_tls(false), connected(false), connecting(false) -#ifdef BOTAN_FOUND - , - rng(), - credential_manager(), - policy(), - session_manager(rng) -#endif {} void SocketHandler::init_socket(const struct addrinfo* rp) diff --git a/src/network/socket_handler.hpp b/src/network/socket_handler.hpp index 95e38bd..b4cb6f2 100644 --- a/src/network/socket_handler.hpp +++ b/src/network/socket_handler.hpp @@ -253,10 +253,10 @@ private: /** * Botan stuff to manipulate a TLS session. */ - Botan::AutoSeeded_RNG rng; - Permissive_Credentials_Manager credential_manager; - Botan::TLS::Policy policy; - Botan::TLS::Session_Manager_In_Memory session_manager; + static Botan::AutoSeeded_RNG rng; + static Permissive_Credentials_Manager credential_manager; + static Botan::TLS::Policy policy; + static Botan::TLS::Session_Manager_In_Memory session_manager; /** * We use a unique_ptr because we may not want to create the object at * all. The Botan::TLS::Client object generates a handshake message as -- cgit v1.2.3