summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2019-01-30 01:45:09 -0500
committerJeffrey Walton <noloader@gmail.com>2019-01-30 01:45:09 -0500
commitc1ad534038f044c4428eac21318b0d55927cfabd (patch)
tree13c1f290400ca9c3bcb3d9fb531140d43dd73556
parent38f694924f8473bde2f2843ea5731e326203d671 (diff)
downloadcryptopp-git-c1ad534038f044c4428eac21318b0d55927cfabd.tar.gz
Update comments
-rw-r--r--chacha.cpp3
-rw-r--r--chachapoly.cpp6
-rw-r--r--chachapoly.h1
3 files changed, 9 insertions, 1 deletions
diff --git a/chacha.cpp b/chacha.cpp
index 321ebbaf..fcea81ec 100644
--- a/chacha.cpp
+++ b/chacha.cpp
@@ -316,6 +316,7 @@ std::string ChaCha_Policy::AlgorithmProvider() const
void ChaCha_Policy::CipherSetKey(const NameValuePairs &params, const byte *key, size_t length)
{
CRYPTOPP_ASSERT(key); CRYPTOPP_ASSERT(length == 16 || length == 32);
+ CRYPTOPP_UNUSED(key); CRYPTOPP_UNUSED(length);
m_rounds = params.GetIntValueWithDefault(Name::Rounds(), 20);
if (m_rounds != 20 && m_rounds != 12 && m_rounds != 8)
@@ -337,7 +338,7 @@ void ChaCha_Policy::CipherSetKey(const NameValuePairs &params, const byte *key,
void ChaCha_Policy::CipherResynchronize(byte *keystreamBuffer, const byte *IV, size_t length)
{
CRYPTOPP_UNUSED(keystreamBuffer), CRYPTOPP_UNUSED(length);
- CRYPTOPP_ASSERT(length==8);
+ CRYPTOPP_ASSERT(length==8); CRYPTOPP_UNUSED(length);
GetBlock<word32, LittleEndian> get(IV);
m_state[12] = m_state[13] = 0;
diff --git a/chachapoly.cpp b/chachapoly.cpp
index 6d4d395e..8daff99d 100644
--- a/chachapoly.cpp
+++ b/chachapoly.cpp
@@ -8,6 +8,12 @@
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 &params)
{
// Derive MAC key
diff --git a/chachapoly.h b/chachapoly.h
index 5f7e92e6..01637671 100644
--- a/chachapoly.h
+++ b/chachapoly.h
@@ -120,6 +120,7 @@ protected:
};
/// \brief ChaCha20Poly1305 cipher final implementation
+/// \tparam T_ForwardTransform flag indicating cipher direction
/// \details ChaCha20Poly1305 is an authenticated encryption scheme that combines
/// ChaCha20TLS and Poly1305TLS. The scheme is defined in RFC 8439, section 2.8,
/// AEAD_CHACHA20_POLY1305 construction, and uses the IETF versions of ChaCha