anchor.diff:      fprof:stop(),
       ok.
   
  -ssl_opts(listen) ->
  -    [{backlog, 500} | ssl_opts("server")];
  -ssl_opts(connect) ->
  -    [{verify, verify_peer} | ssl_opts("client")];
  -ssl_opts(listen_der) ->
  -    [{backlog, 500} | ssl_opts("server_der")];
  -ssl_opts(connect_der) ->
  -    [{verify, verify_peer} | ssl_opts("client_der")];
  -ssl_opts(Role) ->
  -    CertData = cert_data(Role),
  -    Opts = [{active, false},
  -            {depth, 2},
  -            {reuseaddr, true},
  -            {mode,binary},
  -            {nodelay, true},
  -            {ciphers, [{dhe_rsa,aes_256_cbc,sha}]}
  -            |CertData],
  -    case Role of
  -        "client" ++ _ ->
  -            [{server_name_indication, disable} | Opts];
  -        "server" ++ _ ->
  -            Opts
  -    end.
  -
  -cert_data(Der) when Der =:= "server_der"; Der =:= "client_der" ->
  -    [Role,_] = string:tokens(Der, "_"),
  -    Dir = filename:join([code:lib_dir(ssl), "examples", "certs", "etc"]),
  -    {ok, CaCert0} = file:read_file(filename:join([Dir, Role, "cacerts.pem"])),
  -    {ok, Cert0} = file:read_file(filename:join([Dir, Role, "cert.pem"])),
  -    {ok, Key0} = file:read_file(filename:join([Dir, Role, "key.pem"])),
  -    [{_, Cert, _}] = public_key:pem_decode(Cert0),
  -    CaCert1 = public_key:pem_decode(CaCert0),
  -    CaCert = [CCert || {_, CCert, _} <- CaCert1],
  -    [{KeyType, Key, _}] = public_key:pem_decode(Key0),
  -    [{cert, Cert},
  -     {cacerts, CaCert},
  -     {key, {KeyType, Key}}];
  -cert_data(Role) ->
  -    Dir = filename:join([code:lib_dir(ssl), "examples", "certs", "etc"]),
  -    [{cacertfile, filename:join([Dir, Role, "cacerts.pem"])},
  -     {certfile, filename:join([Dir, Role, "cert.pem"])},
  -     {keyfile, filename:join([Dir, Role, "key.pem"])}].
  +ssl_opts(listen, Opts, Certs) ->
  +    [{backlog, 500} | ssl_opts(server_config, Opts, Certs)];
  +ssl_opts(connect, Opts, Certs) ->
  +    [{verify, verify_peer} | ssl_opts(client_config, Opts, Certs)];
  +ssl_opts(Role, TCOpts, Certs) ->
  +    CertData = maps:get(Role, Certs),
  +    {Version, KeyEx} =
  +        case proplists:get_value(version, TCOpts) of
  +            'tlsv1.2' = V -> {V, ecdhe_ecdsa};
  +            'tlsv1.3' = V -> {V, any}
  +        end,
  +    Opts0 = [{active, false},
  +             {depth, 2},
  +             {reuseaddr, true},
  +             {mode,binary},
  +             {nodelay, true},
  +             {versions, [Version]},
  +             {ciphers, [ #{key_exchange => KeyEx, cipher => aes_128_gcm,
  +                           mac => aead, prf => sha256}
  +                       ]}
  +            | CertData ],
  +    Opts1 = case Role of
  +                client_config -> [{server_name_indication, disable} | Opts0];
  +                server_config -> Opts0
  +            end,
  +    Opts = case proplists:get_value(no_reuse, TCOpts) of
  +               true -> [{reuse_sessions, false}|Opts1];
  +               _ -> Opts1
  +           end,
  +    Opts.
  +
  +cert_data() ->
  +    ssl_test_lib:make_cert_chains_der(ecdhe_ecdsa, []).
   
   bypass_pem_cache_supported() ->
       %% This function is currently critical to support cache bypass
  
positive.code: setup_sequential(Config) ->
      Server = proplists:get_value(server_node, Config),
      Server =/= undefined orelse error(no_server),
      {ok, Result} = do_test(ssl, setup_connection, ?COUNT * 20, 1, Server),
      ct_event:notify(#event{name = benchmark_data,
  			   data=[{value, Result},
  				 {suite, "ssl"}, {name, "Sequential setup"}]}),
      ok.
  
  setup_concurrent(Config) ->
      Server = proplists:get_value(server_node, Config),
      Server =/= undefined orelse error(no_server),
      {ok, Result} = do_test(ssl, setup_connection, ?COUNT, 100, Server),
      ct_event:notify(#event{name = benchmark_data,
  			   data=[{value, Result},
  				 {suite, "ssl"}, {name, "Concurrent setup"}]}),
      ok.
  
  payload_simple(Config) ->
      Server = proplists:get_value(server_node, Config),
      Server =/= undefined orelse error(no_server),
      {ok, Result} = do_test(ssl, payload, ?COUNT*300, 10, Server),
      ct_event:notify(#event{name = benchmark_data,
  			   data=[{value, Result},
  				 {suite, "ssl"}, {name, "Payload simple"}]}),
      ok.
  
  basic_pem_cache(_Config) ->
      do_test(ssl, pem_cache, 10, 5, node()).
  
  use_pem_cache(_Config) ->
      {ok, Result} = do_test(ssl, pem_cache, 100, 500, node()),
      ct_event:notify(#event{name = benchmark_data,
                             data=[{value, Result},
                                   {suite, "ssl"}, {name, "Use PEM cache"}]}).
  
  bypass_pem_cache(_Config) ->
      {ok, Result} = do_test(ssl, pem_cache, 100, 500, node()),
      ct_event:notify(#event{name = benchmark_data,
                             data=[{value, Result},
                                   {suite, "ssl"}, {name, "Bypass PEM cache"}]}).
  
  
  ssl() ->
      test(ssl, ?COUNT).
  
  test(Type, Count) ->
      Server = ssl_bench_test_lib:setup(perf_server),
      (do_test(Type, setup_connection, Count * 20, 1, Server)),
      (do_test(Type, setup_connection, Count, 100, Server)),
      (do_test(Type, payload, Count*300, 10, Server)),
      ok.
  
  do_test(Type, TC, Loop, ParallellConnections, Server) ->
      _ = ssl:stop(),
      {ok, _} = ensure_all_started(ssl, []),
  
      {ok, {SPid, Host, Port}} = rpc:call(Server, ?MODULE, setup_server_init,
  					[Type, TC, Loop, ParallellConnections]),
      link(SPid),
      Me = self(),
      Test = fun(Id) ->
  		   CData = client_init(Me, Type, TC, Host, Port),
  		   receive
  		       go ->
  			   ?FPROF_CLIENT andalso Id =:= 1 andalso
  			       start_profile(fprof, [self(),new]),
  			   ?EPROF_CLIENT andalso Id =:= 1 andalso
  			       start_profile(eprof, [ssl_connection_sup, ssl_manager]),
  			   ok = ?MODULE:TC(Loop, Type, CData),
  			   ?FPROF_CLIENT andalso Id =:= 1 andalso
  			       stop_profile(fprof, "test_connection_client_res.fprof"),
  			   ?EPROF_CLIENT andalso Id =:= 1 andalso
  
negative.code: end_per_suite(_Config) ->
      ok.
  
  init_per_testcase(_Func, Conf) ->
      Conf.
  
  end_per_testcase(_Func, _Conf) ->
      ok.
  
  