RFR: 8268427: Improve AlgorithmConstraints:checkAlgorithm performance

Dongbo He dongbohe at openjdk.java.net
Fri Jun 11 03:42:49 UTC 2021


On Thu, 10 Jun 2021 18:10:37 GMT, Sean Mullan <mullan at openjdk.org> wrote:

> I think it would be worthwhile to see if we can take this a step further, and leverage the `Constraint` objects that are already created and stored in the `Constraints` object in a `HashMap<String, List<Constraint>>`. The key is the algorithm `String`, and the value is a `List` of `Constraint` objects that apply to it. If the algorithm is completely disabled, the `List` would contain one entry `Constraint.DisabledConstraint` (which has a `permits` method that always returns `false`).
> 
> This way we could potentially eliminate the List/Set cache entirely and just use the HashMap to check if the algorithm is disabled.

Thanks for the suggestion, `Constraints` is a private inner class in `DisabledAlgorithmConstraints.java` and cannot be accessed in `AbstractAlgorithmConstraints.java:checkAlgorithm`. 
Moreover, this method does not seem to be applicable to class `LegacyAlgorithmConstraints.java`, because there is no `Constraints` object in it.

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

PR: https://git.openjdk.java.net/jdk/pull/4424



More information about the security-dev mailing list