-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ssl: Structural perarparation to support DTLS
Also phase in tls module as main API instead of ssl. To make API clearer. As TLS is the new protocol name. Maybe keep some API functions in ssl
- Loading branch information
1 parent
036a9c4
commit e7f8deb
Showing
25 changed files
with
1,572 additions
and
1,150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,25 @@ | ||
%% | ||
%% %CopyrightBegin% | ||
%% | ||
%% Copyright Ericsson AB 2007-2009. All Rights Reserved. | ||
%% | ||
%% | ||
%% Copyright Ericsson AB 1999-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% | ||
%% | ||
|
||
%% | ||
|
||
%%% Purpose : API for DTLS. | ||
|
||
-ifndef(ssl_debug). | ||
-define(ssl_debug, true). | ||
|
||
-ifdef(SSL_DEBUG). | ||
-define(DBG_HEX(V), ssl_debug:hex_data(??V, V, ?MODULE, ?LINE)). | ||
-define(DBG_TERM(T), ssl_debug:term_data(??T, T, ?MODULE, ?LINE)). | ||
-else. | ||
-define(DBG_HEX(V), ok). | ||
-define(DBG_TERM(T), ok). | ||
-endif. | ||
|
||
-endif. % -ifdef(ssl_debug). | ||
|
||
|
||
|
||
|
||
-module(dtls). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
%% | ||
%% %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_connection). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
%% | ||
%% %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_handshake). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
%% | ||
%% %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% | ||
%% | ||
|
||
%% | ||
%%---------------------------------------------------------------------- | ||
%% Purpose: Record and constant defenitions for the DTLS-handshake protocol | ||
%% that differs from TLS see RFC 6347 | ||
%%---------------------------------------------------------------------- | ||
-ifndef(dtls_handshake). | ||
-define(dtls_handshake, true). | ||
|
||
-include("ssl_handshake.hrl"). %% Common TLS and DTLS records and Constantes | ||
|
||
-record(client_hello, { | ||
client_version, | ||
random, | ||
session_id, % opaque SessionID<0..32> | ||
cookie, % opaque<2..2^16-1> | ||
cipher_suites, % cipher_suites<2..2^16-1> | ||
compression_methods, % compression_methods<1..2^8-1>, | ||
%% Extensions | ||
renegotiation_info, | ||
hash_signs, % supported combinations of hashes/signature algos | ||
next_protocol_negotiation = undefined % [binary()] | ||
}). | ||
|
||
-record(hello_verify_request { | ||
protocol_version, | ||
cookie | ||
}). | ||
|
||
-define(HELLO_VERIFY_REQUEST, 3). | ||
|
||
-endif. % -ifdef(dtls_handshake). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
%% | ||
%% %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_record). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
%% | ||
%% %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% | ||
%% | ||
|
||
%% | ||
%%---------------------------------------------------------------------- | ||
%% Purpose: Record and constant defenitions for the DTLS-record protocol | ||
%% see RFC 6347 | ||
%%---------------------------------------------------------------------- | ||
|
||
-ifndef(dtls_record). | ||
-define(dtls_record, true). | ||
|
||
-include("ssl_record.hrl"). %% Common TLS and DTLS records and Constantes | ||
|
||
%% Used to handle tls_plain_text, tls_compressed and tls_cipher_text | ||
|
||
-record(ssl_tls, { | ||
type, | ||
version, | ||
record_seq, % used in plain_text | ||
epoch, % used in plain_text | ||
message_seq, | ||
fragment_offset, | ||
fragment_length, | ||
fragment | ||
}). | ||
|
||
-endif. % -ifdef(dtls_record). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.