aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssl/src/dtls_v1.erl
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2013-06-11 20:44:04 +0200
committerIngela Anderton Andin <[email protected]>2013-09-10 09:37:29 +0200
commitf3be514fd1e015f78a227d25c3471dbe2cfb3d51 (patch)
tree634e328ae17ee4bf13ea625f80650ca90344b22d /lib/ssl/src/dtls_v1.erl
parent2be6aa6c6a3f44d86fe401e0d467c66c3d4114aa (diff)
downloadotp-f3be514fd1e015f78a227d25c3471dbe2cfb3d51.tar.gz
otp-f3be514fd1e015f78a227d25c3471dbe2cfb3d51.tar.bz2
otp-f3be514fd1e015f78a227d25c3471dbe2cfb3d51.zip
ssl: Refactor to provide common handshake functions for TLS/DTLS
Common functions will be located in ssl_handshake.erl while specific functions will be located in tls_handshake.erl and dtls_handshake.erl
Diffstat (limited to 'lib/ssl/src/dtls_v1.erl')
-rw-r--r--lib/ssl/src/dtls_v1.erl40
1 files changed, 40 insertions, 0 deletions
diff --git a/lib/ssl/src/dtls_v1.erl b/lib/ssl/src/dtls_v1.erl
new file mode 100644
index 0000000000..930998b460
--- /dev/null
+++ b/lib/ssl/src/dtls_v1.erl
@@ -0,0 +1,40 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2013-2013. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+-module(dtls_v1).
+
+-include("ssl_cipher.hrl").
+
+-export([suites/1, mac_hash/7, ecc_curves/1]).
+
+-spec suites(Minor:: 253|255) -> [cipher_suite()].
+
+suites(Minor) ->
+ tls_v1:suites(corresponding_minor_tls_version(Minor));
+
+mac_hash(Version, MacAlg, MacSecret, SeqNo, Type, Length, Fragment) ->
+ tls_v1:mac_hash(MacAlg, MacSecret, SeqNo, Type, Version,
+ Length, Fragment).
+
+ecc_curves({_Major, Minor}) ->
+ tls_v1:ecc_curves(corresponding_minor_tls_version(Minor)).
+
+corresponding_minor_tls_version(255) ->
+ 2;
+corresponding_minor_tls_version(253) ->
+ 3.