On Mon, 23 Sep 2024 20:16:49 GMT, Kevin Driver <kdri...@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: > > additional DPS tests, removal of private method src/java.base/share/classes/javax/crypto/KDF.java line 546: > 544: if (checkSpiNonNull(theOne)) return; > 545: > 546: synchronized (lock) { Sorry I missed this last time. The `if (checkSpiNonNull(theOne)` check also must be repeated inside the `synchronized` block. Suppose 2 threads, one calling `deriveData` and one calling `getProviderName`, are running at the same time. Both start with `theOne` being null and reach the block. The `deriveData` thread gets the lock, chooses a provider, and assigns `theOne`. When it releases the lock the `getProviderName` thread enters this block and updated `theOne`. This should not happen. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/20301#discussion_r1773827647