return 1;
}
-static void showtime(struct SessionHandle *data,
+static void showtime(struct Curl_easy *data,
const char *text,
time_t stamp)
{
bool duringconnect,
bool nonblocking)
{
- struct SessionHandle *data = conn->data;
+ struct Curl_easy *data = conn->data;
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
gnutls_session_t session = conn->ssl[sockindex].session;
curl_socket_t sockfd = conn->sock[sockindex];
gtls_connect_step1(struct connectdata *conn,
int sockindex)
{
- struct SessionHandle *data = conn->data;
+ struct Curl_easy *data = conn->data;
gnutls_session_t session;
int rc;
- void *ssl_sessionid;
- size_t ssl_idsize;
bool sni = TRUE; /* default is SNI enabled */
#ifdef ENABLE_IPV6
struct in6_addr addr;
#endif
#ifdef HAS_ALPN
- if(data->set.ssl_enable_alpn) {
+ if(conn->bits.tls_enable_alpn) {
int cur = 0;
gnutls_datum_t protocols[2];
/* This might be a reconnect, so we check for a session ID in the cache
to speed up things */
+ if(conn->ssl_config.sessionid) {
+ void *ssl_sessionid;
+ size_t ssl_idsize;
- if(!Curl_ssl_getsessionid(conn, &ssl_sessionid, &ssl_idsize)) {
- /* we got a session id, use it! */
- gnutls_session_set_data(session, ssl_sessionid, ssl_idsize);
+ Curl_ssl_sessionid_lock(conn);
+ if(!Curl_ssl_getsessionid(conn, &ssl_sessionid, &ssl_idsize)) {
+ /* we got a session id, use it! */
+ gnutls_session_set_data(session, ssl_sessionid, ssl_idsize);
- /* Informational message */
- infof (data, "SSL re-using session ID\n");
+ /* Informational message */
+ infof (data, "SSL re-using session ID\n");
+ }
+ Curl_ssl_sessionid_unlock(conn);
}
return CURLE_OK;
}
-static CURLcode pkp_pin_peer_pubkey(struct SessionHandle *data,
+static CURLcode pkp_pin_peer_pubkey(struct Curl_easy *data,
gnutls_x509_crt_t cert,
const char *pinnedpubkey)
{
unsigned int bits;
time_t certclock;
const char *ptr;
- struct SessionHandle *data = conn->data;
+ struct Curl_easy *data = conn->data;
gnutls_session_t session = conn->ssl[sockindex].session;
int rc;
- bool incache;
- void *ssl_sessionid;
#ifdef HAS_ALPN
gnutls_datum_t proto;
#endif
infof(data, "\t compression: %s\n", ptr);
#ifdef HAS_ALPN
- if(data->set.ssl_enable_alpn) {
+ if(conn->bits.tls_enable_alpn) {
rc = gnutls_alpn_get_selected_protocol(session, &proto);
if(rc == 0) {
infof(data, "ALPN, server accepted to use %.*s\n", proto.size,
conn->recv[sockindex] = gtls_recv;
conn->send[sockindex] = gtls_send;
- {
+ if(conn->ssl_config.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
detect that. */
+ bool incache;
+ void *ssl_sessionid;
void *connect_sessionid;
size_t connect_idsize = 0;
/* extract session ID to the allocated buffer */
gnutls_session_get_data(session, connect_sessionid, &connect_idsize);
+ Curl_ssl_sessionid_lock(conn);
incache = !(Curl_ssl_getsessionid(conn, &ssl_sessionid, NULL));
if(incache) {
/* there was one before in the cache, so instead of risking that the
/* store this session id */
result = Curl_ssl_addsessionid(conn, connect_sessionid, connect_idsize);
+ Curl_ssl_sessionid_unlock(conn);
if(result) {
free(connect_sessionid);
result = CURLE_OUT_OF_MEMORY;
{
ssize_t rc = gnutls_record_send(conn->ssl[sockindex].session, mem, len);
- if(rc < 0 ) {
+ if(rc < 0) {
*curlcode = (rc == GNUTLS_E_AGAIN)
? CURLE_AGAIN
: CURLE_SEND_ERROR;
{
ssize_t result;
int retval = 0;
- struct SessionHandle *data = conn->data;
+ struct Curl_easy *data = conn->data;
int done = 0;
char buf[120];
}
#ifndef USE_GNUTLS_NETTLE
-static int Curl_gtls_seed(struct SessionHandle *data)
+static int Curl_gtls_seed(struct Curl_easy *data)
{
/* we have the "SSL is seeded" boolean static to prevent multiple
time-consuming seedings in vain */
#endif
/* data might be NULL! */
-int Curl_gtls_random(struct SessionHandle *data,
+int Curl_gtls_random(struct Curl_easy *data,
unsigned char *entropy,
size_t length)
{