Re: RFR: 8318756 Create better internal buffer for AEADs [v6]

2023-12-08 Thread Anthony Scarpino
On Wed, 6 Dec 2023 16:48:57 GMT, Anthony Scarpino wrote: >> Hi, >> >> I need a review for a new internal buffer class called AEADBufferStream. >> AEADBufferStream extends ByteArrayOutputStream, but eliminates some data >> checking and copying that are not necessary for what GaloisCounterMode.

Re: RFR: 8318756 Create better internal buffer for AEADs

2023-12-08 Thread Eirik Bjorsnos
On Thu, 23 Nov 2023 01:04:15 GMT, Anthony Scarpino wrote: >> Hi, >> >> I need a review for a new internal buffer class called AEADBufferStream. >> AEADBufferStream extends ByteArrayOutputStream, but eliminates some data >> checking and copying that are not necessary for what GaloisCounterMod

Re: RFR: 8318756 Create better internal buffer for AEADs [v6]

2023-12-06 Thread Daniel Jeliński
On Wed, 6 Dec 2023 16:48:57 GMT, Anthony Scarpino wrote: >> Hi, >> >> I need a review for a new internal buffer class called AEADBufferStream. >> AEADBufferStream extends ByteArrayOutputStream, but eliminates some data >> checking and copying that are not necessary for what GaloisCounterMode.

Re: RFR: 8318756 Create better internal buffer for AEADs [v6]

2023-12-06 Thread Anthony Scarpino
> Hi, > > I need a review for a new internal buffer class called AEADBufferStream. > AEADBufferStream extends ByteArrayOutputStream, but eliminates some data > checking and copying that are not necessary for what GaloisCounterMode.java > and ChaCha20Cipher.java need. > > The changes greates

Re: RFR: 8318756 Create better internal buffer for AEADs [v5]

2023-12-06 Thread Anthony Scarpino
> Hi, > > I need a review for a new internal buffer class called AEADBufferStream. > AEADBufferStream extends ByteArrayOutputStream, but eliminates some data > checking and copying that are not necessary for what GaloisCounterMode.java > and ChaCha20Cipher.java need. > > The changes greates

Re: RFR: 8318756 Create better internal buffer for AEADs [v4]

2023-12-06 Thread Anthony Scarpino
On Wed, 6 Dec 2023 07:24:08 GMT, Daniel Jeliński wrote: >> Anthony Scarpino has updated the pull request incrementally with one >> additional commit since the last revision: >> >> update > > src/java.base/share/classes/com/sun/crypto/provider/AEADBufferedStream.java > line 60: > >> 58:

Re: RFR: 8318756 Create better internal buffer for AEADs [v4]

2023-12-05 Thread Daniel Jeliński
On Wed, 6 Dec 2023 03:07:54 GMT, Anthony Scarpino wrote: >> Hi, >> >> I need a review for a new internal buffer class called AEADBufferStream. >> AEADBufferStream extends ByteArrayOutputStream, but eliminates some data >> checking and copying that are not necessary for what GaloisCounterMode.

Re: RFR: 8318756 Create better internal buffer for AEADs [v2]

2023-12-05 Thread Anthony Scarpino
On Mon, 4 Dec 2023 07:08:57 GMT, Daniel Jeliński wrote: >> Anthony Scarpino has updated the pull request incrementally with one >> additional commit since the last revision: >> >> comments update > > src/java.base/share/classes/com/sun/crypto/provider/AEADBufferedStream.java > line 80: > >>

Re: RFR: 8318756 Create better internal buffer for AEADs [v4]

2023-12-05 Thread Anthony Scarpino
> Hi, > > I need a review for a new internal buffer class called AEADBufferStream. > AEADBufferStream extends ByteArrayOutputStream, but eliminates some data > checking and copying that are not necessary for what GaloisCounterMode.java > and ChaCha20Cipher.java need. > > The changes greates

Re: RFR: 8318756 Create better internal buffer for AEADs [v3]

2023-12-05 Thread Anthony Scarpino
On Wed, 6 Dec 2023 02:43:06 GMT, Anthony Scarpino wrote: >> Well, as stated above, any application using CipherInputStream will do O(N) >> reallocations here, bringing back >> [JDK-8298249](https://bugs.openjdk.org/browse/JDK-8298249); you might want >> to check with the reporter if this actua

Re: RFR: 8318756 Create better internal buffer for AEADs [v3]

2023-12-05 Thread Anthony Scarpino
On Tue, 28 Nov 2023 20:30:22 GMT, Anthony Scarpino wrote: >> test/micro/org/openjdk/bench/javax/crypto/full/BenchBase.java line 122: >> >>> 120: public void decrypt() throws Exception { >>> 121: decryptCipher.init(Cipher.DECRYPT_MODE, ks, >>> 122: encryptCipher.getParame

Re: RFR: 8318756 Create better internal buffer for AEADs [v3]

2023-12-05 Thread Anthony Scarpino
On Mon, 4 Dec 2023 07:27:14 GMT, Daniel Jeliński wrote: >> As I understand the `ByteArrayOutputStream` code, the >> `ArraysSupport.newLength()` will double the allocation each time. So if the >> buffer is 1k size and it wants to add one more byte, the method will >> allocate 2k. >> I agree th

Re: RFR: 8318756 Create better internal buffer for AEADs [v3]

2023-12-05 Thread Anthony Scarpino
> Hi, > > I need a review for a new internal buffer class called AEADBufferStream. > AEADBufferStream extends ByteArrayOutputStream, but eliminates some data > checking and copying that are not necessary for what GaloisCounterMode.java > and ChaCha20Cipher.java need. > > The changes greates

Re: RFR: 8318756 Create better internal buffer for AEADs [v2]

2023-12-04 Thread Daniel Jeliński
On Tue, 28 Nov 2023 00:49:49 GMT, Anthony Scarpino wrote: >> src/java.base/share/classes/com/sun/crypto/provider/AEADBufferedStream.java >> line 94: >> >>> 92: } else { >>> 93: if (buf.length < (count + len)) { >>> 94: buf = Arrays.copyOf(buf, count + len);

Re: RFR: 8318756 Create better internal buffer for AEADs [v2]

2023-12-04 Thread Daniel Jeliński
On Fri, 1 Dec 2023 22:42:47 GMT, Anthony Scarpino wrote: >> Hi, >> >> I need a review for a new internal buffer class called AEADBufferStream. >> AEADBufferStream extends ByteArrayOutputStream, but eliminates some data >> checking and copying that are not necessary for what GaloisCounterMode.

Re: RFR: 8318756 Create better internal buffer for AEADs [v2]

2023-12-01 Thread Anthony Scarpino
On Tue, 28 Nov 2023 08:34:21 GMT, Daniel Jeliński wrote: >> The second sentence says what the optimizations is. > > well I was under the impression that the bulk of the optimization comes from > using modified `engineGetOutputSize` that does not allocate when isUpdate== > true and decrypting. T

Re: RFR: 8318756 Create better internal buffer for AEADs [v2]

2023-12-01 Thread Anthony Scarpino
> Hi, > > I need a review for a new internal buffer class called AEADBufferStream. > AEADBufferStream extends ByteArrayOutputStream, but eliminates some data > checking and copying that are not necessary for what GaloisCounterMode.java > and ChaCha20Cipher.java need. > > The changes greates

Re: RFR: 8318756 Create better internal buffer for AEADs

2023-11-29 Thread Anthony Scarpino
On Tue, 28 Nov 2023 08:35:29 GMT, Daniel Jeliński wrote: >> Hi, >> >> I need a review for a new internal buffer class called AEADBufferStream. >> AEADBufferStream extends ByteArrayOutputStream, but eliminates some data >> checking and copying that are not necessary for what GaloisCounterMode.

Re: RFR: 8318756 Create better internal buffer for AEADs

2023-11-28 Thread Anthony Scarpino
On Thu, 23 Nov 2023 12:13:45 GMT, Daniel Jeliński wrote: >> Hi, >> >> I need a review for a new internal buffer class called AEADBufferStream. >> AEADBufferStream extends ByteArrayOutputStream, but eliminates some data >> checking and copying that are not necessary for what GaloisCounterMode.

Re: RFR: 8318756 Create better internal buffer for AEADs

2023-11-28 Thread Daniel Jeliński
On Fri, 3 Nov 2023 04:08:27 GMT, Anthony Scarpino wrote: > Hi, > > I need a review for a new internal buffer class called AEADBufferStream. > AEADBufferStream extends ByteArrayOutputStream, but eliminates some data > checking and copying that are not necessary for what GaloisCounterMode.java

Re: RFR: 8318756 Create better internal buffer for AEADs

2023-11-28 Thread Daniel Jeliński
On Tue, 28 Nov 2023 00:49:58 GMT, Anthony Scarpino wrote: >> src/java.base/share/classes/com/sun/crypto/provider/ChaCha20Cipher.java line >> 792: >> >>> 790: >>> 791: /* >>> 792: * Optimized version of bufferCrypt from CipherSpi.java. Direct >> >> Can you document the optimizations

Re: RFR: 8318756 Create better internal buffer for AEADs

2023-11-28 Thread Daniel Jeliński
On Tue, 28 Nov 2023 01:29:20 GMT, Anthony Scarpino wrote: >> test/micro/org/openjdk/bench/javax/crypto/full/AESGCMBench.java line 43: >> >>> 41: AlgorithmParameterSpec getNewSpec() { >>> 42: iv_index = (iv_index + 1) % IV_MODULO; >>> 43: return new GCMParameterSpec(96, iv, i

Re: RFR: 8318756 Create better internal buffer for AEADs

2023-11-27 Thread Daniel Jeliński
On Tue, 28 Nov 2023 00:51:54 GMT, Anthony Scarpino wrote: >> src/java.base/share/classes/com/sun/crypto/provider/ChaCha20Cipher.java line >> 1427: >> >>> 1425: input.get(in); >>> 1426: byte[] out = new byte[in.length]; >>> 1427: doUpdate(in, 0, in.length, ou

Re: RFR: 8318756 Create better internal buffer for AEADs

2023-11-27 Thread Anthony Scarpino
On Thu, 23 Nov 2023 10:30:52 GMT, Daniel Jeliński wrote: >> Hi, >> >> I need a review for a new internal buffer class called AEADBufferStream. >> AEADBufferStream extends ByteArrayOutputStream, but eliminates some data >> checking and copying that are not necessary for what GaloisCounterMode.

Re: RFR: 8318756 Create better internal buffer for AEADs

2023-11-23 Thread Daniel Jeliński
On Fri, 3 Nov 2023 04:08:27 GMT, Anthony Scarpino wrote: > Hi, > > I need a review for a new internal buffer class called AEADBufferStream. > AEADBufferStream extends ByteArrayOutputStream, but eliminates some data > checking and copying that are not necessary for what GaloisCounterMode.java

RFR: 8318756 Create better internal buffer for AEADs

2023-11-22 Thread Anthony Scarpino
Hi, I need a review for a new internal buffer class called AEADBufferStream. AEADBufferStream extends ByteArrayOutputStream, but eliminates some data checking and copying that are not necessary for what GaloisCounterMode.java and ChaCha20Cipher.java need. The changes greatest benefit is wit

Re: RFR: 8318756 Create better internal buffer for AEADs

2023-11-22 Thread Anthony Scarpino
On Fri, 3 Nov 2023 04:08:27 GMT, Anthony Scarpino wrote: > Hi, > > I need a review for a new internal buffer class called AEADBufferStream. > AEADBufferStream extends ByteArrayOutputStream, but eliminates some data > checking and copying that are not necessary for what GaloisCounterMode.java