From c5b02130526e3ed68b1d1983857f1f6de27741cb Mon Sep 17 00:00:00 2001 From: Ingela Anderton Andin Date: Fri, 20 Sep 2019 10:38:46 +0200 Subject: ssl: Improve session handling Due to legacy reasons cleaning of the session handling table was complex and needed to be delayed. However the implementation evolved many times since and this commit removes the need for the delay. Hopefully this will also remove the problem with server session tables that grow quicker than they can shrink under a heavy load. This also fixes TLS-1.3 compatibility with pre TLS-1.3 sessions. --- lib/ssl/src/tls_handshake.erl | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'lib/ssl/src/tls_handshake.erl') diff --git a/lib/ssl/src/tls_handshake.erl b/lib/ssl/src/tls_handshake.erl index 203f89a0b8..18a5afc4f7 100644 --- a/lib/ssl/src/tls_handshake.erl +++ b/lib/ssl/src/tls_handshake.erl @@ -36,7 +36,7 @@ -include_lib("kernel/include/logger.hrl"). %% Handshake handling --export([client_hello/9, hello/4]). +-export([client_hello/8, hello/4]). %% Handshake encoding -export([encode_handshake/2]). @@ -51,18 +51,18 @@ %%==================================================================== %%-------------------------------------------------------------------- -spec client_hello(ssl:host(), inet:port_number(), ssl_record:connection_states(), - ssl_options(), integer(), atom(), boolean(), der_cert(), + ssl_options(), binary(), boolean(), der_cert(), #key_share_client_hello{} | undefined) -> #client_hello{}. %% %% Description: Creates a client hello message. %%-------------------------------------------------------------------- -client_hello(Host, Port, ConnectionStates, +client_hello(_Host, _Port, ConnectionStates, #{versions := Versions, ciphers := UserSuites, fallback := Fallback } = SslOpts, - Cache, CacheCb, Renegotiation, OwnCert, KeyShare) -> + Id, Renegotiation, _OwnCert, KeyShare) -> Version = tls_record:highest_protocol_version(Versions), %% In TLS 1.3, the client indicates its version preferences in the @@ -85,7 +85,6 @@ client_hello(Host, Port, ConnectionStates, Renegotiation, KeyShare), CipherSuites = ssl_handshake:cipher_suites(AvailableCipherSuites, Renegotiation, Fallback), - Id = ssl_session:client_id({Host, Port, SslOpts}, Cache, CacheCb, OwnCert), #client_hello{session_id = Id, client_version = LegacyVersion, cipher_suites = CipherSuites, -- cgit v1.2.1