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

Kevin Driver kdriver at openjdk.org
Fri Aug 30 23:26:14 UTC 2024


On Wed, 28 Aug 2024 23:08:17 GMT, Valerie Peng <valeriep at openjdk.org> wrote:

>> src/java.base/share/classes/com/sun/crypto/provider/HkdfKeyDerivation.java line 183:
>> 
>>> 181:             // perform expand
>>> 182:             try {
>>> 183:                 return Arrays.copyOf(hkdfExpand(pseudoRandomKey, info, length),
>> 
>> If the requested `length` happens to be multiples of `hmacLen`, then we can return the output of `hkdfExpand()` directly. No need for `Arrays.copyOf()`.
>
> Since the desired length is passed into `hkdfExpand()` method, why not make `hkdfExpand()` return the output with the requested length?

See: https://github.com/openjdk/jdk/pull/20301/commits/25c17b26231b2b63bab9193fe29c7c258f96a31f

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

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


More information about the security-dev mailing list