aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssl/src/tls_handshake.erl
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2013-12-02 09:52:58 +0100
committerIngela Anderton Andin <[email protected]>2013-12-02 09:52:58 +0100
commit239ce1c4781fe4fc25c55795573654453887f507 (patch)
tree256c7436d2d1e24407422fb525e71258fe23334e /lib/ssl/src/tls_handshake.erl
parentd3e5761436cfbcb5b53edad9e1140e445ce94bfd (diff)
parent174b36ae2755b501e2b3152f6b00e9c59a90e848 (diff)
downloadotp-239ce1c4781fe4fc25c55795573654453887f507.tar.gz
otp-239ce1c4781fe4fc25c55795573654453887f507.tar.bz2
otp-239ce1c4781fe4fc25c55795573654453887f507.zip
Merge branch 'ia/ssl/dtls-refactor-continue/OTP-11292' into maint
* ia/ssl/dtls-refactor-continue/OTP-11292: ssl: Trap exits ssl: Refactor connetion handling ssl: API and supervisor ssl: Dialyzer fixes ssl: Test case enhancement ssl: Refactor API ssl, public_key: Dialyzer fixes ssl: Refactor premaster secret handling ssl: Refactor connection and handshake handling ssl: Refactor handshake and record handling
Diffstat (limited to 'lib/ssl/src/tls_handshake.erl')
-rw-r--r--lib/ssl/src/tls_handshake.erl60
1 files changed, 3 insertions, 57 deletions
diff --git a/lib/ssl/src/tls_handshake.erl b/lib/ssl/src/tls_handshake.erl
index 262f2d929f..003614b448 100644
--- a/lib/ssl/src/tls_handshake.erl
+++ b/lib/ssl/src/tls_handshake.erl
@@ -26,15 +26,12 @@
-include("tls_handshake.hrl").
-include("tls_record.hrl").
--include("ssl_cipher.hrl").
-include("ssl_alert.hrl").
-include("ssl_internal.hrl").
--include("ssl_srp.hrl").
-include_lib("public_key/include/public_key.hrl").
--export([client_hello/8, server_hello/4, hello/4,
- get_tls_handshake/3, encode_handshake/2, decode_handshake/3,
- init_handshake_history/0, update_handshake_history/2]).
+-export([client_hello/8, hello/4,
+ get_tls_handshake/3, encode_handshake/2, decode_handshake/3]).
%%====================================================================
%% Internal application API
@@ -70,25 +67,6 @@ client_hello(Host, Port, ConnectionStates,
}.
%%--------------------------------------------------------------------
--spec server_hello(binary(), tls_version(), #connection_states{},
- #hello_extensions{}) -> #server_hello{}.
-%%
-%% Description: Creates a server hello message.
-%%--------------------------------------------------------------------
-server_hello(SessionId, Version, ConnectionStates, Extensions) ->
- Pending = ssl_record:pending_connection_state(ConnectionStates, read),
- SecParams = Pending#connection_state.security_parameters,
-
- #server_hello{server_version = Version,
- cipher_suite = SecParams#security_parameters.cipher_suite,
- compression_method =
- SecParams#security_parameters.compression_algorithm,
- random = SecParams#security_parameters.server_random,
- session_id = SessionId,
- extensions = Extensions
- }.
-
-%%--------------------------------------------------------------------
-spec hello(#server_hello{} | #client_hello{}, #ssl_options{},
#connection_states{} | {inet:port_number(), #session{}, db_handle(),
atom(), #connection_states{}, binary() | undefined},
@@ -167,36 +145,8 @@ get_tls_handshake(Version, Data, Buffer) ->
get_tls_handshake_aux(Version, list_to_binary([Buffer, Data]), []).
%%--------------------------------------------------------------------
--spec init_handshake_history() -> tls_handshake_history().
-
-%%
-%% Description: Initialize the empty handshake history buffer.
-%%--------------------------------------------------------------------
-init_handshake_history() ->
- {[], []}.
-
-%%--------------------------------------------------------------------
--spec update_handshake_history(tls_handshake_history(), Data ::term()) ->
- tls_handshake_history().
-%%
-%% Description: Update the handshake history buffer with Data.
+%%% Internal functions
%%--------------------------------------------------------------------
-update_handshake_history(Handshake, % special-case SSL2 client hello
- <<?CLIENT_HELLO, ?UINT24(_), ?BYTE(Major), ?BYTE(Minor),
- ?UINT16(CSLength), ?UINT16(0),
- ?UINT16(CDLength),
- CipherSuites:CSLength/binary,
- ChallengeData:CDLength/binary>>) ->
- update_handshake_history(Handshake,
- <<?CLIENT_HELLO, ?BYTE(Major), ?BYTE(Minor),
- ?UINT16(CSLength), ?UINT16(0),
- ?UINT16(CDLength),
- CipherSuites:CSLength/binary,
- ChallengeData:CDLength/binary>>);
-update_handshake_history({Handshake0, _Prev}, Data) ->
- {[Data|Handshake0], Handshake0}.
-
-
get_tls_handshake_aux(Version, <<?BYTE(Type), ?UINT24(Length),
Body:Length/binary,Rest/binary>>, Acc) ->
Raw = <<?BYTE(Type), ?UINT24(Length), Body/binary>>,
@@ -205,10 +155,6 @@ get_tls_handshake_aux(Version, <<?BYTE(Type), ?UINT24(Length),
get_tls_handshake_aux(_Version, Data, Acc) ->
{lists:reverse(Acc), Data}.
-%%--------------------------------------------------------------------
-%%% Internal functions
-%%--------------------------------------------------------------------
-
decode_handshake(_, ?HELLO_REQUEST, <<>>) ->
#hello_request{};