diff --git a/chacha.cpp b/chacha.cpp index 9e0e3d37..9f68a0aa 100644 --- a/chacha.cpp +++ b/chacha.cpp @@ -345,7 +345,7 @@ void ChaCha_Policy::CipherSetKey(const NameValuePairs ¶ms, const byte *key, CRYPTOPP_ASSERT(key); CRYPTOPP_ASSERT(length == 16 || length == 32); CRYPTOPP_UNUSED(key); CRYPTOPP_UNUSED(length); - m_rounds = params.GetIntValueWithDefault(Name::Rounds(), 20); + m_rounds = params.GetIntValueWithDefault(Name::Rounds(), m_rounds); if (m_rounds != 20 && m_rounds != 12 && m_rounds != 8) throw InvalidRounds(ChaCha::StaticAlgorithmName(), m_rounds); diff --git a/chacha.h b/chacha.h index 76aeb01b..ac53c66f 100644 --- a/chacha.h +++ b/chacha.h @@ -58,7 +58,7 @@ class CRYPTOPP_NO_VTABLE ChaCha_Policy : public AdditiveCipherConcretePolicy { protected: + Salsa20_Policy() : m_rounds(20) {} void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length); void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount); void CipherResynchronize(byte *keystreamBuffer, const byte *IV, size_t length);