diff --git a/eccrypto.h b/eccrypto.h index 18572b7b..9b99fc21 100644 --- a/eccrypto.h +++ b/eccrypto.h @@ -283,10 +283,10 @@ struct ECNR : public DL_SS, DL_Algorithm_ECNR, DL_SignatureMe }; //! Elliptic Curve Integrated Encryption Scheme, AKA ECIES -/*! Default to (NoCofactorMultiplication and DHAES_MODE = false) for compatibilty with SEC1 and Crypto++ 4.2. +/*! Choose NoCofactorMultiplication and DHAES_MODE = false for compatibilty with SEC1 and Crypto++ 4.2. The combination of (IncompatibleCofactorMultiplication and DHAES_MODE = true) is recommended for best efficiency and security. */ -template +template struct ECIES : public DL_ES< DL_Keys_EC, diff --git a/gfpcrypt.h b/gfpcrypt.h index ed37bf4a..806c23cc 100644 --- a/gfpcrypt.h +++ b/gfpcrypt.h @@ -532,8 +532,8 @@ public: mac.Update(encodingParameters.begin(), encodingParameters.size()); if (DHAES_MODE) { - byte L[8] = {0,0,0,0}; - PutWord(false, BIG_ENDIAN_ORDER, L+4, word32(encodingParameters.size())); + byte L[8] = {0,0,0,0, 0,0,0,0}; + PutWord(false, BIG_ENDIAN_ORDER, L, word64(encodingParameters.size())); mac.Update(L, 8); } mac.Final(ciphertext + plaintextLength); @@ -561,8 +561,8 @@ public: mac.Update(encodingParameters.begin(), encodingParameters.size()); if (DHAES_MODE) { - byte L[8] = {0,0,0,0}; - PutWord(false, BIG_ENDIAN_ORDER, L+4, word32(encodingParameters.size())); + byte L[8] = {0,0,0,0, 0,0,0,0}; + PutWord(false, BIG_ENDIAN_ORDER, L, word64(encodingParameters.size())); mac.Update(L, 8); } if (!mac.Verify(ciphertext + plaintextLength))