Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
709 B

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