diff options
author | Ingela Anderton Andin <[email protected]> | 2016-08-18 17:04:28 +0200 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2016-09-05 14:37:27 +0200 |
commit | da0f19e53243e75ec305e3697e7b3028e141b74b (patch) | |
tree | 6476ac869d2a1bc9b08663ea3c8772e9b1276a87 /lib/ssl/src/dtls_connection.erl | |
parent | 630617405c8c96f76a752cde8e5db134b91df8fd (diff) | |
download | otp-da0f19e53243e75ec305e3697e7b3028e141b74b.tar.gz otp-da0f19e53243e75ec305e3697e7b3028e141b74b.tar.bz2 otp-da0f19e53243e75ec305e3697e7b3028e141b74b.zip |
dtls: Add renegotiate/2
Diffstat (limited to 'lib/ssl/src/dtls_connection.erl')
-rw-r--r-- | lib/ssl/src/dtls_connection.erl | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/ssl/src/dtls_connection.erl b/lib/ssl/src/dtls_connection.erl index 22abb5da02..0afb02afb3 100644 --- a/lib/ssl/src/dtls_connection.erl +++ b/lib/ssl/src/dtls_connection.erl @@ -42,7 +42,7 @@ -export([next_record/1, next_event/3]). %% Handshake handling --export([%%renegotiate/2, +-export([renegotiate/2, reinit_handshake_data/1, send_handshake/2, queue_handshake/2, queue_change_cipher/2]). @@ -684,6 +684,25 @@ next_event(StateName, Record, State, Actions) -> sequence(#connection_states{dtls_write_msg_seq = Seq} = CS) -> {Seq, CS#connection_states{dtls_write_msg_seq = Seq + 1}}. +renegotiate(#state{role = client} = State, Actions) -> + %% Handle same way as if server requested + %% the renegotiation + Hs0 = ssl_handshake:init_handshake_history(), + {next_state, connection, State#state{tls_handshake_history = Hs0, + protocol_buffers = #protocol_buffers{}}, + [{next_event, internal, #hello_request{}} | Actions]}; + +renegotiate(#state{role = server, + connection_states = CS0} = State0, Actions) -> + HelloRequest = ssl_handshake:hello_request(), + State1 = send_handshake(HelloRequest, + State0#state{connection_states = + CS0#connection_states{dtls_write_msg_seq = 0}}), + Hs0 = ssl_handshake:init_handshake_history(), + {Record, State} = next_record(State1#state{tls_handshake_history = Hs0, + protocol_buffers = #protocol_buffers{}}), + next_event(hello, Record, State, Actions). + handle_alerts([], Result) -> Result; handle_alerts(_, {stop,_} = Stop) -> |