Blame otp-0012-Patch-removes-support-for-SSLv3-protocol-because-it-.patch

918fdf
From: Sergei Golovan <sgolovan@debian.org>
918fdf
Date: Sun, 30 Nov 2014 20:20:41 +0300
918fdf
Subject: [PATCH] Patch removes support for SSLv3 protocol because it is proved
918fdf
 to be insecure and nobody should use it anymore.
918fdf
918fdf
918fdf
diff --git a/lib/ssl/doc/src/ssl.xml b/lib/ssl/doc/src/ssl.xml
918fdf
index f14d0b8..3a768e9 100644
918fdf
--- a/lib/ssl/doc/src/ssl.xml
918fdf
+++ b/lib/ssl/doc/src/ssl.xml
918fdf
@@ -123,7 +123,7 @@
918fdf
 
918fdf
     

<c>sslsocket() - opaque to the user. </c>

918fdf
     
918fdf
-    

<c>protocol() = sslv3 | tlsv1 | 'tlsv1.1' | 'tlsv1.2' </c>

918fdf
+    

<c>protocol() = tlsv1 | 'tlsv1.1' | 'tlsv1.2' </c>

918fdf
     
918fdf
     

<c>ciphers() = [ciphersuite()] | string() (according to old API)</c>

918fdf
     
918fdf
diff --git a/lib/ssl/doc/src/ssl_app.xml b/lib/ssl/doc/src/ssl_app.xml
918fdf
index 43cb393..ff12e04 100644
918fdf
--- a/lib/ssl/doc/src/ssl_app.xml
918fdf
+++ b/lib/ssl/doc/src/ssl_app.xml
918fdf
@@ -47,10 +47,10 @@
918fdf
       

918fdf
     

Note that the environment parameters can be set on the command line,

918fdf
       for instance,

918fdf
-    

<c>erl ... -ssl protocol_version '[sslv3, tlsv1]' ...</c>.

918fdf
+    

<c>erl ... -ssl protocol_version '[tlsv1.1, tlsv1]' ...</c>.

918fdf
       

918fdf
     <taglist>
918fdf
-      <tag><c>]]></c>.</tag>
918fdf
+      <tag><c>]]></c>.</tag>
918fdf
       <item>
918fdf
 	

Protocol that will be supported by started clients and

918fdf
 	servers. If this option is not set it will default to all
918fdf
@@ -58,6 +58,9 @@
918fdf
 	Note that this option may be overridden by the version option
918fdf
 	to ssl:connect/[2,3] and ssl:listen/2.
918fdf
 	

918fdf
+	

For Debian GNU/Linux distribution the sslv3 protocol was

918fdf
+	disabled due to its security issues.
918fdf
+	

918fdf
       </item>
918fdf
 
918fdf
       <tag><c>]]></c></tag>
918fdf
diff --git a/lib/ssl/src/ssl_internal.hrl b/lib/ssl/src/ssl_internal.hrl
918fdf
index 85724de..14013a4 100644
918fdf
--- a/lib/ssl/src/ssl_internal.hrl
918fdf
+++ b/lib/ssl/src/ssl_internal.hrl
918fdf
@@ -64,8 +64,8 @@
918fdf
 -define(TRUE, 0).
918fdf
 -define(FALSE, 1).
918fdf
 
918fdf
--define(ALL_SUPPORTED_VERSIONS, ['tlsv1.2', 'tlsv1.1', tlsv1, sslv3]).
918fdf
--define(MIN_SUPPORTED_VERSIONS, ['tlsv1.1', tlsv1, sslv3]).
918fdf
+-define(ALL_SUPPORTED_VERSIONS, ['tlsv1.2', 'tlsv1.1', tlsv1]).
918fdf
+-define(MIN_SUPPORTED_VERSIONS, ['tlsv1.1', tlsv1]).
918fdf
 -define(ALL_DATAGRAM_SUPPORTED_VERSIONS, ['dtlsv1.2', dtlsv1]).
918fdf
 -define(MIN_DATAGRAM_SUPPORTED_VERSIONS, ['dtlsv1.2', dtlsv1]).
918fdf
 
918fdf
diff --git a/lib/ssl/src/ssl_record.hrl b/lib/ssl/src/ssl_record.hrl
918fdf
index 6aab35d..1511abd 100644
918fdf
--- a/lib/ssl/src/ssl_record.hrl
918fdf
+++ b/lib/ssl/src/ssl_record.hrl
918fdf
@@ -144,6 +144,7 @@
918fdf
 %% 	 }).
918fdf
 
918fdf
 -define(LOWEST_MAJOR_SUPPORTED_VERSION, 3).
918fdf
+-define(LOWEST_MINOR_SUPPORTED_VERSION, 1).
918fdf
 	
918fdf
 
918fdf
 -record(generic_stream_cipher, {
918fdf
diff --git a/lib/ssl/src/tls_record.erl b/lib/ssl/src/tls_record.erl
918fdf
index f50ea22..aa4fc8d 100644
918fdf
--- a/lib/ssl/src/tls_record.erl
918fdf
+++ b/lib/ssl/src/tls_record.erl
918fdf
@@ -276,14 +276,20 @@ supported_protocol_versions([_|_] = Vsns) ->
918fdf
 %%--------------------------------------------------------------------
918fdf
 -spec is_acceptable_version(tls_version()) -> boolean().
918fdf
 is_acceptable_version({N,_}) 
918fdf
-  when N >= ?LOWEST_MAJOR_SUPPORTED_VERSION ->
918fdf
+  when N > ?LOWEST_MAJOR_SUPPORTED_VERSION ->
918fdf
+    true;
918fdf
+is_acceptable_version({N,M}) 
918fdf
+  when N == ?LOWEST_MAJOR_SUPPORTED_VERSION andalso M >= ?LOWEST_MINOR_SUPPORTED_VERSION ->
918fdf
     true;
918fdf
 is_acceptable_version(_) ->
918fdf
     false.
918fdf
 
918fdf
 -spec is_acceptable_version(tls_version(), Supported :: [tls_version()]) -> boolean().
918fdf
 is_acceptable_version({N,_} = Version, Versions)   
918fdf
-  when N >= ?LOWEST_MAJOR_SUPPORTED_VERSION ->
918fdf
+  when N > ?LOWEST_MAJOR_SUPPORTED_VERSION ->
918fdf
+    lists:member(Version, Versions);
918fdf
+is_acceptable_version({N,M} = Version, Versions)   
918fdf
+  when N == ?LOWEST_MAJOR_SUPPORTED_VERSION andalso M >= ?LOWEST_MINOR_SUPPORTED_VERSION ->
918fdf
     lists:member(Version, Versions);
918fdf
 is_acceptable_version(_,_) ->
918fdf
     false.