RFR: 8331008: Implement JEP 478: Key Derivation Function API (Preview) [v40]
Kevin Driver
kdriver at openjdk.org
Tue Sep 17 20:58:49 UTC 2024
On Tue, 17 Sep 2024 07:08:16 GMT, Viktor Klang <vklang at openjdk.org> wrote:
>> src/java.base/share/classes/com/sun/crypto/provider/HKDFKeyDerivation.java line 86:
>>
>>> 84: }
>>> 85: // added to enforce valid values at reviewer's request
>>> 86: if (!Arrays.asList(SUPPORTED_HMAC_SIZES).contains(hmacLen)) {
>>
>> Since the array of SUPPORTED_HMAC_SIZES is ordered in ascending natural order, you don't need to wrap it as a list to check for contains:
>> Suggestion:
>>
>> if (Arrays.binarySearch(SUPPORTED_HMAC_SIZES, hmacLen) < 0) {
>
> (Also, it could be an `int[]` instead of `Integer[]` in that case)
@viktorklang-ora: I went with your proposal: https://github.com/openjdk/jdk/pull/20301/commits/ed6132c8db761e8dfdba6a6689c3ed5141c9e148.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20301#discussion_r1764004860
More information about the security-dev
mailing list