|
|
|
@ -935,7 +935,7 @@ namespace transport
@@ -935,7 +935,7 @@ namespace transport
|
|
|
|
|
htobe16buf (buf + 1, len); // size
|
|
|
|
|
len += 3; |
|
|
|
|
totalLen += len; |
|
|
|
|
encryptBufs.push_back (std::make_pair (buf, len)); |
|
|
|
|
encryptBufs.push_back ( {buf, len} ); |
|
|
|
|
if (&it == &msgs.front ()) // first message
|
|
|
|
|
{ |
|
|
|
|
// allocate two bytes for length
|
|
|
|
@ -949,7 +949,7 @@ namespace transport
@@ -949,7 +949,7 @@ namespace transport
|
|
|
|
|
auto paddingLen = CreatePaddingBlock (totalLen, buf + len, it->maxLen - it->len - 16); |
|
|
|
|
if (paddingLen) |
|
|
|
|
{ |
|
|
|
|
encryptBufs.push_back (std::make_pair (buf + len, paddingLen)); |
|
|
|
|
encryptBufs.push_back ( {buf + len, paddingLen} ); |
|
|
|
|
len += paddingLen; |
|
|
|
|
totalLen += paddingLen; |
|
|
|
|
} |
|
|
|
@ -969,7 +969,7 @@ namespace transport
@@ -969,7 +969,7 @@ namespace transport
|
|
|
|
|
auto paddingLen = CreatePaddingBlock (totalLen, m_NextSendBuffer, 287 - 16); |
|
|
|
|
// and padding block to encrypt and send
|
|
|
|
|
if (paddingLen) |
|
|
|
|
encryptBufs.push_back (std::make_pair (m_NextSendBuffer, paddingLen)); |
|
|
|
|
encryptBufs.push_back ( {m_NextSendBuffer, paddingLen} ); |
|
|
|
|
bufs.push_back (boost::asio::buffer (m_NextSendBuffer, paddingLen + 16)); |
|
|
|
|
macBuf = m_NextSendBuffer + paddingLen; |
|
|
|
|
totalLen += paddingLen; |
|
|
|
@ -1001,7 +1001,7 @@ namespace transport
@@ -1001,7 +1001,7 @@ namespace transport
|
|
|
|
|
// encrypt
|
|
|
|
|
uint8_t nonce[12]; |
|
|
|
|
CreateNonce (m_SendSequenceNumber, nonce); m_SendSequenceNumber++; |
|
|
|
|
i2p::crypto::AEADChaCha20Poly1305Encrypt ({std::make_pair (m_NextSendBuffer + 2, payloadLen)}, m_SendKey, nonce, m_NextSendBuffer + payloadLen + 2); |
|
|
|
|
i2p::crypto::AEADChaCha20Poly1305Encrypt ({ {m_NextSendBuffer + 2, payloadLen} }, m_SendKey, nonce, m_NextSendBuffer + payloadLen + 2); |
|
|
|
|
SetNextSentFrameLength (payloadLen + 16, m_NextSendBuffer); |
|
|
|
|
// send
|
|
|
|
|
m_IsSending = true; |
|
|
|
@ -1180,6 +1180,7 @@ namespace transport
@@ -1180,6 +1180,7 @@ namespace transport
|
|
|
|
|
{ |
|
|
|
|
m_NTCP2V6Acceptor->open (boost::asio::ip::tcp::v6()); |
|
|
|
|
m_NTCP2V6Acceptor->set_option (boost::asio::ip::v6_only (true)); |
|
|
|
|
m_NTCP2V6Acceptor->set_option (boost::asio::socket_base::reuse_address (true)); |
|
|
|
|
m_NTCP2V6Acceptor->bind (boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v6(), address->port)); |
|
|
|
|
m_NTCP2V6Acceptor->listen (); |
|
|
|
|
|
|
|
|
|