static void
ossl_log_tls12_secret(const SSL *ssl, bool *keylog_done)
{
- const SSL_SESSION *session = SSL_get_session(ssl);
+ const SSL_SESSION *session;
unsigned char client_random[SSL3_RANDOM_SIZE];
unsigned char master_key[SSL_MAX_MASTER_KEY_LENGTH];
int master_key_length = 0;
- if(!session || *keylog_done)
+ ERR_set_mark();
+
+ session = SSL_get_session(ssl);
+
+ if(!session || *keylog_done) {
+ ERR_pop_to_mark();
return;
+ }
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
/* ssl->s3 is not checked in OpenSSL 1.1.0-pre6, but let's assume that
}
#endif
+ ERR_pop_to_mark();
+
/* The handshake has not progressed sufficiently yet, or this is a TLS 1.3
* session (when curl was built with older OpenSSL headers and running with
* newer OpenSSL runtime libraries). */
continue;
x509 = d2i_X509(NULL, &encoded_cert, (long)pContext->cbCertEncoded);
- if(!x509) {
- ERR_clear_error();
+ if(!x509)
continue;
- }
/* Try to import the certificate. This may fail for legitimate
reasons such as duplicate certificate, which is allowed by MS but
!ssl_config->primary.CRLfile &&
!ssl_config->native_ca_store;
+ ERR_set_mark();
+
cached_store = ossl_get_cached_x509_store(cf, data);
if(cached_store && cache_criteria_met && X509_STORE_up_ref(cached_store)) {
SSL_CTX_set_cert_store(ssl_ctx, cached_store);
}
}
+ ERR_pop_to_mark();
+
return result;
}
#else /* HAVE_SSL_X509_STORE_SHARE */
struct Curl_easy *data,
SSL_CTX *ssl_ctx)
{
- X509_STORE *store = SSL_CTX_get_cert_store(ssl_ctx);
+ CURLcode result;
+ X509_STORE *store;
+
+ ERR_set_mark();
- return ossl_populate_x509_store(cf, data, store);
+ store = SSL_CTX_get_cert_store(ssl_ctx);
+ result = ossl_populate_x509_store(cf, data, store);
+
+ ERR_pop_to_mark();
+
+ return result;
}
#endif /* HAVE_SSL_X509_STORE_SHARE */