always init CipherKey digest pointer

This commit is contained in:
Alex Fabijanic 2017-09-26 11:43:59 -05:00
parent 79b35fd0f3
commit 01f90c7632
2 changed files with 14 additions and 15 deletions

View File

@ -29,8 +29,7 @@ CipherKeyImpl::CipherKeyImpl(const std::string& name,
const std::string& passphrase,
const std::string& salt,
int iterationCount,
const std::string& digest):
_pCipher(0),
const std::string& digest): _pCipher(0),
_pDigest(0),
_name(name),
_key(),
@ -57,8 +56,8 @@ CipherKeyImpl::CipherKeyImpl(const std::string& name,
CipherKeyImpl::CipherKeyImpl(const std::string& name,
const ByteVec& key,
const ByteVec& iv):
_pCipher(0),
const ByteVec& iv): _pCipher(0),
_pDigest(0),
_name(name),
_key(key),
_iv(iv)
@ -72,8 +71,8 @@ CipherKeyImpl::CipherKeyImpl(const std::string& name,
}
CipherKeyImpl::CipherKeyImpl(const std::string& name):
_pCipher(0),
CipherKeyImpl::CipherKeyImpl(const std::string& name): _pCipher(0),
_pDigest(0),
_name(name),
_key(),
_iv()
@ -165,7 +164,7 @@ void CipherKeyImpl::generateKey(
// Now create the key and IV, using the digest set in the constructor.
int keySize = EVP_BytesToKey(
_pCipher,
_pDigest,
_pDigest ? _pDigest : EVP_md5(),
(salt.empty() ? 0 : saltBytes),
reinterpret_cast<const unsigned char*>(password.data()),
static_cast<int>(password.size()),

@ -1 +1 @@
Subproject commit 91c24b8028baf6cc91e77e154d6a90a850bcb558
Subproject commit 26b1673caad94a702b6d694f48f917a283b30777