From aa49cad2797ac20d6bf4b46c6a579d7601c564c6 Mon Sep 17 00:00:00 2001 From: orignal Date: Mon, 21 Mar 2022 13:21:08 -0400 Subject: [PATCH] correct encrypted payload size for MixHash --- libi2pd/SSU2.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libi2pd/SSU2.cpp b/libi2pd/SSU2.cpp index cc75c31f..0ee29ae7 100644 --- a/libi2pd/SSU2.cpp +++ b/libi2pd/SSU2.cpp @@ -94,7 +94,7 @@ namespace transport header.ll[0] ^= CreateHeaderMask (m_Address->i, payload + (payloadSize - 24)); header.ll[1] ^= CreateHeaderMask (m_Address->i, payload + (payloadSize - 12)); i2p::crypto::ChaCha20 (headerX, 48, m_Address->i, nonce, headerX); - m_NoiseState->MixHash (payload, 24); // h = SHA256(h || 24 byte encrypted payload from Session Request) for SessionCreated + m_NoiseState->MixHash (payload, payloadSize); // h = SHA256(h || encrypted payload from Session Request) for SessionCreated // send m_Server.AddPendingOutgoingSession (m_RemoteEndpoint, shared_from_this ()); m_Server.Send (header.buf, 16, headerX, 48, payload, payloadSize, m_RemoteEndpoint); @@ -132,7 +132,7 @@ namespace transport LogPrint (eLogWarning, "SSU2: SessionRequest AEAD verification failed "); return; } - m_NoiseState->MixHash (payload, 24); // h = SHA256(h || 24 byte encrypted payload from Session Request) for SessionCreated + m_NoiseState->MixHash (payload, len - 64); // h = SHA256(h || encrypted payload from Session Request) for SessionCreated // payload HandlePayload (decryptedPayload.data (), decryptedPayload.size ());