diff --git a/router/java/src/net/i2p/router/tunnel/pool/BuildMessageGenerator.java b/router/java/src/net/i2p/router/tunnel/pool/BuildMessageGenerator.java index b000cd73f42e7a6b94150a557cc32ea6a898ad1d..7715cf64193163b4f2df9a3c82e5b42abb78ce5a 100644 --- a/router/java/src/net/i2p/router/tunnel/pool/BuildMessageGenerator.java +++ b/router/java/src/net/i2p/router/tunnel/pool/BuildMessageGenerator.java @@ -196,7 +196,7 @@ abstract class BuildMessageGenerator { key = cfg.getChaChaReplyKey(j); iv = chachaIV; // slot number, little endian - iv[0] = (byte) i; + iv[4] = (byte) i; ChaCha20.encrypt(key.getData(), iv, data, 0, data, 0, size); } else { key = cfg.getAESReplyKey(j); diff --git a/router/java/src/net/i2p/router/tunnel/pool/BuildMessageProcessor.java b/router/java/src/net/i2p/router/tunnel/pool/BuildMessageProcessor.java index 028de88710d3b0f22afd947f92b05848878819ae..00373a4f343c6087f97d5bb3c2e10d12877cfa56 100644 --- a/router/java/src/net/i2p/router/tunnel/pool/BuildMessageProcessor.java +++ b/router/java/src/net/i2p/router/tunnel/pool/BuildMessageProcessor.java @@ -164,7 +164,7 @@ class BuildMessageProcessor { // encrypt in-place, corrupts SDS byte[] bytes = data.getData(); // slot number, little endian - iv[0] = (byte) i; + iv[4] = (byte) i; ChaCha20.encrypt(replyKey, iv, bytes, 0, bytes, 0, ShortEncryptedBuildRecord.LENGTH); } } diff --git a/router/java/src/net/i2p/router/tunnel/pool/BuildReplyHandler.java b/router/java/src/net/i2p/router/tunnel/pool/BuildReplyHandler.java index fba4cb490f14f7c8b64287384142e82942707eec..c7214063571a8e6c9cc7bee31b9318dd127b8dfc 100644 --- a/router/java/src/net/i2p/router/tunnel/pool/BuildReplyHandler.java +++ b/router/java/src/net/i2p/router/tunnel/pool/BuildReplyHandler.java @@ -131,7 +131,7 @@ class BuildReplyHandler { + Base64.encode(replyKey) + " : " + cfg); } // slot number, little endian - iv[0] = (byte) recordNum; + iv[4] = (byte) recordNum; ChaCha20.encrypt(replyKey, iv, data, 0, data, 0, ShortEncryptedBuildRecord.LENGTH); } } else {