RFR: 8255557: Decouple GCM from CipherCore [v4]

Anthony Scarpino ascarpino at openjdk.java.net
Wed Jun 2 16:30:42 UTC 2021


On Thu, 20 May 2021 19:06:31 GMT, Valerie Peng <valeriep at openjdk.org> wrote:

>> Anthony Scarpino has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Fix perf problem by reorganizing doLastBlock()
>
> src/java.base/share/classes/com/sun/crypto/provider/GaloisCounterMode.java line 1055:
> 
>> 1053:                 // remainder offset is based on original buffer length
>> 1054:                 ibuffer.write(in, inOfs + inLen, remainder);
>> 1055:             }
> 
> I wonder if these update(byte[], int, int, byte[], int) calls (such as the one on line 1045) should take ibuffer and stores the unprocessed bytes into it. This way seems more robust and you won't need separate logic. Same comment for the doUpdate() taking ByteBuffer arguments.

Do you mean having all the GCM interface implementations have an argument that takes ibuffer and adds any unprocessed data into?  Maybe it would save a copy of the code, but I'm not sure I like GCTR or GHASH adding data into the ibuffer.

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

PR: https://git.openjdk.java.net/jdk/pull/4072



More information about the security-dev mailing list