RFR: 8331008: Implement JEP 478: Key Derivation Function API (Preview) [v40]

Viktor Klang vklang at openjdk.org
Tue Sep 17 07:11:31 UTC 2024


On Tue, 17 Sep 2024 07:06:14 GMT, Viktor Klang <vklang at openjdk.org> wrote:

>> Kevin Driver has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   IDE formatting broke snippet
>
> 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)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20301#discussion_r1762511733


More information about the security-dev mailing list