Skip to content

Commit 0098895

Browse files
author
gefeili
committed
Fix the bug in CipherTest.checkAEADParemeter
1 parent 806a465 commit 0098895

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/src/test/java/org/bouncycastle/crypto/test/CipherTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ static void checkAEADParemeter(SimpleTest test, int keySize, int ivSize, final i
275275
}
276276
int len = cipher.processBytes(plaintext, 0, plaintext.length, ciphertext1, 0);
277277
len += cipher.doFinal(ciphertext1, len);
278-
int aadSplit = random.nextInt(99);
278+
int aadSplit = random.nextInt(aad.length);
279279
cipher.init(true, new AEADParameters(new KeyParameter(key), macSize * 8, iv, Arrays.copyOf(aad, aadSplit)));
280280
cipher.processAADBytes(aad, aadSplit, aad.length - aadSplit);
281281
byte[] ciphertext2 = new byte[cipher.getOutputSize(plaintext.length)];

0 commit comments

Comments
 (0)