From 01f90c7632f5d92dfa67bb2ff749444c9b8bb29e Mon Sep 17 00:00:00 2001 From: Alex Fabijanic Date: Tue, 26 Sep 2017 11:43:59 -0500 Subject: [PATCH] always init CipherKey digest pointer --- Crypto/src/CipherKeyImpl.cpp | 27 +++++++++++++-------------- openssl | 2 +- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/Crypto/src/CipherKeyImpl.cpp b/Crypto/src/CipherKeyImpl.cpp index 810b86e02..733be74c3 100644 --- a/Crypto/src/CipherKeyImpl.cpp +++ b/Crypto/src/CipherKeyImpl.cpp @@ -29,12 +29,11 @@ CipherKeyImpl::CipherKeyImpl(const std::string& name, const std::string& passphrase, const std::string& salt, int iterationCount, - const std::string& digest): - _pCipher(0), - _pDigest(0), - _name(name), - _key(), - _iv() + const std::string& digest): _pCipher(0), + _pDigest(0), + _name(name), + _key(), + _iv() { // dummy access to Cipherfactory so that the EVP lib is initilaized CipherFactory::defaultFactory(); @@ -57,11 +56,11 @@ CipherKeyImpl::CipherKeyImpl(const std::string& name, CipherKeyImpl::CipherKeyImpl(const std::string& name, const ByteVec& key, - const ByteVec& iv): - _pCipher(0), - _name(name), - _key(key), - _iv(iv) + const ByteVec& iv): _pCipher(0), + _pDigest(0), + _name(name), + _key(key), + _iv(iv) { // dummy access to Cipherfactory so that the EVP lib is initilaized CipherFactory::defaultFactory(); @@ -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(password.data()), static_cast(password.size()), diff --git a/openssl b/openssl index 91c24b802..26b1673ca 160000 --- a/openssl +++ b/openssl @@ -1 +1 @@ -Subproject commit 91c24b8028baf6cc91e77e154d6a90a850bcb558 +Subproject commit 26b1673caad94a702b6d694f48f917a283b30777