aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/entropy/cryptoapi_rng/es_capi.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-01-08 19:15:29 -0500
committerJack Lloyd <[email protected]>2016-01-08 19:18:13 -0500
commite33ca7736bc7b0b66ae14e8d3e879b58b2924239 (patch)
tree58459585e6675cd799b6ef5900be026825cd6f9d /src/lib/entropy/cryptoapi_rng/es_capi.cpp
parent2fbfdd7e5afb5e888fd8c0b56c6df09e2bdeaca7 (diff)
parentd22bc10cd4f67924acd82bcd46a31e3de3b20ce3 (diff)
Merge GH #398 Mass prefix all member vars with m_
Diffstat (limited to 'src/lib/entropy/cryptoapi_rng/es_capi.cpp')
-rw-r--r--src/lib/entropy/cryptoapi_rng/es_capi.cpp34
1 files changed, 17 insertions, 17 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);
}
}