ext-cryptopp/dh2.cpp

25 lines
753 B
C++
Raw Normal View History

// dh2.cpp - originally written and placed in the public domain by Wei Dai
2015-11-05 06:59:46 +00:00
#include "pch.h"
#include "dh2.h"
NAMESPACE_BEGIN(CryptoPP)
#if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
2015-11-05 06:59:46 +00:00
void DH2_TestInstantiations()
{
2017-03-01 11:10:06 +00:00
DH2 dh(*(SimpleKeyAgreementDomain*)NULLPTR);
2015-11-05 06:59:46 +00:00
}
#endif
2015-11-05 06:59:46 +00:00
bool DH2::Agree(byte *agreedValue,
2016-09-10 08:57:48 +00:00
const byte *staticSecretKey, const byte *ephemeralSecretKey,
2015-11-05 06:59:46 +00:00
const byte *staticOtherPublicKey, const byte *ephemeralOtherPublicKey,
bool validateStaticOtherPublicKey) const
{
return d1.Agree(agreedValue, staticSecretKey, staticOtherPublicKey, validateStaticOtherPublicKey)
&& d2.Agree(agreedValue+d1.AgreedValueLength(), ephemeralSecretKey, ephemeralOtherPublicKey, true);
}
NAMESPACE_END