diff --git a/libi2pd/Crypto.h b/libi2pd/Crypto.h index b02db36c..7c922e36 100644 --- a/libi2pd/Crypto.h +++ b/libi2pd/Crypto.h @@ -71,18 +71,17 @@ namespace crypto void GenerateKeys (); const uint8_t * GetPublicKey () const { return m_PublicKey; }; - const uint8_t * GetPrivateKey () const { return m_PrivateKey; }; // TODO: remove void Agree (const uint8_t * pub, uint8_t * shared); private: - uint8_t m_PublicKey[32]; - uint8_t m_PrivateKey[32]; // TODO: move to #else + uint8_t m_PublicKey[32]; #if OPENSSL_X25519 EVP_PKEY_CTX * m_Ctx; EVP_PKEY * m_Pkey; #else BN_CTX * m_Ctx; + uint8_t m_PrivateKey[32]; #endif }; diff --git a/libi2pd/NTCP2.cpp b/libi2pd/NTCP2.cpp index 5c4cc9ce..444def80 100644 --- a/libi2pd/NTCP2.cpp +++ b/libi2pd/NTCP2.cpp @@ -17,7 +17,6 @@ #include "Log.h" #include "I2PEndian.h" #include "Crypto.h" -#include "Ed25519.h" #include "Siphash.h" #include "RouterContext.h" #include "Transports.h" diff --git a/libi2pd/NTCP2.h b/libi2pd/NTCP2.h index 07f44371..eea540dc 100644 --- a/libi2pd/NTCP2.h +++ b/libi2pd/NTCP2.h @@ -18,7 +18,6 @@ #include #include #include -#include #include #include "Crypto.h" #include "util.h" diff --git a/libi2pd/RouterContext.cpp b/libi2pd/RouterContext.cpp index d8ef4c4a..d255da17 100644 --- a/libi2pd/RouterContext.cpp +++ b/libi2pd/RouterContext.cpp @@ -626,7 +626,11 @@ namespace i2p if (!m_StaticKeys) { if (!m_NTCP2Keys) NewNTCP2Keys (); - m_StaticKeys.reset (new i2p::crypto::X25519Keys (m_NTCP2Keys->staticPrivateKey, m_NTCP2Keys->staticPublicKey)); + auto x = new i2p::crypto::X25519Keys (m_NTCP2Keys->staticPrivateKey, m_NTCP2Keys->staticPublicKey); + if (!m_StaticKeys) + m_StaticKeys.reset (x); + else + delete x; } return *m_StaticKeys; }