forked from I2P_Developers/i2p.i2p
Prop. 157 fix for ChaCha20 IV
after testing with i2pd
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user