RFR: 8357466: Create test for Ciphers that are using ByteBuffers backed by MemorySegments

Mikhail Yankelevich myankelevich at openjdk.org
Mon Sep 1 13:12:47 UTC 2025


On Wed, 27 Aug 2025 18:09:55 GMT, Matthew Donovan <mdonovan at openjdk.org> wrote:

> This PR extends security tests to use ByteBuffers backed by MemorySegments. Tests in the areas of Signature, Cipher, MessageDigest, and Mac are updated.

Looks good, just one comment and a few nitpicks. IMO nits are not worth doing unless there is another commit.

test/jdk/javax/crypto/Cipher/GCMAPI.java line 32:

> 30: 
> 31: import javax.crypto.*;
> 32: import javax.crypto.spec.*;

Nit: Could you please remove the wildcard import here and from other files touched?

test/jdk/javax/crypto/Cipher/GCMAPI.java line 72:

> 70:         updateAADPass(bb);
> 71: 
> 72:         try(Arena arena = Arena.ofConfined()) {

nit: 
Suggestion:

        try (Arena arena = Arena.ofConfined()) {


The same for: 
* `test/jdk/javax/crypto/Mac/ByteBuffers.java`
* `test/jdk/javax/crypto/CipherSpi/DirectBBRemaining.java`
* `test/jdk/javax/crypto/Cipher/ByteBuffers.java`
* `test/jdk/java/security/MessageDigest/ByteBuffers.java`
* `test/jdk/sun/security/pkcs11/Signature/ByteBuffers.java`
* `test/jdk/sun/security/pkcs11/Cipher/TestPaddingOOB.java`
* `test/jdk/sun/security/pkcs11/Cipher/TestSymmCiphers.java`
* `test/jdk/sun/security/pkcs11/MessageDigest/ByteBuffers.java`

test/jdk/sun/security/pkcs11/Cipher/TestSymmCiphers.java line 215:

> 213:     }
> 214: 
> 215:     private static void execTest(Cipher cipher, byte[]answer,

nit: 

Suggestion:

    private static void execTest(Cipher cipher, byte[] answer,

-------------

PR Review: https://git.openjdk.org/jdk/pull/26967#pullrequestreview-3173544064
PR Review Comment: https://git.openjdk.org/jdk/pull/26967#discussion_r2313919152
PR Review Comment: https://git.openjdk.org/jdk/pull/26967#discussion_r2313877756
PR Review Comment: https://git.openjdk.org/jdk/pull/26967#discussion_r2313872253


More information about the security-dev mailing list