On Thu, 20 Nov 2025 05:06:08 GMT, Jiangli Zhou <[email protected]> wrote:
>> test/jdk/com/sun/crypto/provider/Cipher/AES/TestAesGcmIntrinsic.java line 96:
>>
>>> 94: byte[] message = randBytes(messageSize);
>>> 95: try {
>>> 96: byte[] ciphertext = gcmEncrypt(key, message, aad);
>>
>> I believe it makes sense to check that round-trip is successful, e.g. that
>> `decrypt(encrypt(message)) == message`. Currently we implicitly rely on
>> exceptions being thrown from the incorrectly executing code, which is IMO
>> too weak -- in the boundary conditions like these, there might be bugs that
>> _do not_ manifest in visible exceptions, and just the encryption is subtly
>> broken.
>
> That's a good idea. I added decrypt part and the check as suggested.
With the changes, there were more common parts in the test. I moved common code
into helper methods.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28363#discussion_r2544350223