|
@ -419,8 +419,8 @@ void PeerHandshake::transition(boost::system::error_code _ech) |
|
|
{ |
|
|
{ |
|
|
clog(NetConnect) << "devp2p.connect.ingress recving auth"; |
|
|
clog(NetConnect) << "devp2p.connect.ingress recving auth"; |
|
|
// ingress: rx auth
|
|
|
// ingress: rx auth
|
|
|
authCipher.resize(321); |
|
|
authCipher.resize(307); |
|
|
ba::async_read(*socket, ba::buffer(authCipher, 321), [this, self](boost::system::error_code ec, std::size_t) |
|
|
ba::async_read(*socket, ba::buffer(authCipher, 307), [this, self](boost::system::error_code ec, std::size_t) |
|
|
{ |
|
|
{ |
|
|
if (ec) |
|
|
if (ec) |
|
|
transition(ec); |
|
|
transition(ec); |
|
@ -457,8 +457,8 @@ void PeerHandshake::transition(boost::system::error_code _ech) |
|
|
{ |
|
|
{ |
|
|
clog(NetConnect) << "devp2p.connect.egress recving ack"; |
|
|
clog(NetConnect) << "devp2p.connect.egress recving ack"; |
|
|
// egress: rx ack
|
|
|
// egress: rx ack
|
|
|
ackCipher.resize(225); |
|
|
ackCipher.resize(210); |
|
|
ba::async_read(*socket, ba::buffer(ackCipher, 225), [this, self](boost::system::error_code ec, std::size_t) |
|
|
ba::async_read(*socket, ba::buffer(ackCipher, 210), [this, self](boost::system::error_code ec, std::size_t) |
|
|
{ |
|
|
{ |
|
|
if (ec) |
|
|
if (ec) |
|
|
transition(ec); |
|
|
transition(ec); |
|
@ -532,14 +532,22 @@ void PeerHandshake::transition(boost::system::error_code _ech) |
|
|
bytesConstRef(&ingressCipher).copyTo(keyMaterial.cropped(h256::size, ingressCipher.size())); |
|
|
bytesConstRef(&ingressCipher).copyTo(keyMaterial.cropped(h256::size, ingressCipher.size())); |
|
|
k->ingressMac = sha3(keyMaterial); |
|
|
k->ingressMac = sha3(keyMaterial); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// This test will be replaced with protocol-capabilities information (was Hello packet)
|
|
|
// This test will be replaced with protocol-capabilities information (was Hello packet)
|
|
|
// TESTING: send encrypt magic sequence
|
|
|
// TESTING: send encrypt magic sequence
|
|
|
bytes magic {0x22,0x40,0x08,0x91}; |
|
|
bytes magic {0x22,0x40,0x08,0x91}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// rlpx encrypt
|
|
|
encryptSymNoAuth(k->encryptK, &magic, k->magicCipherAndMac, h128()); |
|
|
encryptSymNoAuth(k->encryptK, &magic, k->magicCipherAndMac, h128()); |
|
|
k->magicCipherAndMac.resize(k->magicCipherAndMac.size() + 32); |
|
|
k->magicCipherAndMac.resize(k->magicCipherAndMac.size() + 32); |
|
|
sha3mac(k->egressMac.ref(), &magic, k->egressMac.ref()); |
|
|
sha3mac(k->egressMac.ref(), &magic, k->egressMac.ref()); |
|
|
k->egressMac.ref().copyTo(bytesRef(&k->magicCipherAndMac).cropped(k->magicCipherAndMac.size() - 32, 32)); |
|
|
k->egressMac.ref().copyTo(bytesRef(&k->magicCipherAndMac).cropped(k->magicCipherAndMac.size() - 32, 32)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
clog(NetConnect) << "devp2p.connect.egress txrx magic sequence"; |
|
|
clog(NetConnect) << "devp2p.connect.egress txrx magic sequence"; |
|
|
k->recvdMagicCipherAndMac.resize(k->magicCipherAndMac.size()); |
|
|
k->recvdMagicCipherAndMac.resize(k->magicCipherAndMac.size()); |
|
|
|
|
|
|
|
|