decrypt frames correctly and set return address

This commit is contained in:
Jeff Becker 2018-09-17 20:18:33 -04:00
parent dc3bb02f94
commit 9ee7275a02
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05
2 changed files with 7 additions and 5 deletions

View File

@ -201,8 +201,9 @@ namespace llarp
service::ProtocolMessage *msg) service::ProtocolMessage *msg)
{ {
EnsureReplyPath(msg->sender); EnsureReplyPath(msg->sender);
service::Address addr;
uint32_t themIP = ObtainIPForAddr(msg->sender.Addr()); msg->sender.CalculateAddress(addr.data());
uint32_t themIP = ObtainIPForAddr(addr);
uint32_t usIP = m_OurIP; uint32_t usIP = m_OurIP;
auto buf = llarp::Buffer(msg->payload); auto buf = llarp::Buffer(msg->payload);
if(m_NetworkToUserPktQueue.EmplaceIf( if(m_NetworkToUserPktQueue.EmplaceIf(

View File

@ -155,9 +155,10 @@ namespace llarp
const byte_t* sharedkey, const byte_t* sharedkey,
ProtocolMessage& msg) const ProtocolMessage& msg) const
{ {
msg.PutBuffer(D.Buffer()); Encrypted tmp = D;
auto buf = llarp::Buffer(msg.payload); auto buf = tmp.Buffer();
return crypto->xchacha20(buf, sharedkey, N); crypto->xchacha20(*buf, sharedkey, N);
return msg.BDecode(buf);
} }
bool bool