Fix ChaCha20Poly1305 IVSize() (GH #724)

pull/795/head
Jeffrey Walton 2019-01-28 10:01:19 -05:00
parent fcf637082d
commit 7c3414b072
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
2 changed files with 6 additions and 2 deletions

View File

@ -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);

View File

@ -53,7 +53,7 @@ public:
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
@ -128,6 +128,10 @@ protected:
/// \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();}