1
0
mirror of https://github.com/PurpleI2P/i2pd.git synced 2025-01-22 04:04:16 +00:00

encrypt inbound tunnel build message for short tunnel build only

This commit is contained in:
orignal 2021-07-10 17:28:18 -04:00
parent 6a467a09bd
commit 15c3d46492

View File

@ -93,9 +93,15 @@ namespace tunnel
// send message
if (outboundTunnel)
{
auto ident = m_Config->GetFirstHop () ? m_Config->GetFirstHop ()->ident : nullptr;
if (ident && ident->GetCryptoKeyType () == i2p::data::CRYPTO_KEY_TYPE_ECIES_X25519_AEAD)
msg = i2p::garlic::WrapECIESX25519MessageForRouter (msg, ident->GetEncryptionPublicKey ());
if (m_Config->IsShort ())
{
auto ident = m_Config->GetFirstHop () ? m_Config->GetFirstHop ()->ident : nullptr;
if (ident)
{
auto msg1 = i2p::garlic::WrapECIESX25519MessageForRouter (msg, ident->GetEncryptionPublicKey ());
if (msg1) msg = msg;
}
}
outboundTunnel->SendTunnelDataMsg (GetNextIdentHash (), 0, msg);
}
else