|
|
|
@ -356,9 +356,11 @@ namespace llarp
|
|
|
|
|
Path::HandleUpstream(llarp_buffer_t buf, const TunnelNonce& Y,
|
|
|
|
|
llarp_router* r)
|
|
|
|
|
{
|
|
|
|
|
TunnelNonce n = Y;
|
|
|
|
|
for(const auto& hop : hops)
|
|
|
|
|
{
|
|
|
|
|
r->crypto.xchacha20(buf, hop.shared, Y);
|
|
|
|
|
r->crypto.xchacha20(buf, hop.shared, n);
|
|
|
|
|
n ^= hop.nonceXOR;
|
|
|
|
|
}
|
|
|
|
|
RelayUpstreamMessage* msg = new RelayUpstreamMessage;
|
|
|
|
|
msg->X = buf;
|
|
|
|
@ -382,9 +384,11 @@ namespace llarp
|
|
|
|
|
Path::HandleDownstream(llarp_buffer_t buf, const TunnelNonce& Y,
|
|
|
|
|
llarp_router* r)
|
|
|
|
|
{
|
|
|
|
|
TunnelNonce n = Y;
|
|
|
|
|
for(const auto& hop : hops)
|
|
|
|
|
{
|
|
|
|
|
r->crypto.xchacha20(buf, hop.shared, Y);
|
|
|
|
|
n ^= hop.nonceXOR;
|
|
|
|
|
r->crypto.xchacha20(buf, hop.shared, n);
|
|
|
|
|
}
|
|
|
|
|
return HandleRoutingMessage(buf, r);
|
|
|
|
|
}
|
|
|
|
|