aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-08-31 14:33:26 -0400
committerJack Lloyd <[email protected]>2017-08-31 14:33:26 -0400
commit5566798e8e5cd0520ba6110bb7d256c0c851d84f (patch)
tree26c5ef3427badb349b2558d72cb3133b7c5fc87a
parentae5baecf626c925f14545a45290fa83628f1961c (diff)
Fix missing virtual destructor on CSP_Handle
Caught by GCC cross compiling. Also fix a couple 0-as-null warnings.
-rw-r--r--src/lib/entropy/cryptoapi_rng/es_capi.cpp4
-rw-r--r--src/lib/entropy/cryptoapi_rng/es_capi.h1
-rw-r--r--src/lib/rng/system_rng/system_rng.cpp2
3 files changed, 4 insertions, 3 deletions
diff --git a/src/lib/entropy/cryptoapi_rng/es_capi.cpp b/src/lib/entropy/cryptoapi_rng/es_capi.cpp
index 3d744245e..58503c66d 100644
--- a/src/lib/entropy/cryptoapi_rng/es_capi.cpp
+++ b/src/lib/entropy/cryptoapi_rng/es_capi.cpp
@@ -22,8 +22,8 @@ class CSP_Handle_Impl : public Win32_CAPI_EntropySource::CSP_Handle
explicit CSP_Handle_Impl(uint64_t capi_provider)
{
m_valid = ::CryptAcquireContext(&m_handle,
- 0,
- 0,
+ nullptr,
+ nullptr,
static_cast<DWORD>(capi_provider),
CRYPT_VERIFYCONTEXT);
}
diff --git a/src/lib/entropy/cryptoapi_rng/es_capi.h b/src/lib/entropy/cryptoapi_rng/es_capi.h
index 79a42828d..8439e62fa 100644
--- a/src/lib/entropy/cryptoapi_rng/es_capi.h
+++ b/src/lib/entropy/cryptoapi_rng/es_capi.h
@@ -32,6 +32,7 @@ class Win32_CAPI_EntropySource final : public Entropy_Source
class CSP_Handle
{
public:
+ virtual ~CSP_Handle() {}
virtual size_t gen_random(uint8_t out[], size_t n) const = 0;
};
private:
diff --git a/src/lib/rng/system_rng/system_rng.cpp b/src/lib/rng/system_rng/system_rng.cpp
index bd8ec18e6..1c3b8e50a 100644
--- a/src/lib/rng/system_rng/system_rng.cpp
+++ b/src/lib/rng/system_rng/system_rng.cpp
@@ -71,7 +71,7 @@ System_RNG_Impl::System_RNG_Impl()
{
#if defined(BOTAN_TARGET_OS_HAS_CRYPTGENRANDOM)
- if(!CryptAcquireContext(&m_prov, 0, 0, BOTAN_SYSTEM_RNG_CRYPTOAPI_PROV_TYPE, CRYPT_VERIFYCONTEXT))
+ if(!CryptAcquireContext(&m_prov, nullptr, nullptr, BOTAN_SYSTEM_RNG_CRYPTOAPI_PROV_TYPE, CRYPT_VERIFYCONTEXT))
throw Exception("System_RNG failed to acquire crypto provider");
#elif defined(BOTAN_TARGET_OS_HAS_ARC4RANDOM)