ext-cryptopp/dh2.cpp

25 lines
730 B
C++
Raw Normal View History

2015-11-05 06:59:46 +00:00
// dh2.cpp - written and placed in the public domain by Wei Dai
#include "pch.h"
#include "dh2.h"
NAMESPACE_BEGIN(CryptoPP)
#if CRYPTOPP_DEBUG && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
2015-11-05 06:59:46 +00:00
void DH2_TestInstantiations()
{
DH2 dh(*(SimpleKeyAgreementDomain*)NULL);
}
#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