Merge 48c0f900c7 into be8a9f6742
commit
aaea1cb8c1
|
|
@ -283,10 +283,10 @@ struct ECNR : public DL_SS<DL_Keys_EC<EC>, DL_Algorithm_ECNR<EC>, DL_SignatureMe
|
|||
};
|
||||
|
||||
//! Elliptic Curve Integrated Encryption Scheme, AKA <a href="http://www.weidai.com/scan-mirror/ca.html#ECIES">ECIES</a>
|
||||
/*! 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 <class EC, class COFACTOR_OPTION = NoCofactorMultiplication, bool DHAES_MODE = false>
|
||||
template <class EC, class COFACTOR_OPTION = NoCofactorMultiplication, bool DHAES_MODE = true>
|
||||
struct ECIES
|
||||
: public DL_ES<
|
||||
DL_Keys_EC<EC>,
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Reference in New Issue