RFR: 8279800: isAssignableFrom checks in AlgorithmParametersSpi.engineGetParameterSpec appear to be backwards
Xue-Lei Andrew Fan
xuelei at openjdk.java.net
Wed Jan 12 06:22:23 UTC 2022
On Tue, 11 Jan 2022 20:38:30 GMT, Weijun Wang <weijun at openjdk.org> wrote:
> Change the order so parent class is at the left.
Hm, an interesting catch. I have a concern, although.
src/java.base/share/classes/com/sun/crypto/provider/BlockCipherParamsCore.java line 111:
> 109: <T extends AlgorithmParameterSpec> T getParameterSpec(Class<T> paramSpec)
> 110: throws InvalidParameterSpecException {
> 111: if (paramSpec.isAssignableFrom(IvParameterSpec.class)) {
The call to cast() is confusing. But if the paramSpec is AlgorithmParameterSpec.class or Object.class, what's the expected behavior? There are potential casting exception, I guess. Maybe, a exactly class matching could be better.
-------------
Changes requested by xuelei (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/7037
More information about the security-dev
mailing list