aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2016-07-07 16:46:27 +0200
committerIngela Anderton Andin <[email protected]>2016-09-05 14:37:26 +0200
commit0ce34b8fe680d1739c8211afd75720516e0e77ef (patch)
tree8f46d4941334a054f6123491f16f77db14cd146f
parente99bc5a149eaaaacb81a84a2d2608f9893242e5d (diff)
downloadotp-0ce34b8fe680d1739c8211afd75720516e0e77ef.tar.gz
otp-0ce34b8fe680d1739c8211afd75720516e0e77ef.tar.bz2
otp-0ce34b8fe680d1739c8211afd75720516e0e77ef.zip
dtls: Add reinit_handshake_data/1 to dtls
The callback is invoke before entering state 'connection'. It allows a connection module to remove data from the connection state that is no longer needed (e.g. handshake history).
-rw-r--r--lib/ssl/src/dtls_connection.erl13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/ssl/src/dtls_connection.erl b/lib/ssl/src/dtls_connection.erl
index a0d9982aaa..559eafbfec 100644
--- a/lib/ssl/src/dtls_connection.erl
+++ b/lib/ssl/src/dtls_connection.erl
@@ -42,8 +42,9 @@
-export([next_record/1, next_event/3]).
%% Handshake handling
--export([%%renegotiate/2,
- send_handshake/2, queue_handshake/2, queue_change_cipher/2]).
+-export([%%renegotiate/2,
+ reinit_handshake_data/1,
+ send_handshake/2, queue_handshake/2, queue_change_cipher/2]).
%% Alert and close handling
-export([%%send_alert/2, handle_own_alert/4, handle_close_alert/3,
@@ -139,6 +140,14 @@ send_alert(Alert, #state{negotiated_version = Version,
Transport:send(Socket, BinMsg),
State0#state{connection_states = ConnectionStates}.
+reinit_handshake_data(#state{protocol_buffers = Buffers} = State) ->
+ State#state{premaster_secret = undefined,
+ public_key_info = undefined,
+ tls_handshake_history = ssl_handshake:init_handshake_history(),
+ protocol_buffers =
+ Buffers#protocol_buffers{dtls_fragment_state =
+ dtls_handshake:dtls_handshake_new_flight(0)}}.
+
%%====================================================================
%% tls_connection_sup API
%%====================================================================