mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-06-09 23:56:52 +02:00
prevent the 'static initialization order fiasco' for crypto constants
This commit is contained in:
parent
170da1c903
commit
fbaf09ff2b
10 changed files with 58 additions and 35 deletions
|
@ -33,7 +33,7 @@ namespace ntcp
|
|||
|
||||
void NTCPSession::CreateAESKey (uint8_t * pubKey, uint8_t * aesKey)
|
||||
{
|
||||
CryptoPP::DH dh (elgp, elgg);
|
||||
CryptoPP::DH dh (elgp(), elgg());
|
||||
uint8_t sharedKey[256];
|
||||
if (!dh.Agree (sharedKey, m_DHKeysPair->privateKey, pubKey))
|
||||
{
|
||||
|
@ -303,7 +303,7 @@ namespace ntcp
|
|||
s.tsB = tsB;
|
||||
|
||||
CryptoPP::DSA::PublicKey pubKey;
|
||||
pubKey.Initialize (dsap, dsaq, dsag, CryptoPP::Integer (m_RemoteRouterInfo.GetRouterIdentity ().signingKey, 128));
|
||||
pubKey.Initialize (dsap(), dsaq(), dsag(), CryptoPP::Integer (m_RemoteRouterInfo.GetRouterIdentity ().signingKey, 128));
|
||||
CryptoPP::DSA::Verifier verifier (pubKey);
|
||||
if (!verifier.VerifyMessage ((uint8_t *)&s, sizeof(s), m_Phase3.signature, 40))
|
||||
{
|
||||
|
@ -370,7 +370,7 @@ namespace ntcp
|
|||
s.tsB = m_Phase2.encrypted.timestamp;
|
||||
|
||||
CryptoPP::DSA::PublicKey pubKey;
|
||||
pubKey.Initialize (dsap, dsaq, dsag, CryptoPP::Integer (m_RemoteRouterInfo.GetRouterIdentity ().signingKey, 128));
|
||||
pubKey.Initialize (dsap(), dsaq(), dsag(), CryptoPP::Integer (m_RemoteRouterInfo.GetRouterIdentity ().signingKey, 128));
|
||||
CryptoPP::DSA::Verifier verifier (pubKey);
|
||||
if (!verifier.VerifyMessage ((uint8_t *)&s, sizeof(s), m_Phase4.signature, 40))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue