RFR: 8284694: Avoid evaluating SSLAlgorithmConstraints twice

Claes Redestad redestad at openjdk.java.net
Wed Apr 13 08:22:14 UTC 2022


On Tue, 12 Apr 2022 11:28:12 GMT, Daniel Jeliński <djelinski at openjdk.org> wrote:

> During TLS handshake, hundreds of constraints are evaluated to determine which cipher suites are usable. Most of the evaluations are performed using `HandshakeContext#algorithmConstraints` object. By default that object contains a `SSLAlgorithmConstraints` instance wrapping another `SSLAlgorithmConstraints` instance. As a result the constraints defined in `SSLAlgorithmConstraints` are evaluated twice.
> 
> This PR improves the default case; if the user-specified constraints are left at defaults, we use a single `SSLAlgorithmConstraints` instance, and avoid duplicate checks.

test/micro/org/openjdk/bench/java/security/SSLHandshake.java line 54:

> 52: @OutputTimeUnit(TimeUnit.SECONDS)
> 53: @State(Scope.Benchmark)
> 54: public class SSLHandshake {

Default number of iterations and forks is usually excessive, I suggest some tuning runs to minimize benchmark execution time, e.g., something like:

@Warmup(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS)
@Measurement(iterations = 5, time = 1000, timeUnit = TimeUnit.MILLISECONDS)
@Fork(3)

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

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



More information about the security-dev mailing list