mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 23:34:52 +02:00
8279800: isAssignableFrom checks in AlgorithmParametersSpi.engineGetParameterSpec appear to be backwards
Reviewed-by: xuelei, valeriep
This commit is contained in:
parent
1228b2f1f8
commit
cb25029885
15 changed files with 141 additions and 191 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -101,7 +101,7 @@ public class DSAParameters extends AlgorithmParametersSpi {
|
|||
try {
|
||||
Class<?> dsaParamSpec = Class.forName
|
||||
("java.security.spec.DSAParameterSpec");
|
||||
if (dsaParamSpec.isAssignableFrom(paramSpec)) {
|
||||
if (paramSpec.isAssignableFrom(dsaParamSpec)) {
|
||||
return paramSpec.cast(
|
||||
new DSAParameterSpec(this.p, this.q, this.g));
|
||||
} else {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -180,7 +180,7 @@ public final class PSSParameters extends AlgorithmParametersSpi {
|
|||
protected <T extends AlgorithmParameterSpec>
|
||||
T engineGetParameterSpec(Class<T> paramSpec)
|
||||
throws InvalidParameterSpecException {
|
||||
if (PSSParameterSpec.class.isAssignableFrom(paramSpec)) {
|
||||
if (paramSpec.isAssignableFrom(PSSParameterSpec.class)) {
|
||||
return paramSpec.cast(spec);
|
||||
} else {
|
||||
throw new InvalidParameterSpecException
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -111,7 +111,7 @@ public final class GCMParameters extends AlgorithmParametersSpi {
|
|||
T engineGetParameterSpec(Class<T> paramSpec)
|
||||
throws InvalidParameterSpecException {
|
||||
|
||||
if (GCMParameterSpec.class.isAssignableFrom(paramSpec)) {
|
||||
if (paramSpec.isAssignableFrom(GCMParameterSpec.class)) {
|
||||
return paramSpec.cast(new GCMParameterSpec(tLen * 8, iv));
|
||||
} else {
|
||||
throw new InvalidParameterSpecException
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue