On Fri, 13 Sep 2024 22:36:15 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:
> 
>   remove unused debug field

src/java.base/share/classes/javax/crypto/KDF.java line 670:

> 668:             }
> 669:         }
> 670:         throw new InvalidAlgorithmParameterException(

Should this ever happen? We already made sure `firstPairOfSpiAndProv` is for 
this algorithm and we have tried calling `deriveXyz` on it. Therefore there 
must be a `lastException` now. In the lines above, you checked two types of 
`lastException`. Is that exhaustive? If not, can you wrap it into an IAPE and 
throw it there?

Also, even if `deriveXyz` finally fails, we still have to complete the DPS 
process, i.e. assign something to `pairOfSpiAndProv`, since DPS should only be 
run once. Later calls to `getProviderName` still need a return value.

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

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

Reply via email to