aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssl/src/dtls_handshake.erl
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2013-12-02 10:24:56 +0100
committerIngela Anderton Andin <[email protected]>2013-12-02 10:24:56 +0100
commitc3d9d667e028284d6f96f8e260d094f1775182ea (patch)
treef88229efc098d69e798132acc540835e11e24571 /lib/ssl/src/dtls_handshake.erl
parentf2fc6a63429f0c7945e7644e5fe3d8ee265bd28f (diff)
parent239ce1c4781fe4fc25c55795573654453887f507 (diff)
downloadotp-c3d9d667e028284d6f96f8e260d094f1775182ea.tar.gz
otp-c3d9d667e028284d6f96f8e260d094f1775182ea.tar.bz2
otp-c3d9d667e028284d6f96f8e260d094f1775182ea.zip
Merge branch 'maint'
Diffstat (limited to 'lib/ssl/src/dtls_handshake.erl')
-rw-r--r--lib/ssl/src/dtls_handshake.erl28
1 files changed, 20 insertions, 8 deletions
diff --git a/lib/ssl/src/dtls_handshake.erl b/lib/ssl/src/dtls_handshake.erl
index 40616a8717..5db2434753 100644
--- a/lib/ssl/src/dtls_handshake.erl
+++ b/lib/ssl/src/dtls_handshake.erl
@@ -21,13 +21,26 @@
-include("dtls_record.hrl").
-include("ssl_internal.hrl").
--export([client_hello/9, hello/3, get_dtls_handshake/2,
+-export([client_hello/8, client_hello/9, hello/3,
+ get_dtls_handshake/2,
dtls_handshake_new_flight/1, dtls_handshake_new_epoch/1,
encode_handshake/4]).
%%====================================================================
%% Internal application API
%%====================================================================
+%%--------------------------------------------------------------------
+-spec client_hello(host(), inet:port_number(), #connection_states{},
+ #ssl_options{}, integer(), atom(), boolean(), der_cert()) ->
+ #client_hello{}.
+%%
+%% Description: Creates a client hello message.
+%%--------------------------------------------------------------------
+client_hello(Host, Port, ConnectionStates, SslOpts,
+ Cache, CacheCb, Renegotiation, OwnCert) ->
+ %% First client hello (two sent in DTLS ) uses empty Cookie
+ client_hello(Host, Port, <<>>, ConnectionStates, SslOpts,
+ Cache, CacheCb, Renegotiation, OwnCert).
%%--------------------------------------------------------------------
-spec client_hello(host(), inet:port_number(), term(), #connection_states{},
@@ -87,11 +100,6 @@ hello(Address, Port,
{reply, HelloVerifyRequest}
end.
-address_to_bin({A,B,C,D}, Port) ->
- <<0:80,16#ffff:16,A,B,C,D,Port:16>>;
-address_to_bin({A,B,C,D,E,F,G,H}, Port) ->
- <<A:16,B:16,C:16,D:16,E:16,F:16,G:16,H:16,Port:16>>.
-
%%--------------------------------------------------------------------
encode_handshake(Package, Version, MsgSeq, Mss) ->
{MsgType, Bin} = enc_hs(Package, Version),
@@ -102,7 +110,7 @@ encode_handshake(Package, Version, MsgSeq, Mss) ->
%--------------------------------------------------------------------
-spec get_dtls_handshake(#ssl_tls{}, #dtls_hs_state{} | binary()) ->
- {[dtls_handshake()], #ssl_tls{}}.
+ {[dtls_handshake()], #dtls_hs_state{}} | {retransmit, #dtls_hs_state{}}.
%
% Description: Given a DTLS state and new data from ssl_record, collects
% and returns it as a list of handshake messages, also returns a new
@@ -182,7 +190,6 @@ get_dtls_handshake_aux(Version, SeqNo,
get_dtls_handshake_aux(_Version, _SeqNo, <<>>, HsState) ->
{lists:reverse(HsState#dtls_hs_state.completed),
- HsState#dtls_hs_state.highest_record_seq,
HsState#dtls_hs_state{completed = []}}.
dec_dtls_fragment(Version, SeqNo, Type, Length, MessageSeq, MsgBody,
@@ -426,3 +433,8 @@ decode_handshake(_Version, ?HELLO_VERIFY_REQUEST, <<?BYTE(Major), ?BYTE(Minor),
cookie = Cookie};
decode_handshake(Version, Tag, Msg) ->
ssl_handshake:decode_handshake(Version, Tag, Msg).
+
+address_to_bin({A,B,C,D}, Port) ->
+ <<0:80,16#ffff:16,A,B,C,D,Port:16>>;
+address_to_bin({A,B,C,D,E,F,G,H}, Port) ->
+ <<A:16,B:16,C:16,D:16,E:16,F:16,G:16,H:16,Port:16>>.