mirror of
https://github.com/shadps4-emu/ext-cryptopp.git
synced 2024-11-24 02:19:41 +00:00
c9ef9420e7
This check-in provides the fix for leaks in ECP's Add() and Double(). The fixes were taken from Joost Renes, Craig Costello, and Lejla Batina's [Complete addition formulas for prime order elliptic curves](https://eprint.iacr.org/2015/1060.pdf). The Pull Request includes two additional changes that were related to testing the primary fix. First, an `AuthenticatedKeyAgreementWithRolesValidate` interface was added. It allows us to test key agreement when roles are involved. Roles are "client", "server", "initiator", "recipient", etc. Second, `SetGlobalSeed` was added to `test.cpp` to help with reproducible results. We had code in two different places that set the seed value for the random number generator. But it was sloppy and doing a poor job since results could not be reproduced under some circumstances.
47 lines
959 B
C++
47 lines
959 B
C++
// mqv.cpp - originally written and placed in the public domain by Wei Dai
|
|
// HMQV provided by Jeffrey Walton, Ray Clayton and Uri Blumenthal.
|
|
// FHMQV provided by Uri Blumenthal.
|
|
|
|
#include "pch.h"
|
|
#include "config.h"
|
|
#include "mqv.h"
|
|
#include "hmqv.h"
|
|
#include "fhmqv.h"
|
|
#include "eccrypto.h"
|
|
|
|
// Squash MS LNK4221 and libtool warnings
|
|
extern const char MQV_FNAME[] = __FILE__;
|
|
|
|
NAMESPACE_BEGIN(CryptoPP)
|
|
|
|
#if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
|
void TestInstantiations_MQV()
|
|
{
|
|
MQV mqv;
|
|
ECMQV<ECP> ecmqv;
|
|
|
|
CRYPTOPP_UNUSED(mqv);
|
|
CRYPTOPP_UNUSED(ecmqv);
|
|
}
|
|
|
|
void TestInstantiations_HMQV()
|
|
{
|
|
HMQV hmqv;
|
|
ECHMQV<ECP> echmqv;
|
|
|
|
CRYPTOPP_UNUSED(hmqv);
|
|
CRYPTOPP_UNUSED(echmqv);
|
|
}
|
|
|
|
void TestInstantiations_FHMQV()
|
|
{
|
|
FHMQV fhmqv;
|
|
ECFHMQV<ECP> ecfhmqv;
|
|
|
|
CRYPTOPP_UNUSED(fhmqv);
|
|
CRYPTOPP_UNUSED(ecfhmqv);
|
|
}
|
|
#endif
|
|
|
|
NAMESPACE_END
|