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

Sean Mullan mullan at openjdk.org
Mon May 13 20:39:58 UTC 2024


On Thu, 9 May 2024 20:58:00 GMT, Kevin Driver <kdriver at openjdk.org> wrote:

>> src/java.base/share/classes/com/sun/crypto/provider/HkdfKeyDerivation.java line 223:
>> 
>>> 221:         // A switch would be nicer, but we may need to backport this before JDK 17
>>> 222:         // Also, JEP 305 came out in JDK 14, so we can't declare a variable in instanceof either
>>> 223:         if (kdfParameterSpec instanceof HKDFParameterSpec.Extract) {
>> 
>> `kdfParameterSpec instanceof HKDFParameterSpec.Extract anExtract`.
>
> Please read the comment. Avoiding declaring a variable during an `instanceof` check was intentional, since this will aid with backporting. I'm not sure how far back we'll have to port this.

We should take advantage of newer language features and APIs in the implementation when it simplifies or improves the code. We already are well prepared to handle these cases for other backports. Depending on newer language features or APIs is specific to the API as that could prevent or make it much more difficult to backport.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18924#discussion_r1599032897



More information about the security-dev mailing list