aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssl/src/ssl_ssl3.erl
diff options
context:
space:
mode:
authorAndreas Schultz <[email protected]>2012-04-08 02:39:18 +0200
committerIngela Anderton Andin <[email protected]>2012-08-22 14:00:44 +0200
commitd848984efd05314abf2de8da6ddd4ee651f0da35 (patch)
treec56ce48d75c8c8ba74c99af46a59182575202d88 /lib/ssl/src/ssl_ssl3.erl
parent7c9639c785bb6b3047788b6b27ddbafb8f5b0b08 (diff)
downloadotp-d848984efd05314abf2de8da6ddd4ee651f0da35.tar.gz
otp-d848984efd05314abf2de8da6ddd4ee651f0da35.tar.bz2
otp-d848984efd05314abf2de8da6ddd4ee651f0da35.zip
ssl: make PRF function selectable
TLS 1.2 allows to negotiate the used PRF, additional the default PRF uses a different hash. This change make the PRF selectable and hardwires the PRF for TLS < 1.2
Diffstat (limited to 'lib/ssl/src/ssl_ssl3.erl')
-rw-r--r--lib/ssl/src/ssl_ssl3.erl21
1 files changed, 18 insertions, 3 deletions
diff --git a/lib/ssl/src/ssl_ssl3.erl b/lib/ssl/src/ssl_ssl3.erl
index 2b4ae1539f..11bc663e77 100644
--- a/lib/ssl/src/ssl_ssl3.erl
+++ b/lib/ssl/src/ssl_ssl3.erl
@@ -156,14 +156,22 @@ suites() ->
hash(?MD5, Data) ->
crypto:md5(Data);
hash(?SHA, Data) ->
- crypto:sha(Data).
+ crypto:sha(Data);
+hash(?SHA256, Data) ->
+ crypto:sha256(Data);
+hash(?SHA384, Data) ->
+ crypto:sha384(Data).
%%pad_1(?NULL) ->
%% "";
pad_1(?MD5) ->
<<"666666666666666666666666666666666666666666666666">>;
pad_1(?SHA) ->
- <<"6666666666666666666666666666666666666666">>.
+ <<"6666666666666666666666666666666666666666">>;
+pad_1(?SHA256) ->
+ <<"66666666666666666666666666666666">>;
+pad_1(?SHA384) ->
+ <<"666666666666666666666666666666666666666666666666">>.
%%pad_2(?NULL) ->
%% "";
@@ -172,7 +180,14 @@ pad_2(?MD5) ->
"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\">>;
pad_2(?SHA) ->
<<"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"
- "\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\">>.
+ "\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\">>;
+pad_2(?SHA256) ->
+ <<"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"
+ "\\\\\\\\\\\\\\\\\\\\\\\\">>;
+pad_2(?SHA384) ->
+ <<"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"
+ "\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"
+ "\\\\\\\\\\\\\\\\">>.
mac_hash(?NULL, _Secret, _Data) ->
<<>>;