RFR: JDK-8338587 - Internal XOF Methods for SHAKE128 and SHAKE256

Ferenc Rakoczi duke at openjdk.org
Mon Aug 26 14:28:06 UTC 2024


On Sat, 24 Aug 2024 19:30:03 GMT, Weijun Wang <weijun at openjdk.org> wrote:

>> In preparation for the new PQC algorithms implementations, internal XOF (eXtendable Output Function) methods are added to the SHAKE128 and SHAKE256 implementations.
>
> src/java.base/share/classes/sun/security/provider/SHA3.java line 171:
> 
>> 169:         int availableBytes = blockSize - squeezeOffset;
>> 170: 
>> 171:         if (availableBytes == 0) {
> 
> Is this check really necessary? It looks like in the `while (numBytes > availableBytes)` loop below no byte will be copied in the 1st round and `keccak` will be called anyway.

Yes, you are right. I delete the check.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20631#discussion_r1731331822



More information about the security-dev mailing list