On Tue, 14 Jun 2022 17:57:17 GMT, Weijun Wang <wei...@openjdk.org> wrote:
> Clearing buffers and temporary arrays to avoid data leaks in cipher > operations. src/java.base/share/classes/com/sun/crypto/provider/GaloisCounterMode.java line 1014: > 1012: dst.flip(); > 1013: originalDst.put(dst); > 1014: dst.clear().put(new byte[dst.capacity()]); If `dst` is an array-backed ByteByffer, could you use `Array.fill` to avoid a memory allocation? It's surprising to me that ByteBuffer doesn't have a method to set all of the bytes in the ByteBuffer. ------------- PR: https://git.openjdk.org/jdk/pull/9158