Skip to content

Commit

Permalink
Fix ChaCha20Poly1305 IVSize() (GH #724)
Browse files Browse the repository at this point in the history
  • Loading branch information
noloader committed Jan 28, 2019
1 parent fcf6370 commit 7c3414b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion chachapoly.cpp
Expand Up @@ -19,7 +19,7 @@ void ChaCha20Poly1305_Base::RekeyCipherAndMac(const byte *userKey, size_t keylen
AccessSymmetricCipher().ProcessString(derived, derived.size());

// Set the Poly1305 key
AccessMAC().SetKey(derived, 32, params);
AccessMAC().SetKey(derived, derived.size(), params);

// Key Cipher for bulk encryption
AlgorithmParameters block1 = MakeParameters("InitialBlock", (word64)1, true);
Expand Down
6 changes: 5 additions & 1 deletion chachapoly.h
Expand Up @@ -53,7 +53,7 @@ class ChaCha20Poly1305_Base
IV_Requirement IVRequirement() const
{return UNIQUE_IV;}
unsigned int IVSize() const
{return 16;}
{return 12;}
unsigned int MinIVLength() const
{return 12;}
unsigned int MaxIVLength() const
Expand Down Expand Up @@ -128,6 +128,10 @@ class ChaCha20Poly1305_Base
/// \since Crypto++ 8.1
class ChaCha20Poly1305_Final : public ChaCha20Poly1305_Base
{
public:
static std::string StaticAlgorithmName()
{return std::string("ChaCha20/Poly1305");}

protected:
const SymmetricCipher & GetSymmetricCipher()
{return const_cast<ChaCha20Poly1305_Final *>(this)->AccessSymmetricCipher();}
Expand Down

0 comments on commit 7c3414b

Please sign in to comment.