|
|
@ -43,12 +43,9 @@ namespace i2p |
|
|
|
m_Decryptor = m_Keys.CreateDecryptor (nullptr); |
|
|
|
m_Decryptor = m_Keys.CreateDecryptor (nullptr); |
|
|
|
m_TunnelDecryptor = m_Keys.CreateDecryptor (nullptr); |
|
|
|
m_TunnelDecryptor = m_Keys.CreateDecryptor (nullptr); |
|
|
|
UpdateRouterInfo (); |
|
|
|
UpdateRouterInfo (); |
|
|
|
if (IsECIES ()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
i2p::crypto::InitNoiseNState (m_InitialNoiseState, GetIdentity ()->GetEncryptionPublicKey ()); |
|
|
|
i2p::crypto::InitNoiseNState (m_InitialNoiseState, GetIdentity ()->GetEncryptionPublicKey ()); |
|
|
|
m_ECIESSession = std::make_shared<i2p::garlic::RouterIncomingRatchetSession>(m_InitialNoiseState); |
|
|
|
m_ECIESSession = std::make_shared<i2p::garlic::RouterIncomingRatchetSession>(m_InitialNoiseState); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void RouterContext::CreateNewRouter () |
|
|
|
void RouterContext::CreateNewRouter () |
|
|
|
{ |
|
|
|
{ |
|
|
@ -833,8 +830,6 @@ namespace i2p |
|
|
|
void RouterContext::ProcessGarlicMessage (std::shared_ptr<I2NPMessage> msg) |
|
|
|
void RouterContext::ProcessGarlicMessage (std::shared_ptr<I2NPMessage> msg) |
|
|
|
{ |
|
|
|
{ |
|
|
|
std::unique_lock<std::mutex> l(m_GarlicMutex); |
|
|
|
std::unique_lock<std::mutex> l(m_GarlicMutex); |
|
|
|
if (IsECIES ()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
uint8_t * buf = msg->GetPayload (); |
|
|
|
uint8_t * buf = msg->GetPayload (); |
|
|
|
uint32_t len = bufbe32toh (buf); |
|
|
|
uint32_t len = bufbe32toh (buf); |
|
|
|
if (len > msg->GetLength ()) |
|
|
|
if (len > msg->GetLength ()) |
|
|
@ -852,9 +847,6 @@ namespace i2p |
|
|
|
LogPrint (eLogError, "Router: Session is not set for ECIES router"); |
|
|
|
LogPrint (eLogError, "Router: Session is not set for ECIES router"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
|
|
|
|
i2p::garlic::GarlicDestination::ProcessGarlicMessage (msg); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void RouterContext::ProcessDeliveryStatusMessage (std::shared_ptr<I2NPMessage> msg) |
|
|
|
void RouterContext::ProcessDeliveryStatusMessage (std::shared_ptr<I2NPMessage> msg) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -885,13 +877,7 @@ namespace i2p |
|
|
|
|
|
|
|
|
|
|
|
bool RouterContext::DecryptTunnelBuildRecord (const uint8_t * encrypted, uint8_t * data) |
|
|
|
bool RouterContext::DecryptTunnelBuildRecord (const uint8_t * encrypted, uint8_t * data) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (IsECIES ()) |
|
|
|
|
|
|
|
return DecryptECIESTunnelBuildRecord (encrypted, data, ECIES_BUILD_REQUEST_RECORD_CLEAR_TEXT_SIZE); |
|
|
|
return DecryptECIESTunnelBuildRecord (encrypted, data, ECIES_BUILD_REQUEST_RECORD_CLEAR_TEXT_SIZE); |
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
LogPrint (eLogError, "Router: Non-ECIES router is not longer supported"); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool RouterContext::DecryptECIESTunnelBuildRecord (const uint8_t * encrypted, uint8_t * data, size_t clearTextSize) |
|
|
|
bool RouterContext::DecryptECIESTunnelBuildRecord (const uint8_t * encrypted, uint8_t * data, size_t clearTextSize) |
|
|
@ -921,13 +907,7 @@ namespace i2p |
|
|
|
|
|
|
|
|
|
|
|
bool RouterContext::DecryptTunnelShortRequestRecord (const uint8_t * encrypted, uint8_t * data) |
|
|
|
bool RouterContext::DecryptTunnelShortRequestRecord (const uint8_t * encrypted, uint8_t * data) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (IsECIES ()) |
|
|
|
|
|
|
|
return DecryptECIESTunnelBuildRecord (encrypted, data, SHORT_REQUEST_RECORD_CLEAR_TEXT_SIZE); |
|
|
|
return DecryptECIESTunnelBuildRecord (encrypted, data, SHORT_REQUEST_RECORD_CLEAR_TEXT_SIZE); |
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
LogPrint (eLogError, "Router: Can't decrypt short request record on non-ECIES router"); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
i2p::crypto::X25519Keys& RouterContext::GetStaticKeys () |
|
|
|
i2p::crypto::X25519Keys& RouterContext::GetStaticKeys () |
|
|
|