RFR: 8297379: Enable the ByteBuffer path of Poly1305 optimizations [v4]

Volodymyr Paprotski duke at openjdk.org
Mon Dec 5 22:05:51 UTC 2022


> There is now an intrinsic for Poly1305, which is only enabled on the `engineUpdate([]byte)` path. This PR adds intrinsic support `engineUpdate(ByteBuffer)` (when the bytebuffer `hasArray`).
> 
> Fuzzing test expanded to also include ByteBuffer payloads.
> 
> Performance is now matched:
> 
> Benchmark                         (dataSize)  (provider)   Mode  Cnt        Score        Error  Units
> Poly1305DigestBench.digestBuffer          64              thrpt    3  3320909.857 ± 787300.545  ops/s
> Poly1305DigestBench.digestBuffer         256              thrpt    3  3006447.324 ± 704790.796  ops/s
> Poly1305DigestBench.digestBuffer        1024              thrpt    3  2645041.509 ± 664904.622  ops/s
> Poly1305DigestBench.digestBuffer       16384              thrpt    3   893389.209 ±   6288.743  ops/s
> Poly1305DigestBench.digestBuffer     1048576              thrpt    3    14932.680 ±    170.238  ops/s
> Poly1305DigestBench.digestBytes           64              thrpt    3  3548298.515 ± 859964.530  ops/s
> Poly1305DigestBench.digestBytes          256              thrpt    3  3083261.994 ± 141802.417  ops/s
> Poly1305DigestBench.digestBytes         1024              thrpt    3  2704357.584 ± 554683.019  ops/s
> Poly1305DigestBench.digestBytes        16384              thrpt    3   898913.339 ±  99733.295  ops/s
> Poly1305DigestBench.digestBytes      1048576              thrpt    3    14961.872 ±     38.003  ops/s
> Finished running test 'micro:org.openjdk.bench.javax.crypto.full.Poly1305DigestBench'
> 
> Relates to:
> - https://github.com/openjdk/jdk/pull/11463: Found inconsistency between processing `[]byte` and `ByteBuffer`. When that one is fixed, `Poly1305IntrinsicFuzzTest.java` should not be setting the endianness on the `ByteBuffer`
> - Intrinsic introduced by https://github.com/openjdk/jdk/pull/10582.

Volodymyr Paprotski has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains six additional commits since the last revision:

 - Merge remote-tracking branch 'origin/master' into avx512-poly-buf
 - remove comment
 - bench and handle buf.position()
 - Merge remote-tracking branch 'origin/master' into avx512-poly-buf
 - whitespace
 - ByteBuffer support and tests

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/11338/files
  - new: https://git.openjdk.org/jdk/pull/11338/files/14726d7b..a87297f3

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=11338&range=03
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11338&range=02-03

  Stats: 45355 lines in 999 files changed: 17638 ins; 21210 del; 6507 mod
  Patch: https://git.openjdk.org/jdk/pull/11338.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/11338/head:pull/11338

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



More information about the security-dev mailing list