Update comments
parent
38f694924f
commit
c1ad534038
|
|
@ -316,6 +316,7 @@ std::string ChaCha_Policy::AlgorithmProvider() const
|
||||||
void ChaCha_Policy::CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length)
|
void ChaCha_Policy::CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length)
|
||||||
{
|
{
|
||||||
CRYPTOPP_ASSERT(key); CRYPTOPP_ASSERT(length == 16 || length == 32);
|
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(), 20);
|
||||||
if (m_rounds != 20 && m_rounds != 12 && m_rounds != 8)
|
if (m_rounds != 20 && m_rounds != 12 && m_rounds != 8)
|
||||||
|
|
@ -337,7 +338,7 @@ void ChaCha_Policy::CipherSetKey(const NameValuePairs ¶ms, const byte *key,
|
||||||
void ChaCha_Policy::CipherResynchronize(byte *keystreamBuffer, const byte *IV, size_t length)
|
void ChaCha_Policy::CipherResynchronize(byte *keystreamBuffer, const byte *IV, size_t length)
|
||||||
{
|
{
|
||||||
CRYPTOPP_UNUSED(keystreamBuffer), CRYPTOPP_UNUSED(length);
|
CRYPTOPP_UNUSED(keystreamBuffer), CRYPTOPP_UNUSED(length);
|
||||||
CRYPTOPP_ASSERT(length==8);
|
CRYPTOPP_ASSERT(length==8); CRYPTOPP_UNUSED(length);
|
||||||
|
|
||||||
GetBlock<word32, LittleEndian> get(IV);
|
GetBlock<word32, LittleEndian> get(IV);
|
||||||
m_state[12] = m_state[13] = 0;
|
m_state[12] = m_state[13] = 0;
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,12 @@
|
||||||
|
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
|
// RekeyCipherAndMac is heavier-weight than we like. The Authenc framework was
|
||||||
|
// predicated on BlcokCiphers, where the key and key schedule could be
|
||||||
|
// calculated independent of the IV being used. However, the ChaCha and
|
||||||
|
// ChaCha20Poly1305 construction cannot disgorge key setup and IV. Even a
|
||||||
|
// simple Resync() forces us to regenerate the initial state for both
|
||||||
|
// ChaCha20 and Poly1305.
|
||||||
void ChaCha20Poly1305_Base::RekeyCipherAndMac(const byte *userKey, size_t keylength, const NameValuePairs ¶ms)
|
void ChaCha20Poly1305_Base::RekeyCipherAndMac(const byte *userKey, size_t keylength, const NameValuePairs ¶ms)
|
||||||
{
|
{
|
||||||
// Derive MAC key
|
// Derive MAC key
|
||||||
|
|
|
||||||
|
|
@ -120,6 +120,7 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief ChaCha20Poly1305 cipher final implementation
|
/// \brief ChaCha20Poly1305 cipher final implementation
|
||||||
|
/// \tparam T_ForwardTransform flag indicating cipher direction
|
||||||
/// \details ChaCha20Poly1305 is an authenticated encryption scheme that combines
|
/// \details ChaCha20Poly1305 is an authenticated encryption scheme that combines
|
||||||
/// ChaCha20TLS and Poly1305TLS. The scheme is defined in RFC 8439, section 2.8,
|
/// ChaCha20TLS and Poly1305TLS. The scheme is defined in RFC 8439, section 2.8,
|
||||||
/// AEAD_CHACHA20_POLY1305 construction, and uses the IETF versions of ChaCha
|
/// AEAD_CHACHA20_POLY1305 construction, and uses the IETF versions of ChaCha
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue