RFR: 8318756 Create better internal buffer for AEADs

Anthony Scarpino ascarpino at openjdk.org
Thu Nov 23 01:11:26 UTC 2023


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 with decryption operations.  ChaCha20-Poly1305 had larger performance gains by adopting similar techniques that AES/GCM already uses. 

The new buffer shows up to 21% bytes/sec performance increase for decryption for ChaCha20-Poly1305 and 12% for AES/GCM.  16K data sizes saw a memory usage reduction of 46% with and 83% with ChaCha20-Poly1305.  These results come from the JMH tests updated in this request and memory usage using the JMH gc profile gc.alloc.rate.norm entry




Commit messages:
 - set default keylength to cc20's
 - redo perf tests
 - cleanup some comments
 - Remove CC20 test after merge
 - Reduce testcases for GCM, middle set not necessary
 - combine buffer test
 - Mostly done
 - CC20 & GCM working
 - merge
 - initial and untested

Changes: https://git.openjdk.org/jdk/pull/16487/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=16487&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8318756
  Stats: 2900 lines in 15 files changed: 1808 ins; 1050 del; 42 mod
  Patch: https://git.openjdk.org/jdk/pull/16487.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/16487/head:pull/16487

PR: https://git.openjdk.org/jdk/pull/16487

More information about the security-dev mailing list