On Mon, 24 Apr 2023 19:36:53 GMT, Weijun Wang <[email protected]> wrote:
>> src/java.base/share/classes/com/sun/crypto/provider/DHKEM.java line 202:
>>
>>> 200: } else {
>>> 201: byte[] uArray = ((XECPublicKey)
>>> k).getU().toByteArray();
>>> 202: return Arrays.copyOf(reverse(uArray), Npk);
>>
>> You could just return the reversed array. It is already a copy of the
>> BigInteger 'u'.
>
> Is the size always `Npk`? It could be less (if small) or bigger (if MSB is 1).
If I understand what your saying, if `Npk` is larger than `uArray`, then
`copyOf()` will pad with zeros at the end. I think that would change the
value. And I don't see why `Npk` would be smaller than `uArray` otherwise this
would be returning an invalid key
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13256#discussion_r1175769576