Browse Source

some cleanup

pull/1243/head
orignal 6 years ago
parent
commit
3540712517
  1. 3
      libi2pd/Crypto.h
  2. 1
      libi2pd/NTCP2.cpp
  3. 1
      libi2pd/NTCP2.h
  4. 6
      libi2pd/RouterContext.cpp

3
libi2pd/Crypto.h

@ -71,18 +71,17 @@ namespace crypto
void GenerateKeys (); void GenerateKeys ();
const uint8_t * GetPublicKey () const { return m_PublicKey; }; 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); void Agree (const uint8_t * pub, uint8_t * shared);
private: private:
uint8_t m_PublicKey[32]; uint8_t m_PublicKey[32];
uint8_t m_PrivateKey[32]; // TODO: move to #else
#if OPENSSL_X25519 #if OPENSSL_X25519
EVP_PKEY_CTX * m_Ctx; EVP_PKEY_CTX * m_Ctx;
EVP_PKEY * m_Pkey; EVP_PKEY * m_Pkey;
#else #else
BN_CTX * m_Ctx; BN_CTX * m_Ctx;
uint8_t m_PrivateKey[32];
#endif #endif
}; };

1
libi2pd/NTCP2.cpp

@ -17,7 +17,6 @@
#include "Log.h" #include "Log.h"
#include "I2PEndian.h" #include "I2PEndian.h"
#include "Crypto.h" #include "Crypto.h"
#include "Ed25519.h"
#include "Siphash.h" #include "Siphash.h"
#include "RouterContext.h" #include "RouterContext.h"
#include "Transports.h" #include "Transports.h"

1
libi2pd/NTCP2.h

@ -18,7 +18,6 @@
#include <map> #include <map>
#include <array> #include <array>
#include <openssl/bn.h> #include <openssl/bn.h>
#include <openssl/evp.h>
#include <boost/asio.hpp> #include <boost/asio.hpp>
#include "Crypto.h" #include "Crypto.h"
#include "util.h" #include "util.h"

6
libi2pd/RouterContext.cpp

@ -626,7 +626,11 @@ namespace i2p
if (!m_StaticKeys) if (!m_StaticKeys)
{ {
if (!m_NTCP2Keys) NewNTCP2Keys (); 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; return *m_StaticKeys;
} }

Loading…
Cancel
Save