correct encrypted payload size for MixHash

This commit is contained in:
orignal 2022-03-21 13:21:08 -04:00
parent f56ae240ab
commit aa49cad279

View File

@ -94,7 +94,7 @@ namespace transport
header.ll[0] ^= CreateHeaderMask (m_Address->i, payload + (payloadSize - 24)); header.ll[0] ^= CreateHeaderMask (m_Address->i, payload + (payloadSize - 24));
header.ll[1] ^= CreateHeaderMask (m_Address->i, payload + (payloadSize - 12)); header.ll[1] ^= CreateHeaderMask (m_Address->i, payload + (payloadSize - 12));
i2p::crypto::ChaCha20 (headerX, 48, m_Address->i, nonce, headerX); 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 // send
m_Server.AddPendingOutgoingSession (m_RemoteEndpoint, shared_from_this ()); m_Server.AddPendingOutgoingSession (m_RemoteEndpoint, shared_from_this ());
m_Server.Send (header.buf, 16, headerX, 48, payload, payloadSize, m_RemoteEndpoint); 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 "); LogPrint (eLogWarning, "SSU2: SessionRequest AEAD verification failed ");
return; 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 // payload
HandlePayload (decryptedPayload.data (), decryptedPayload.size ()); HandlePayload (decryptedPayload.data (), decryptedPayload.size ());