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

Volodymyr Paprotski duke at openjdk.org
Thu Dec 1 16:59:12 UTC 2022


> Regarding mainline:
> - I decided not to 'unroll' the top while loop (i.e. `engineUpdate(byte[] input, int offset, int len)` is unrolled)
>    - It is debatable which version is easier to understand. If this version is 'too complex', I can unroll the top while loop. 
> - I do think this version is incremental (i.e. easier to review?):
>    - Move `remaining -= bytesToWrite;` into each `if` branch
>    - Change first `if` case to process multiple blocks instead of one
> 
> This `while` loop has a lot of cases to remember; Very roughly:
> 
> 1. process from previous call
> 2. process current data
> 3. store overflow
> 
> Interesting situations:
> - `blockOffset` might be non-`0`
> - `remaining+blockOffset` might not be enough to fill a single block. Or just enough for one block and to leave an overflow again..
> - etc.
> 
> Regarding testing
> - Correctness of intrinsic was already tested in https://github.com/openjdk/jdk/pull/10582 so not adding any tests there (i.e. no KAT)
> - In principle, fuzz test should also be sufficient to test bytebuffer (did increase repetitions)

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 four additional commits since the last revision:

 - 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/b31d7902..e307e344

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

  Stats: 13608 lines in 487 files changed: 8557 ins; 2924 del; 2127 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