From 1671e3b126e0a14c5346b4aa4cb6d2182d13eca7 Mon Sep 17 00:00:00 2001 From: zzz Date: Sun, 24 Jun 2012 19:23:05 +0000 Subject: [PATCH] Fix bad size estimate when tags are included in the AES block, resulting in trailing zeros after the random padding in the unencrypted AES data block. The number of zeros equaled the number of tags included (typ. 6 or 40). As the data size is rounded up to the next multiple of 16, this increased the size of the data by 0, 16, 32, or 48 bytes when tags were included. Bug introduced 2004-10-30. --- core/java/src/net/i2p/crypto/ElGamalAESEngine.java | 1 - 1 file changed, 1 deletion(-) diff --git a/core/java/src/net/i2p/crypto/ElGamalAESEngine.java b/core/java/src/net/i2p/crypto/ElGamalAESEngine.java index c31a20482..8b6cce5f1 100644 --- a/core/java/src/net/i2p/crypto/ElGamalAESEngine.java +++ b/core/java/src/net/i2p/crypto/ElGamalAESEngine.java @@ -599,7 +599,6 @@ public class ElGamalAESEngine { //_log.debug("Encrypting AES"); if (tagsForDelivery == null) tagsForDelivery = Collections.EMPTY_SET; int size = 2 // sizeof(tags) - + tagsForDelivery.size() + SessionTag.BYTE_LENGTH*tagsForDelivery.size() + 4 // payload length + Hash.HASH_LENGTH