Prop. 157 fix for ChaCha20 IV

after testing with i2pd
This commit is contained in:
zzz
2021-07-22 15:15:26 -04:00
parent 2b3a0f0232
commit 24ef2b5189
3 changed files with 3 additions and 3 deletions

View File

@@ -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);

View File

@@ -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);
}
}

View File

@@ -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 {