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 @@ -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
#if OPENSSL_X25519
EVP_PKEY_CTX * m_Ctx;
EVP_PKEY * m_Pkey;
#else
BN_CTX * m_Ctx;
uint8_t m_PrivateKey[32];
#endif
};

1
libi2pd/NTCP2.cpp

@ -17,7 +17,6 @@ @@ -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"

1
libi2pd/NTCP2.h

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

6
libi2pd/RouterContext.cpp

@ -626,7 +626,11 @@ namespace i2p @@ -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;
}

Loading…
Cancel
Save