summaryrefslogtreecommitdiff
path: root/chachapoly.h
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2019-01-30 00:55:27 -0500
committerJeffrey Walton <noloader@gmail.com>2019-01-30 00:55:27 -0500
commitdd48a7aceff33e6e409cdaa8755f40d38641afeb (patch)
tree2099083893fab5eb5e850f71f44ba88947b8df47 /chachapoly.h
parenta4f6da8d304401c209a0e2ea89ef5377707d0b22 (diff)
downloadcryptopp-git-dd48a7aceff33e6e409cdaa8755f40d38641afeb.tar.gz
Fix ChaCha20/Poly1305 when using filters (GH #724)
Diffstat (limited to 'chachapoly.h')
-rw-r--r--chachapoly.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/chachapoly.h b/chachapoly.h
index fc3f4481..5f7e92e6 100644
--- a/chachapoly.h
+++ b/chachapoly.h
@@ -66,7 +66,7 @@ public:
lword MaxMessageLength() const
{return LWORD_MAX;}
lword MaxFooterLength() const
- {return 16;}
+ {return 0;}
/// \brief Encrypts and calculates a MAC in one call
/// \param ciphertext the encryption buffer
@@ -127,6 +127,7 @@ protected:
/// \sa <A HREF="http://tools.ietf.org/html/rfc8439">RFC 8439, ChaCha20 and Poly1305
/// for IETF Protocols</A>.
/// \since Crypto++ 8.1
+template <bool T_ForwardTransform>
class ChaCha20Poly1305_Final : public ChaCha20Poly1305_Base
{
public:
@@ -139,7 +140,7 @@ protected:
SymmetricCipher & AccessSymmetricCipher()
{return m_cipher;}
bool IsForwardTransformation() const
- {return m_cipher.IsForwardTransformation();}
+ {return T_ForwardTransform;}
const MessageAuthenticationCode & GetMAC() const
{return const_cast<ChaCha20Poly1305_Final *>(this)->AccessMAC();}
@@ -161,11 +162,10 @@ private:
/// \since Crypto++ 8.1
struct ChaCha20Poly1305 : public AuthenticatedSymmetricCipherDocumentation
{
- typedef ChaCha20Poly1305_Final Encryption;
- typedef Encryption Decryption;
+ typedef ChaCha20Poly1305_Final<true> Encryption;
+ typedef ChaCha20Poly1305_Final<false> Decryption;
};
-
NAMESPACE_END
#endif // CRYPTOPP_CHACHA_POLY1305_H