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

Weijun Wang weijun at openjdk.org
Thu Oct 3 12:52:07 UTC 2024


On Wed, 2 Oct 2024 22:14:39 GMT, Kevin Driver <kdriver at openjdk.org> wrote:

>> Introduce an API for Key Derivation Functions (KDFs), which are cryptographic algorithms for deriving additional keys from a secret key and other data. See [JEP 478](https://openjdk.org/jeps/478).
>> 
>> Work was begun in [another PR](https://github.com/openjdk/jdk/pull/18924).
>
> Kevin Driver has updated the pull request incrementally with one additional commit since the last revision:
> 
>   revamped test to be a testng test and run 1 million iterations to try to demonstrate robustness

test/jdk/javax/crypto/KDF/KDFDelayedProviderThreadingTest.java line 71:

> 69:         }).start();
> 70:         new Thread(() -> k.getProviderName()).start();
> 71:         System.out.println(Arrays.toString(k.deriveData(input)));

Thanks for including this test. Two comments:

1. There is no need to print out here, especially you're running it for a million times.
2. The most important thing about this test is to make sure the provider is only chosen once so the 2 `deriveData` calls here should either always succeed or always fail. Now that you are running it a million times, there is a chance that the 2nd thread got the lock first and the 1st provider is chosen and both `deriveData` would fail.

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

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


More information about the security-dev mailing list