Crypto++
dh2.cpp
1 // dh2.cpp - written and placed in the public domain by Wei Dai
2 
3 #include "pch.h"
4 #include "dh2.h"
5 
6 NAMESPACE_BEGIN(CryptoPP)
7 
8 void DH2_TestInstantiations()
9 {
10  DH2 dh(*(SimpleKeyAgreementDomain*)NULL);
11 }
12 
13 bool DH2::Agree(byte *agreedValue,
14  const byte *staticSecretKey, const byte *ephemeralSecretKey,
15  const byte *staticOtherPublicKey, const byte *ephemeralOtherPublicKey,
16  bool validateStaticOtherPublicKey) const
17 {
18  return d1.Agree(agreedValue, staticSecretKey, staticOtherPublicKey, validateStaticOtherPublicKey)
19  && d2.Agree(agreedValue+d1.AgreedValueLength(), ephemeralSecretKey, ephemeralOtherPublicKey, true);
20 }
21 
22 NAMESPACE_END