]> granicus.if.org Git - curl/commitdiff
getinfo: Add support for mbedTLS TLS session info
authorJay Satiro <raysatiro@yahoo.com>
Sun, 28 Feb 2016 00:01:00 +0000 (19:01 -0500)
committerJay Satiro <raysatiro@yahoo.com>
Sun, 28 Feb 2016 00:01:00 +0000 (19:01 -0500)
.. and preprocessor check TLS session info is defined for all backends.

docs/libcurl/opts/CURLINFO_TLS_SESSION.3
docs/libcurl/opts/CURLINFO_TLS_SSL_PTR.3
lib/getinfo.c

index b1bef0e6e6000605e5c9014dbc7e0199fbb72920..7c86bedfe18f7d849ab0b09ec1c709bf2638b43d 100644 (file)
@@ -5,7 +5,7 @@
 .\" *                            | (__| |_| |  _ <| |___
 .\" *                             \___|\___/|_| \_\_____|
 .\" *
-.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
 .\" *
 .\" * This software is licensed as described in the file COPYING, which
 .\" * you should have received as part of this distribution. The terms
index 6d984e34d00053c238fd2d90be0ef7a84d2532d1..c9df999d95051b8c51e35f3655634ce599d233d3 100644 (file)
@@ -5,11 +5,11 @@
 .\" *                            | (__| |_| |  _ <| |___
 .\" *                             \___|\___/|_| \_\_____|
 .\" *
-.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
 .\" *
 .\" * This software is licensed as described in the file COPYING, which
 .\" * you should have received as part of this distribution. The terms
-.\" * are also available at http://curl.haxx.se/docs/copyright.html.
+.\" * are also available at https://curl.haxx.se/docs/copyright.html.
 .\" *
 .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
 .\" * copies of the Software, and permit persons to whom the Software is
@@ -56,10 +56,10 @@ struct curl_tlssessioninfo {
 
 The \fIbackend\fP struct member is one of the defines in the CURLSSLBACKEND_*
 series: CURLSSLBACKEND_NONE (when built without TLS support),
-CURLSSLBACKEND_OPENSSL, CURLSSLBACKEND_GNUTLS, CURLSSLBACKEND_NSS,
-CURLSSLBACKEND_GSKIT, CURLSSLBACKEND_POLARSSL, CURLSSLBACKEND_CYASSL,
-CURLSSLBACKEND_SCHANNEL, CURLSSLBACKEND_DARWINSSL or
-CURLSSLBACKEND_AXTLS. (Note that the OpenSSL forks are all reported as just
+CURLSSLBACKEND_AXTLS, CURLSSLBACKEND_CYASSL, CURLSSLBACKEND_DARWINSSL,
+CURLSSLBACKEND_GNUTLS, CURLSSLBACKEND_GSKIT, CURLSSLBACKEND_MBEDTLS,
+CURLSSLBACKEND_NSS, CURLSSLBACKEND_OPENSSL, CURLSSLBACKEND_POLARSSL or
+CURLSSLBACKEND_SCHANNEL. (Note that the OpenSSL forks are all reported as just
 OpenSSL here.)
 
 The \fIinternals\fP struct member will point to a TLS library specific pointer
@@ -81,6 +81,8 @@ as well:
 .RS
 .IP axTLS
 SSL *
+.IP mbedTLS
+mbedtls_ssl_session *
 .IP PolarSSL
 ssl_session *
 .IP Secure Channel ("WinSSL")
index 2508b291fffaaa78720ffc12675991d84c29dde5..117d513a5ad49a375a739d9d9a2fe5edba98e767 100644 (file)
@@ -296,35 +296,31 @@ static CURLcode getinfo_slist(struct SessionHandle *data, CURLINFO info,
         unsigned int i;
         for(i = 0; i < (sizeof(conn->ssl) / sizeof(conn->ssl[0])); ++i) {
           if(conn->ssl[i].use) {
-#ifdef USE_AXTLS
+#if defined(USE_AXTLS)
             tsi->internals = (void *)conn->ssl[i].ssl;
-#endif
-#ifdef USE_CYASSL
+#elif defined(USE_CYASSL)
             tsi->internals = (void *)conn->ssl[i].handle;
-#endif
-#ifdef USE_DARWINSSL
+#elif defined(USE_DARWINSSL)
             tsi->internals = (void *)conn->ssl[i].ssl_ctx;
-#endif
-#ifdef USE_GNUTLS
+#elif defined(USE_GNUTLS)
             tsi->internals = (void *)conn->ssl[i].session;
-#endif
-#ifdef USE_GSKIT
+#elif defined(USE_GSKIT)
             tsi->internals = (void *)conn->ssl[i].handle;
-#endif
-#ifdef USE_NSS
+#elif defined(USE_MBEDTLS)
+            tsi->internals = (void *)conn->ssl[i].ssn;
+#elif defined(USE_NSS)
             tsi->internals = (void *)conn->ssl[i].handle;
-#endif
-#ifdef USE_OPENSSL
+#elif defined(USE_OPENSSL)
             /* Legacy: CURLINFO_TLS_SESSION must return an SSL_CTX pointer. */
             tsi->internals = ((info == CURLINFO_TLS_SESSION) ?
                               (void *)conn->ssl[i].ctx :
                               (void *)conn->ssl[i].handle);
-#endif
-#ifdef USE_POLARSSL
+#elif defined(USE_POLARSSL)
             tsi->internals = (void *)&conn->ssl[i].ssn;
-#endif
-#ifdef USE_SCHANNEL
+#elif defined(USE_SCHANNEL)
             tsi->internals = (void *)&conn->ssl[i].ctxt->ctxt_handle;
+#elif defined(USE_SSL)
+#error "SSL backend specific information missing for CURLINFO_TLS_SSL_PTR"
 #endif
             break;
           }