Skip to content

Commit 5c2b6ee

Browse files
committed
corrected overlap test to use doFinal(), oh dear...
1 parent de42702 commit 5c2b6ee

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

prov/src/test/java/org/bouncycastle/jce/provider/test/BlockCipherTest.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1760,6 +1760,7 @@ private void testIncorrectCipherModes()
17601760
}
17611761

17621762
public void performTest()
1763+
throws Exception
17631764
{
17641765
for (int i = 0; i != cipherTests1.length; i += 2)
17651766
{
@@ -1828,6 +1829,7 @@ private void doFinalTest()
18281829
}
18291830

18301831
private void testOverlapping()
1832+
throws Exception
18311833
{
18321834
//Skip the dofinal of the test
18331835
BufferedBlockCipher bc = new BufferedBlockCipher(AESEngine.newInstance());
@@ -1842,9 +1844,12 @@ private void testOverlapping()
18421844
random.nextBytes(data);
18431845

18441846
bc.init(true, key);
1845-
bc.processBytes(data, 0, bc.getBlockSize() * 2 + 1, expected, 0);
1847+
int r = bc.processBytes(data, 0, bc.getBlockSize() * 2, expected, 0);
1848+
r += bc.doFinal(expected, r);
1849+
18461850
bc.init(true, key);
1847-
bc.processBytes(data, 0, bc.getBlockSize() * 2 + 1, data, offset);
1851+
r = bc.processBytes(data, 0, bc.getBlockSize() * 2, data, offset);
1852+
r += bc.doFinal(data, r + offset);
18481853

18491854
if (!areEqual(expected, Arrays.copyOfRange(data, offset, offset + bc.getBlockSize() * 2)))
18501855
{

0 commit comments

Comments
 (0)