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

Kevin Driver kdriver at openjdk.org
Fri Aug 30 18:22:14 UTC 2024


On Thu, 22 Aug 2024 21:05:09 GMT, Valerie Peng <valeriep at openjdk.org> wrote:

>> Kevin Driver has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   addresses delayed provider selection where parameters are involved
>
> src/java.base/share/classes/javax/crypto/KDF.java line 104:
> 
>> 102: 
>> 103:     // The provider implementation (delegate)
>> 104:     private KDFSpi spi;
> 
> Given these two are always updated together, maybe we can group them in a Record? Something like 
> 
>>     record Delegate(KDFSpi spi, Provider provider) {}
> 
> This way, you can merge spi+provider and firstSpi+firstProvider into 2 Delegate objects.
> Also, we only synchronize on the `lock` when setting the mutable fields such as spi, we may have to mark the mutable fields volatile? I recall there is some concurrency design patterns when doing lazy initialization.

Added the `record` in https://github.com/openjdk/jdk/pull/20301/commits/4a0bc0ef28ebbe8c5f22b3a5540725e3b4339c2e. Please review and indicate if resolved. Will investigate `volatile` separately.

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

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


More information about the security-dev mailing list