SSU2: Fixes

Fix conn ids on hole punch
Fix min size on relay response
This commit is contained in:
zzz
2022-06-16 08:16:12 -04:00
parent 0a87559ba2
commit d812f82e92
2 changed files with 3 additions and 3 deletions

View File

@@ -992,8 +992,8 @@ class IntroductionManager {
// send hole punch with the same data we sent to Bob
if (_log.shouldDebug())
_log.debug("Send hole punch to " + Addresses.toString(testIP, testPort));
long rcvId = (nonce << 32) | nonce;
long sendId = ~rcvId;
long sendId = (nonce << 32) | nonce;
long rcvId = ~sendId;
packet = _builder2.buildHolePunch(aliceIP, testPort, aliceIntroKey, sendId, rcvId, data);
_transport.send(packet);
}

View File

@@ -286,7 +286,7 @@ class SSU2Payload {
case BLOCK_RELAYRESP: {
if (isHandshake)
throw new IOException("Illegal block in handshake: " + type);
if (len < 62) // 22 byte data w/ IPv4 + 40 byte DSA sig
if (len < 52) // 12 byte data w/o IP or token + 40 byte DSA sig
throw new IOException("Bad length for RELAYRESP: " + len);
int resp = payload[i + 1] & 0xff; // skip flag
byte[] data = new byte[len - 2];