diff options
author | Jack Lloyd <[email protected]> | 2016-01-08 19:15:29 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-01-08 19:18:13 -0500 |
commit | e33ca7736bc7b0b66ae14e8d3e879b58b2924239 (patch) | |
tree | 58459585e6675cd799b6ef5900be026825cd6f9d /src/lib/entropy | |
parent | 2fbfdd7e5afb5e888fd8c0b56c6df09e2bdeaca7 (diff) | |
parent | d22bc10cd4f67924acd82bcd46a31e3de3b20ce3 (diff) |
Merge GH #398 Mass prefix all member vars with m_
Diffstat (limited to 'src/lib/entropy')
-rw-r--r-- | src/lib/entropy/cryptoapi_rng/es_capi.cpp | 34 | ||||
-rw-r--r-- | src/lib/entropy/cryptoapi_rng/es_capi.h | 2 | ||||
-rw-r--r-- | src/lib/entropy/egd/es_egd.cpp | 16 | ||||
-rw-r--r-- | src/lib/entropy/egd/es_egd.h | 4 |
4 files changed, 28 insertions, 28 deletions
diff --git a/src/lib/entropy/cryptoapi_rng/es_capi.cpp b/src/lib/entropy/cryptoapi_rng/es_capi.cpp index 88c8488ad..8d682698a 100644 --- a/src/lib/entropy/cryptoapi_rng/es_capi.cpp +++ b/src/lib/entropy/cryptoapi_rng/es_capi.cpp @@ -21,33 +21,33 @@ class CSP_Handle public: CSP_Handle(u64bit capi_provider) { - valid = false; + m_valid = false; DWORD prov_type = (DWORD)capi_provider; - if(CryptAcquireContext(&handle, 0, 0, + if(CryptAcquireContext(&m_handle, 0, 0, prov_type, CRYPT_VERIFYCONTEXT)) - valid = true; + m_valid = true; } ~CSP_Handle() { if(is_valid()) - CryptReleaseContext(handle, 0); + CryptReleaseContext(m_handle, 0); } size_t gen_random(byte out[], size_t n) const { - if(is_valid() && CryptGenRandom(handle, static_cast<DWORD>(n), out)) + if(is_valid() && CryptGenRandom(m_handle, static_cast<DWORD>(n), out)) return n; return 0; } - bool is_valid() const { return valid; } + bool is_valid() const { return m_valid; } - HCRYPTPROV get_handle() const { return handle; } + HCRYPTPROV get_handle() const { return m_handle; } private: - HCRYPTPROV handle; - bool valid; + HCRYPTPROV m_handle; + bool m_valid; }; } @@ -59,9 +59,9 @@ void Win32_CAPI_EntropySource::poll(Entropy_Accumulator& accum) { secure_vector<byte>& buf = accum.get_io_buf(BOTAN_SYSTEM_RNG_POLL_REQUEST); - for(size_t i = 0; i != prov_types.size(); ++i) + for(size_t i = 0; i != m_prov_types.size(); ++i) { - CSP_Handle csp(prov_types[i]); + CSP_Handle csp(m_prov_types[i]); if(size_t got = csp.gen_random(buf.data(), buf.size())) { @@ -80,14 +80,14 @@ Win32_CAPI_EntropySource::Win32_CAPI_EntropySource(const std::string& provs) for(size_t i = 0; i != capi_provs.size(); ++i) { - if(capi_provs[i] == "RSA_FULL") prov_types.push_back(PROV_RSA_FULL); - if(capi_provs[i] == "INTEL_SEC") prov_types.push_back(PROV_INTEL_SEC); - if(capi_provs[i] == "FORTEZZA") prov_types.push_back(PROV_FORTEZZA); - if(capi_provs[i] == "RNG") prov_types.push_back(PROV_RNG); + if(capi_provs[i] == "RSA_FULL") m_prov_types.push_back(PROV_RSA_FULL); + if(capi_provs[i] == "INTEL_SEC") m_prov_types.push_back(PROV_INTEL_SEC); + if(capi_provs[i] == "FORTEZZA") m_prov_types.push_back(PROV_FORTEZZA); + if(capi_provs[i] == "RNG") m_prov_types.push_back(PROV_RNG); } - if(prov_types.size() == 0) - prov_types.push_back(PROV_RSA_FULL); + if(m_prov_types.size() == 0) + m_prov_types.push_back(PROV_RSA_FULL); } } diff --git a/src/lib/entropy/cryptoapi_rng/es_capi.h b/src/lib/entropy/cryptoapi_rng/es_capi.h index eb63183e9..9410e05b8 100644 --- a/src/lib/entropy/cryptoapi_rng/es_capi.h +++ b/src/lib/entropy/cryptoapi_rng/es_capi.h @@ -29,7 +29,7 @@ class Win32_CAPI_EntropySource : public Entropy_Source */ Win32_CAPI_EntropySource(const std::string& provs = ""); private: - std::vector<u64bit> prov_types; + std::vector<u64bit> m_prov_types; }; } diff --git a/src/lib/entropy/egd/es_egd.cpp b/src/lib/entropy/egd/es_egd.cpp index ba43cc86d..9bc6de6fe 100644 --- a/src/lib/entropy/egd/es_egd.cpp +++ b/src/lib/entropy/egd/es_egd.cpp @@ -25,7 +25,7 @@ namespace Botan { EGD_EntropySource::EGD_Socket::EGD_Socket(const std::string& path) : - socket_path(path), m_fd(-1) + m_socket_path(path), m_fd(-1) { } @@ -69,7 +69,7 @@ size_t EGD_EntropySource::EGD_Socket::read(byte outbuf[], size_t length) if(m_fd < 0) { - m_fd = open_socket(socket_path); + m_fd = open_socket(m_socket_path); if(m_fd < 0) return 0; } @@ -121,14 +121,14 @@ void EGD_EntropySource::EGD_Socket::close() EGD_EntropySource::EGD_EntropySource(const std::vector<std::string>& paths) { for(size_t i = 0; i != paths.size(); ++i) - sockets.push_back(EGD_Socket(paths[i])); + m_sockets.push_back(EGD_Socket(paths[i])); } EGD_EntropySource::~EGD_EntropySource() { - for(size_t i = 0; i != sockets.size(); ++i) - sockets[i].close(); - sockets.clear(); + for(size_t i = 0; i != m_sockets.size(); ++i) + m_sockets[i].close(); + m_sockets.clear(); } /** @@ -140,9 +140,9 @@ void EGD_EntropySource::poll(Entropy_Accumulator& accum) secure_vector<byte>& buf = accum.get_io_buf(BOTAN_SYSTEM_RNG_POLL_REQUEST); - for(size_t i = 0; i != sockets.size(); ++i) + for(size_t i = 0; i != m_sockets.size(); ++i) { - size_t got = sockets[i].read(buf.data(), buf.size()); + size_t got = m_sockets[i].read(buf.data(), buf.size()); if(got) { diff --git a/src/lib/entropy/egd/es_egd.h b/src/lib/entropy/egd/es_egd.h index 0b497a8bd..e03fcf009 100644 --- a/src/lib/entropy/egd/es_egd.h +++ b/src/lib/entropy/egd/es_egd.h @@ -38,12 +38,12 @@ class EGD_EntropySource : public Entropy_Source private: static int open_socket(const std::string& path); - std::string socket_path; + std::string m_socket_path; int m_fd; // cached fd }; std::mutex m_mutex; - std::vector<EGD_Socket> sockets; + std::vector<EGD_Socket> m_sockets; }; } |