1
0
mirror of https://github.com/PurpleI2P/i2pd.git synced 2025-08-26 17:01:49 +00:00

don't add signature to ping message if i2p.streaming.dontSign

This commit is contained in:
orignal 2025-08-06 13:44:46 -04:00
parent aca5f35fa0
commit 20ba95ee52

View File

@ -1218,7 +1218,8 @@ namespace stream
size += 4; // sendStreamID size += 4; // sendStreamID
memset (packet + size, 0, 14); memset (packet + size, 0, 14);
size += 14; // all zeroes size += 14; // all zeroes
uint16_t flags = PACKET_FLAG_ECHO | PACKET_FLAG_SIGNATURE_INCLUDED | PACKET_FLAG_FROM_INCLUDED; uint16_t flags = PACKET_FLAG_ECHO | PACKET_FLAG_FROM_INCLUDED;
if (!m_DontSign) flags |= PACKET_FLAG_SIGNATURE_INCLUDED;
bool isOfflineSignature = m_LocalDestination.GetOwner ()->GetPrivateKeys ().IsOfflineSignature (); bool isOfflineSignature = m_LocalDestination.GetOwner ()->GetPrivateKeys ().IsOfflineSignature ();
if (isOfflineSignature) flags |= PACKET_FLAG_OFFLINE_SIGNATURE; if (isOfflineSignature) flags |= PACKET_FLAG_OFFLINE_SIGNATURE;
htobe16buf (packet + size, flags); htobe16buf (packet + size, flags);
@ -1229,6 +1230,10 @@ namespace stream
size += 2; // options size size += 2; // options size
m_LocalDestination.GetOwner ()->GetIdentity ()->ToBuffer (packet + size, identityLen); m_LocalDestination.GetOwner ()->GetIdentity ()->ToBuffer (packet + size, identityLen);
size += identityLen; // from size += identityLen; // from
if (m_DontSign)
htobe16buf (optionsSize, packet + size - 2 - optionsSize); // actual options size
else
{
if (isOfflineSignature) if (isOfflineSignature)
{ {
const auto& offlineSignature = m_LocalDestination.GetOwner ()->GetPrivateKeys ().GetOfflineSignature (); const auto& offlineSignature = m_LocalDestination.GetOwner ()->GetPrivateKeys ().GetOfflineSignature ();
@ -1240,6 +1245,7 @@ namespace stream
size += signatureLen; // signature size += signatureLen; // signature
htobe16buf (optionsSize, packet + size - 2 - optionsSize); // actual options size htobe16buf (optionsSize, packet + size - 2 - optionsSize); // actual options size
m_LocalDestination.GetOwner ()->Sign (packet, size, signature); m_LocalDestination.GetOwner ()->Sign (packet, size, signature);
}
p.len = size; p.len = size;
SendPackets (std::vector<Packet *> { &p }); SendPackets (std::vector<Packet *> { &p });
LogPrint (eLogDebug, "Streaming: Ping of ", p.len, " bytes sent"); LogPrint (eLogDebug, "Streaming: Ping of ", p.len, " bytes sent");