From b3d5f82bd3baf5b63ea97c017cb83674ca703c66 Mon Sep 17 00:00:00 2001 From: Ingela Anderton Andin Date: Tue, 17 Sep 2013 15:28:20 +0200 Subject: ssl: Refactor connection and handshake handling --- lib/ssl/src/dtls_connection.erl | 101 ---------------------------------------- 1 file changed, 101 deletions(-) (limited to 'lib/ssl/src/dtls_connection.erl') diff --git a/lib/ssl/src/dtls_connection.erl b/lib/ssl/src/dtls_connection.erl index fda488501c..0271c4490a 100644 --- a/lib/ssl/src/dtls_connection.erl +++ b/lib/ssl/src/dtls_connection.erl @@ -18,82 +18,6 @@ %% -module(dtls_connection). -%%-behaviour(gen_fsm). - -%% -include("dtls_handshake.hrl"). -%% -include("ssl_alert.hrl"). -%% -include("dtls_record.hrl"). -%% -include("ssl_cipher.hrl"). -%% -include("ssl_internal.hrl"). -%% -include("ssl_srp.hrl"). -%% -include_lib("public_key/include/public_key.hrl"). - - -%% %% Called by dtls_connection_sup -%% %%-export([start_link/7]). - -%% %% gen_fsm callbacks -%% -export([init/1, hello/2, certify/2, cipher/2, -%% abbreviated/2, connection/2, handle_event/3, -%% handle_sync_event/4, handle_info/3, terminate/3, code_change/4]). - -%% -record(message_sequences, { -%% read = 0, -%% write = 0 -%% }). - -%% -record(state, { -%% role, % client | server -%% user_application, % {MonitorRef, pid()} -%% transport_cb, % atom() - callback module -%% data_tag, % atom() - ex tcp. -%% close_tag, % atom() - ex tcp_closed -%% error_tag, % atom() - ex tcp_error -%% host, % string() | ipadress() -%% port, % integer() -%% socket, % socket() -%% ssl_options, % #ssl_options{} -%% socket_options, % #socket_options{} -%% connection_states, % #connection_states{} from ssl_record.hrl -%% message_sequences = #message_sequences{}, -%% dtls_packets = [], % Not yet handled decode ssl/tls packets. -%% dtls_record_buffer, % binary() buffer of incomplete records -%% dtls_handshake_buffer, % binary() buffer of incomplete handshakes -%% dtls_handshake_history, % tls_handshake_history() -%% dtls_cipher_texts, % list() received but not deciphered yet -%% cert_db, % -%% session, % #session{} from tls_handshake.hrl -%% session_cache, % -%% session_cache_cb, % -%% negotiated_version, % tls_version() -%% client_certificate_requested = false, -%% key_algorithm, % atom as defined by cipher_suite -%% hashsign_algorithm, % atom as defined by cipher_suite -%% public_key_info, % PKIX: {Algorithm, PublicKey, PublicKeyParams} -%% private_key, % PKIX: #'RSAPrivateKey'{} -%% diffie_hellman_params, % PKIX: #'DHParameter'{} relevant for server side -%% diffie_hellman_keys, % {PublicKey, PrivateKey} -%% psk_identity, % binary() - server psk identity hint -%% srp_params, % #srp_user{} -%% srp_keys, % {PublicKey, PrivateKey} -%% premaster_secret, % -%% file_ref_db, % ets() -%% cert_db_ref, % ref() -%% bytes_to_read, % integer(), # bytes to read in passive mode -%% user_data_buffer, % binary() -%% log_alert, % boolean() -%% renegotiation, % {boolean(), From | internal | peer} -%% start_or_recv_from, % "gen_fsm From" -%% timer, % start_or_recv_timer -%% send_queue, % queue() -%% terminated = false, % -%% allow_renegotiate = true, -%% expecting_next_protocol_negotiation = false :: boolean(), -%% next_protocol = undefined :: undefined | binary(), -%% client_ecc, % {Curves, PointFmt} -%% client_cookie = <<>> -%% }). - %% %%==================================================================== @@ -196,32 +120,7 @@ %% {Record, State} = next_record(State2), %% next_state(hello, hello, Record, State); -%% hello(Hello = #client_hello{client_version = ClientVersion}, -%% State = #state{connection_states = ConnectionStates0, -%% port = Port, session = #session{own_certificate = Cert} = Session0, -%% renegotiation = {Renegotiation, _}, -%% session_cache = Cache, -%% session_cache_cb = CacheCb, -%% ssl_options = SslOpts}) -> -%% case ssl_handshake:hello(Hello, SslOpts, {Port, Session0, Cache, CacheCb, -%% ConnectionStates0, Cert}, Renegotiation) of -%% {Version, {Type, Session}, ConnectionStates, ProtocolsToAdvertise, -%% EcPointFormats, EllipticCurves} -> -%% do_server_hello(Type, ProtocolsToAdvertise, -%% EcPointFormats, EllipticCurves, -%% State#state{connection_states = ConnectionStates, -%% negotiated_version = Version, -%% session = Session, -%% client_ecc = {EllipticCurves, EcPointFormats}}); -%% #alert{} = Alert -> -%% handle_own_alert(Alert, ClientVersion, hello, State) -%% end; - -%% hello(timeout, State) -> -%% { next_state, hello, State, hibernate }; -%% hello(Msg, State) -> -%% handle_unexpected_message(Msg, hello, State). %% %%-------------------------------------------------------------------- %% -spec abbreviated(#hello_request{} | #finished{} | term(), %% #state{}) -> gen_fsm_state_return(). -- cgit v1.2.3