c38149d
From 53782619bae773a4034bc53b3b0bd858f90190dc Mon Sep 17 00:00:00 2001
c38149d
From: Kamil Dudka <kdudka@redhat.com>
c38149d
Date: Thu, 27 Oct 2016 14:27:25 +0200
c38149d
Subject: [PATCH 1/4] nss: map CURL_SSLVERSION_DEFAULT to NSS default
c38149d
c38149d
... but make sure we use at least TLSv1.0 according to libcurl API
c38149d
c38149d
Reported-by: Cure53
c38149d
Reviewed-by: Ray Satiro
c38149d
c38149d
Upstream-commit: 5d45ced7a45ea38e32f1cbf73d7c63a3e4f241e7
c38149d
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
c38149d
---
c38149d
 lib/vtls/nss.c | 14 +++++++++++++-
c38149d
 1 file changed, 13 insertions(+), 1 deletion(-)
c38149d
c38149d
diff --git a/lib/vtls/nss.c b/lib/vtls/nss.c
c38149d
index dff1575..5abb574 100644
c38149d
--- a/lib/vtls/nss.c
c38149d
+++ b/lib/vtls/nss.c
c38149d
@@ -1489,10 +1489,18 @@ static CURLcode nss_init_sslver(SSLVersionRange *sslver,
c38149d
                                 struct Curl_easy *data)
c38149d
 {
c38149d
   switch(data->set.ssl.version) {
c38149d
-  default:
c38149d
   case CURL_SSLVERSION_DEFAULT:
c38149d
+    /* map CURL_SSLVERSION_DEFAULT to NSS default */
c38149d
+    if(SSL_VersionRangeGetDefault(ssl_variant_stream, sslver) != SECSuccess)
c38149d
+      return CURLE_SSL_CONNECT_ERROR;
c38149d
+    /* ... but make sure we use at least TLSv1.0 according to libcurl API */
c38149d
+    if(sslver->min < SSL_LIBRARY_VERSION_TLS_1_0)
c38149d
+      sslver->min = SSL_LIBRARY_VERSION_TLS_1_0;
c38149d
+    return CURLE_OK;
c38149d
+
c38149d
   case CURL_SSLVERSION_TLSv1:
c38149d
     sslver->min = SSL_LIBRARY_VERSION_TLS_1_0;
c38149d
+    /* TODO: set sslver->max to SSL_LIBRARY_VERSION_TLS_1_3 once stable */
c38149d
 #ifdef SSL_LIBRARY_VERSION_TLS_1_2
c38149d
     sslver->max = SSL_LIBRARY_VERSION_TLS_1_2;
c38149d
 #elif defined SSL_LIBRARY_VERSION_TLS_1_1
c38149d
@@ -1532,6 +1540,10 @@ static CURLcode nss_init_sslver(SSLVersionRange *sslver,
c38149d
     return CURLE_OK;
c38149d
 #endif
c38149d
     break;
c38149d
+
c38149d
+  default:
c38149d
+    /* unsupported SSL/TLS version */
c38149d
+    break;
c38149d
   }
c38149d
 
c38149d
   failf(data, "TLS minor version cannot be set");
c38149d
-- 
c38149d
2.7.4
c38149d
c38149d
c38149d
From 6a42abb03de6e5afe859313b236f2b776ca51722 Mon Sep 17 00:00:00 2001
c38149d
From: Kamil Dudka <kdudka@redhat.com>
c38149d
Date: Thu, 27 Oct 2016 14:57:11 +0200
c38149d
Subject: [PATCH 2/4] vtls: support TLS 1.3 via CURL_SSLVERSION_TLSv1_3
c38149d
c38149d
Fully implemented with the NSS backend only for now.
c38149d
c38149d
Reviewed-by: Ray Satiro
c38149d
c38149d
Upstream-commit: 6ad3add60654182a747f5971afb40817488ef0e8
c38149d
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
c38149d
---
c38149d
 docs/libcurl/opts/CURLOPT_SSLVERSION.3 | 2 ++
c38149d
 docs/libcurl/symbols-in-versions       | 1 +
c38149d
 include/curl/curl.h                    | 1 +
c38149d
 lib/vtls/nss.c                         | 8 ++++++++
c38149d
 4 files changed, 12 insertions(+)
c38149d
c38149d
diff --git a/docs/libcurl/opts/CURLOPT_SSLVERSION.3 b/docs/libcurl/opts/CURLOPT_SSLVERSION.3
c38149d
index 2f40e46..1854af0 100644
c38149d
--- a/docs/libcurl/opts/CURLOPT_SSLVERSION.3
c38149d
+++ b/docs/libcurl/opts/CURLOPT_SSLVERSION.3
c38149d
@@ -48,6 +48,8 @@ TLSv1.0 (Added in 7.34.0)
c38149d
 TLSv1.1 (Added in 7.34.0)
c38149d
 .IP CURL_SSLVERSION_TLSv1_2
c38149d
 TLSv1.2 (Added in 7.34.0)
c38149d
+.IP CURL_SSLVERSION_TLSv1_3
c38149d
+TLSv1.3 (Added in 7.51.1)
c38149d
 .RE
c38149d
 .SH DEFAULT
c38149d
 CURL_SSLVERSION_DEFAULT
c38149d
diff --git a/docs/libcurl/symbols-in-versions b/docs/libcurl/symbols-in-versions
c38149d
index f6365ae..a77fde4 100644
c38149d
--- a/docs/libcurl/symbols-in-versions
c38149d
+++ b/docs/libcurl/symbols-in-versions
c38149d
@@ -773,6 +773,7 @@ CURL_SSLVERSION_TLSv1           7.9.2
c38149d
 CURL_SSLVERSION_TLSv1_0         7.34.0
c38149d
 CURL_SSLVERSION_TLSv1_1         7.34.0
c38149d
 CURL_SSLVERSION_TLSv1_2         7.34.0
c38149d
+CURL_SSLVERSION_TLSv1_3         7.51.1
c38149d
 CURL_TIMECOND_IFMODSINCE        7.9.7
c38149d
 CURL_TIMECOND_IFUNMODSINCE      7.9.7
c38149d
 CURL_TIMECOND_LASTMOD           7.9.7
c38149d
diff --git a/include/curl/curl.h b/include/curl/curl.h
c38149d
index 9c09cb9..03fcfeb 100644
c38149d
--- a/include/curl/curl.h
c38149d
+++ b/include/curl/curl.h
c38149d
@@ -1805,6 +1805,7 @@ enum {
c38149d
   CURL_SSLVERSION_TLSv1_0,
c38149d
   CURL_SSLVERSION_TLSv1_1,
c38149d
   CURL_SSLVERSION_TLSv1_2,
c38149d
+  CURL_SSLVERSION_TLSv1_3,
c38149d
 
c38149d
   CURL_SSLVERSION_LAST /* never use, keep last */
c38149d
 };
c38149d
diff --git a/lib/vtls/nss.c b/lib/vtls/nss.c
c38149d
index 5abb574..5e52727 100644
c38149d
--- a/lib/vtls/nss.c
c38149d
+++ b/lib/vtls/nss.c
c38149d
@@ -1541,6 +1541,14 @@ static CURLcode nss_init_sslver(SSLVersionRange *sslver,
c38149d
 #endif
c38149d
     break;
c38149d
 
c38149d
+  case CURL_SSLVERSION_TLSv1_3:
c38149d
+#ifdef SSL_LIBRARY_VERSION_TLS_1_3
c38149d
+    sslver->min = SSL_LIBRARY_VERSION_TLS_1_3;
c38149d
+    sslver->max = SSL_LIBRARY_VERSION_TLS_1_3;
c38149d
+    return CURLE_OK;
c38149d
+#endif
c38149d
+    break;
c38149d
+
c38149d
   default:
c38149d
     /* unsupported SSL/TLS version */
c38149d
     break;
c38149d
-- 
c38149d
2.7.4
c38149d
c38149d
c38149d
From d930268ab522ac7ea7ccd83671d22f57148f3d21 Mon Sep 17 00:00:00 2001
c38149d
From: Kamil Dudka <kdudka@redhat.com>
c38149d
Date: Thu, 27 Oct 2016 14:58:43 +0200
c38149d
Subject: [PATCH 3/4] curl: introduce the --tlsv1.3 option to force TLS 1.3
c38149d
c38149d
Fully implemented with the NSS backend only for now.
c38149d
c38149d
Reviewed-by: Ray Satiro
c38149d
c38149d
Upstream-commit: a110a03b43057879643046538c79cc9dd20d399a
c38149d
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
c38149d
---
c38149d
 docs/curl.1         | 10 +++++++---
c38149d
 src/tool_getparam.c |  5 +++++
c38149d
 src/tool_help.c     |  1 +
c38149d
 src/tool_setopt.c   |  1 +
c38149d
 4 files changed, 14 insertions(+), 3 deletions(-)
c38149d
c38149d
diff --git a/docs/curl.1 b/docs/curl.1
c38149d
index f5375ed..e9c6150 100644
c38149d
--- a/docs/curl.1
c38149d
+++ b/docs/curl.1
c38149d
@@ -176,9 +176,9 @@ HTTP 2 to negotiate HTTP 2 support with the server during https sessions.
c38149d
 .IP "-1, --tlsv1"
c38149d
 (SSL)
c38149d
 Forces curl to use TLS version 1.x when negotiating with a remote TLS server.
c38149d
-You can use options \fI--tlsv1.0\fP, \fI--tlsv1.1\fP, and \fI--tlsv1.2\fP to
c38149d
-control the TLS version more precisely (if the SSL backend in use supports such
c38149d
-a level of control).
c38149d
+You can use options \fI--tlsv1.0\fP, \fI--tlsv1.1\fP, \fI--tlsv1.2\fP, and
c38149d
+\fI--tlsv1.3\fP to control the TLS version more precisely (if the SSL backend
c38149d
+in use supports such a level of control).
c38149d
 .IP "-2, --sslv2"
c38149d
 (SSL) Forces curl to use SSL version 2 when negotiating with a remote SSL
c38149d
 server. Sometimes curl is built without SSLv2 support. SSLv2 is widely
c38149d
@@ -1820,6 +1820,10 @@ Forces curl to use TLS version 1.1 when negotiating with a remote TLS server.
c38149d
 (SSL)
c38149d
 Forces curl to use TLS version 1.2 when negotiating with a remote TLS server.
c38149d
 (Added in 7.34.0)
c38149d
+.IP "--tlsv1.3"
c38149d
+(SSL)
c38149d
+Forces curl to use TLS version 1.3 when negotiating with a remote TLS server.
c38149d
+(Added in 7.51.1)
c38149d
 .IP "--tr-encoding"
c38149d
 (HTTP) Request a compressed Transfer-Encoding response using one of the
c38149d
 algorithms curl supports, and uncompress the data while receiving it.
c38149d
diff --git a/src/tool_getparam.c b/src/tool_getparam.c
c38149d
index 95dd455..2d16e06 100644
c38149d
--- a/src/tool_getparam.c
c38149d
+++ b/src/tool_getparam.c
c38149d
@@ -190,6 +190,7 @@ static const struct LongShort aliases[]= {
c38149d
   {"10",  "tlsv1.0",                 FALSE},
c38149d
   {"11",  "tlsv1.1",                 FALSE},
c38149d
   {"12",  "tlsv1.2",                 FALSE},
c38149d
+  {"13",  "tlsv1.3",                 FALSE},
c38149d
   {"2",  "sslv2",                    FALSE},
c38149d
   {"3",  "sslv3",                    FALSE},
c38149d
   {"4",  "ipv4",                     FALSE},
c38149d
@@ -1061,6 +1062,10 @@ ParameterError getparameter(char *flag,    /* f or -long-flag */
c38149d
         /* TLS version 1.2 */
c38149d
         config->ssl_version = CURL_SSLVERSION_TLSv1_2;
c38149d
         break;
c38149d
+      case '3':
c38149d
+        /* TLS version 1.3 */
c38149d
+        config->ssl_version = CURL_SSLVERSION_TLSv1_3;
c38149d
+        break;
c38149d
       }
c38149d
       break;
c38149d
     case '2':
c38149d
diff --git a/src/tool_help.c b/src/tool_help.c
c38149d
index fb428c9..9890cc8 100644
c38149d
--- a/src/tool_help.c
c38149d
+++ b/src/tool_help.c
c38149d
@@ -232,6 +232,7 @@ static const char *const helptext[] = {
c38149d
   "     --tlsv1.0       Use TLSv1.0 (SSL)",
c38149d
   "     --tlsv1.1       Use TLSv1.1 (SSL)",
c38149d
   "     --tlsv1.2       Use TLSv1.2 (SSL)",
c38149d
+  "     --tlsv1.3       Use TLSv1.3 (SSL)",
c38149d
   "     --trace FILE    Write a debug trace to FILE",
c38149d
   "     --trace-ascii FILE  Like --trace, but without hex output",
c38149d
   "     --trace-time    Add time stamps to trace/verbose output",
c38149d
diff --git a/src/tool_setopt.c b/src/tool_setopt.c
c38149d
index c854225..f3de09d 100644
c38149d
--- a/src/tool_setopt.c
c38149d
+++ b/src/tool_setopt.c
c38149d
@@ -83,6 +83,7 @@ const NameValue setopt_nv_CURL_SSLVERSION[] = {
c38149d
   NV(CURL_SSLVERSION_TLSv1_0),
c38149d
   NV(CURL_SSLVERSION_TLSv1_1),
c38149d
   NV(CURL_SSLVERSION_TLSv1_2),
c38149d
+  NV(CURL_SSLVERSION_TLSv1_3),
c38149d
   NVEND,
c38149d
 };
c38149d
 
c38149d
-- 
c38149d
2.7.4
c38149d
c38149d
c38149d
From 2fce531638a12f44ea1fbc52e86ca795a3a4e4e2 Mon Sep 17 00:00:00 2001
c38149d
From: Kamil Dudka <kdudka@redhat.com>
c38149d
Date: Tue, 15 Nov 2016 12:21:00 +0100
c38149d
Subject: [PATCH 4/4] docs: the next release will be 7.52.0
c38149d
c38149d
Upstream-commit: cfd69c133984a5df3de63b4f8c5f64885c6e33ae
c38149d
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
c38149d
---
c38149d
 docs/curl.1                            | 2 +-
c38149d
 docs/libcurl/opts/CURLOPT_SSLVERSION.3 | 2 +-
c38149d
 docs/libcurl/symbols-in-versions       | 2 +-
c38149d
 3 files changed, 3 insertions(+), 3 deletions(-)
c38149d
c38149d
diff --git a/docs/curl.1 b/docs/curl.1
c38149d
index e9c6150..05d1a8d 100644
c38149d
--- a/docs/curl.1
c38149d
+++ b/docs/curl.1
c38149d
@@ -1823,7 +1823,7 @@ Forces curl to use TLS version 1.2 when negotiating with a remote TLS server.
c38149d
 .IP "--tlsv1.3"
c38149d
 (SSL)
c38149d
 Forces curl to use TLS version 1.3 when negotiating with a remote TLS server.
c38149d
-(Added in 7.51.1)
c38149d
+(Added in 7.52.0)
c38149d
 .IP "--tr-encoding"
c38149d
 (HTTP) Request a compressed Transfer-Encoding response using one of the
c38149d
 algorithms curl supports, and uncompress the data while receiving it.
c38149d
diff --git a/docs/libcurl/opts/CURLOPT_SSLVERSION.3 b/docs/libcurl/opts/CURLOPT_SSLVERSION.3
c38149d
index 1854af0..77dfcd4 100644
c38149d
--- a/docs/libcurl/opts/CURLOPT_SSLVERSION.3
c38149d
+++ b/docs/libcurl/opts/CURLOPT_SSLVERSION.3
c38149d
@@ -49,7 +49,7 @@ TLSv1.1 (Added in 7.34.0)
c38149d
 .IP CURL_SSLVERSION_TLSv1_2
c38149d
 TLSv1.2 (Added in 7.34.0)
c38149d
 .IP CURL_SSLVERSION_TLSv1_3
c38149d
-TLSv1.3 (Added in 7.51.1)
c38149d
+TLSv1.3 (Added in 7.52.0)
c38149d
 .RE
c38149d
 .SH DEFAULT
c38149d
 CURL_SSLVERSION_DEFAULT
c38149d
diff --git a/docs/libcurl/symbols-in-versions b/docs/libcurl/symbols-in-versions
c38149d
index a77fde4..ef730c8 100644
c38149d
--- a/docs/libcurl/symbols-in-versions
c38149d
+++ b/docs/libcurl/symbols-in-versions
c38149d
@@ -773,7 +773,7 @@ CURL_SSLVERSION_TLSv1           7.9.2
c38149d
 CURL_SSLVERSION_TLSv1_0         7.34.0
c38149d
 CURL_SSLVERSION_TLSv1_1         7.34.0
c38149d
 CURL_SSLVERSION_TLSv1_2         7.34.0
c38149d
-CURL_SSLVERSION_TLSv1_3         7.51.1
c38149d
+CURL_SSLVERSION_TLSv1_3         7.52.0
c38149d
 CURL_TIMECOND_IFMODSINCE        7.9.7
c38149d
 CURL_TIMECOND_IFUNMODSINCE      7.9.7
c38149d
 CURL_TIMECOND_LASTMOD           7.9.7
c38149d
-- 
c38149d
2.7.4
c38149d