1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

getinfo: Add support for mbedTLS TLS session info

.. and preprocessor check TLS session info is defined for all backends.
This commit is contained in:
Jay Satiro 2016-02-27 19:01:00 -05:00
parent 6f1735926f
commit 2e0a3b935c
3 changed files with 22 additions and 24 deletions

View 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

View 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")

View 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;
}