RFR: 8297878: KEM: Implementation [v7]

Anthony Scarpino ascarpino at openjdk.org
Thu Apr 27 17:57:24 UTC 2023


On Mon, 24 Apr 2023 19:55:34 GMT, Weijun Wang <weijun at openjdk.org> wrote:

>> 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?

Ok, this is fine, I didn't realize sequential streams were default

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

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



More information about the security-dev mailing list