RFR: 8297878: KEM: Implementation [v7]

Weijun Wang weijun at openjdk.org
Mon Apr 24 19:58:21 UTC 2023


On Mon, 24 Apr 2023 18:11:03 GMT, Anthony Scarpino <ascarpino at openjdk.org> wrote:

>> Weijun Wang has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   fine tuning spec
>
> src/java.base/share/classes/com/sun/crypto/provider/DHKEM.java line 366:
> 
>> 364:     private static byte[] concat(byte[]... inputs) {
>> 365:         ByteArrayOutputStream o = new ByteArrayOutputStream();
>> 366:         Arrays.stream(inputs).forEach(o::writeBytes);
> 
> Unless I'm missing something there is no `stream(byte[])` support, so I'm not sure how this is compiling.  I didn't think  the generics would work with this.
> More importantly, `forEach()` the API states that stream is in a non-deterministic order.  I think you want `forEachOrdered()`

`inputs` is `byte[][]` and there is a `Arrays.stream(T[])`.

The above method says a `sequential Stream` is returned. Does that mean calling `forEach` is safe?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13256#discussion_r1175723152



More information about the security-dev mailing list