- Move the sessionid flag to ssl_primary_config so that ssl and
proxy_ssl will each have their own sessionid flag.
Regression since HTTPS-Proxy support was added in cb4e2be. Prior to that
this issue had been fixed in 247d890, CVE-2016-5419.
https://github.com/curl/curl/issues/1341
Change-Id: I3e6e176dafc6e6f103e5d9c077835f620783a3b1
12 files changed:
#endif
set->ssh_auth_types = CURLSSH_AUTH_DEFAULT; /* defaults to any auth
type */
#endif
set->ssh_auth_types = CURLSSH_AUTH_DEFAULT; /* defaults to any auth
type */
- set->general_ssl.sessionid = TRUE; /* session ID caching enabled by
+ set->ssl.primary.sessionid = TRUE; /* session ID caching enabled by
default */
set->proxy_ssl = set->ssl;
default */
set->proxy_ssl = set->ssl;
break;
case CURLOPT_SSL_SESSIONID_CACHE:
break;
case CURLOPT_SSL_SESSIONID_CACHE:
- data->set.general_ssl.sessionid = (0 != va_arg(param, long)) ?
+ data->set.ssl.primary.sessionid = (0 != va_arg(param, long)) ?
+ data->set.proxy_ssl.primary.sessionid = data->set.ssl.primary.sessionid;
break;
#ifdef USE_LIBSSH2
break;
#ifdef USE_LIBSSH2
char *random_file; /* path to file containing "random" data */
char *egdsocket; /* path to file containing the EGD daemon socket */
char *cipher_list; /* list of ciphers to use */
char *random_file; /* path to file containing "random" data */
char *egdsocket; /* path to file containing the EGD daemon socket */
char *cipher_list; /* list of ciphers to use */
+ bool sessionid; /* cache session IDs or not */
};
struct ssl_config_data {
};
struct ssl_config_data {
};
struct ssl_general_config {
};
struct ssl_general_config {
- bool sessionid; /* cache session IDs or not */
size_t max_ssl_sessions; /* SSL session id cache size */
};
size_t max_ssl_sessions; /* SSL session id cache size */
};
* 2) setting up callbacks. these seem gnutls specific
*/
* 2) setting up callbacks. these seem gnutls specific
*/
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
const uint8_t *ssl_sessionid;
size_t ssl_idsize;
const uint8_t *ssl_sessionid;
size_t ssl_idsize;
conn->send[sockindex] = axtls_send;
/* Put our freshly minted SSL session in cache */
conn->send[sockindex] = axtls_send;
/* Put our freshly minted SSL session in cache */
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
const uint8_t *ssl_sessionid = ssl_get_session_id(ssl);
size_t ssl_idsize = ssl_get_session_id_size(ssl);
Curl_ssl_sessionid_lock(conn);
const uint8_t *ssl_sessionid = ssl_get_session_id(ssl);
size_t ssl_idsize = ssl_get_session_id_size(ssl);
Curl_ssl_sessionid_lock(conn);
#endif /* HAVE_ALPN */
/* Check if there's a cached ID we can/should use here! */
#endif /* HAVE_ALPN */
/* Check if there's a cached ID we can/should use here! */
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
void *ssl_sessionid = NULL;
Curl_ssl_sessionid_lock(conn);
void *ssl_sessionid = NULL;
Curl_ssl_sessionid_lock(conn);
DEBUGASSERT(ssl_connect_3 == connssl->connecting_state);
DEBUGASSERT(ssl_connect_3 == connssl->connecting_state);
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
bool incache;
SSL_SESSION *our_ssl_sessionid;
void *old_ssl_sessionid = NULL;
bool incache;
SSL_SESSION *our_ssl_sessionid;
void *old_ssl_sessionid = NULL;
#endif /* CURL_BUILD_MAC_10_9 || CURL_BUILD_IOS_7 */
/* Check if there's a cached ID we can/should use here! */
#endif /* CURL_BUILD_MAC_10_9 || CURL_BUILD_IOS_7 */
/* Check if there's a cached ID we can/should use here! */
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
char *ssl_sessionid;
size_t ssl_sessionid_len;
char *ssl_sessionid;
size_t ssl_sessionid_len;
/* This might be a reconnect, so we check for a session ID in the cache
to speed up things */
/* This might be a reconnect, so we check for a session ID in the cache
to speed up things */
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
void *ssl_sessionid;
size_t ssl_idsize;
void *ssl_sessionid;
size_t ssl_idsize;
conn->recv[sockindex] = gtls_recv;
conn->send[sockindex] = gtls_send;
conn->recv[sockindex] = gtls_recv;
conn->send[sockindex] = gtls_send;
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
/* we always unconditionally get the session id here, as even if we
already got it from the cache and asked to use it in the connection, it
might've been rejected and then a new one is in use now and we need to
/* we always unconditionally get the session id here, as even if we
already got it from the cache and asked to use it in the connection, it
might've been rejected and then a new one is in use now and we need to
#endif
/* Check if there's a cached ID we can/should use here! */
#endif
/* Check if there's a cached ID we can/should use here! */
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
void *old_session = NULL;
Curl_ssl_sessionid_lock(conn);
void *old_session = NULL;
Curl_ssl_sessionid_lock(conn);
DEBUGASSERT(ssl_connect_3 == connssl->connecting_state);
DEBUGASSERT(ssl_connect_3 == connssl->connecting_state);
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
int ret;
mbedtls_ssl_session *our_ssl_sessionid;
void *old_ssl_sessionid = NULL;
int ret;
mbedtls_ssl_session *our_ssl_sessionid;
void *old_ssl_sessionid = NULL;
goto error;
/* do not use SSL cache if disabled or we are not going to verify peer */
goto error;
/* do not use SSL cache if disabled or we are not going to verify peer */
- ssl_no_cache = (data->set.general_ssl.sessionid
+ ssl_no_cache = (SSL_SET_OPTION(primary.sessionid)
&& SSL_CONN_CONFIG(verifypeer)) ? PR_FALSE : PR_TRUE;
if(SSL_OptionSet(model, SSL_NO_CACHE, ssl_no_cache) != SECSuccess)
goto error;
&& SSL_CONN_CONFIG(verifypeer)) ? PR_FALSE : PR_TRUE;
if(SSL_OptionSet(model, SSL_NO_CACHE, ssl_no_cache) != SECSuccess)
goto error;
#endif
/* Check if there's a cached ID we can/should use here! */
#endif
/* Check if there's a cached ID we can/should use here! */
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
void *ssl_sessionid = NULL;
Curl_ssl_sessionid_lock(conn);
void *ssl_sessionid = NULL;
Curl_ssl_sessionid_lock(conn);
DEBUGASSERT(ssl_connect_3 == connssl->connecting_state);
DEBUGASSERT(ssl_connect_3 == connssl->connecting_state);
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
bool incache;
SSL_SESSION *our_ssl_sessionid;
void *old_ssl_sessionid = NULL;
bool incache;
SSL_SESSION *our_ssl_sessionid;
void *old_ssl_sessionid = NULL;
ssl_set_ciphersuites(&connssl->ssl, ssl_list_ciphersuites());
/* Check if there's a cached ID we can/should use here! */
ssl_set_ciphersuites(&connssl->ssl, ssl_list_ciphersuites());
/* Check if there's a cached ID we can/should use here! */
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
void *old_session = NULL;
Curl_ssl_sessionid_lock(conn);
void *old_session = NULL;
Curl_ssl_sessionid_lock(conn);
DEBUGASSERT(ssl_connect_3 == connssl->connecting_state);
DEBUGASSERT(ssl_connect_3 == connssl->connecting_state);
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
int ret;
ssl_session *our_ssl_sessionid;
void *old_ssl_sessionid = NULL;
int ret;
ssl_session *our_ssl_sessionid;
void *old_ssl_sessionid = NULL;
connssl->cred = NULL;
/* check for an existing re-usable credential handle */
connssl->cred = NULL;
/* check for an existing re-usable credential handle */
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
Curl_ssl_sessionid_lock(conn);
if(!Curl_ssl_getsessionid(conn, (void **)&old_cred, NULL, sockindex)) {
connssl->cred = old_cred;
Curl_ssl_sessionid_lock(conn);
if(!Curl_ssl_getsessionid(conn, (void **)&old_cred, NULL, sockindex)) {
connssl->cred = old_cred;
#endif
/* save the current session data for possible re-use */
#endif
/* save the current session data for possible re-use */
- if(data->set.general_ssl.sessionid) {
+ if(SSL_SET_OPTION(primary.sessionid)) {
bool incache;
struct curl_schannel_cred *old_cred = NULL;
bool incache;
struct curl_schannel_cred *old_cred = NULL;
CLONE_STRING(egdsocket);
CLONE_STRING(random_file);
CLONE_STRING(clientcert);
CLONE_STRING(egdsocket);
CLONE_STRING(random_file);
CLONE_STRING(clientcert);
+
+ /* Disable dest sessionid cache if a client cert is used, CVE-2016-5419. */
+ dest->sessionid = (dest->clientcert ? false : source->sessionid);
int port = isProxy ? (int)conn->port : conn->remote_port;
*ssl_sessionid = NULL;
int port = isProxy ? (int)conn->port : conn->remote_port;
*ssl_sessionid = NULL;
- DEBUGASSERT(data->set.general_ssl.sessionid);
+ DEBUGASSERT(SSL_SET_OPTION(primary.sessionid));
- if(!data->set.general_ssl.sessionid)
+ if(!SSL_SET_OPTION(primary.sessionid))
/* session ID re-use is disabled */
return TRUE;
/* session ID re-use is disabled */
return TRUE;
&conn->proxy_ssl_config :
&conn->ssl_config;
&conn->proxy_ssl_config :
&conn->ssl_config;
- DEBUGASSERT(data->set.general_ssl.sessionid);
+ DEBUGASSERT(SSL_SET_OPTION(primary.sessionid));
clone_host = strdup(isProxy ? conn->http_proxy.host.name : conn->host.name);
if(!clone_host)
clone_host = strdup(isProxy ? conn->http_proxy.host.name : conn->host.name);
if(!clone_host)