getinfo: access SSL internals via Curl_ssl

In the ongoing endeavor to abstract out all SSL backend-specific
functionality, this is the next step: Instead of hard-coding how the
different SSL backends access their internal data in getinfo.c, let's
implement backend-specific functions to do that task.

This will also allow for switching SSL backends as a runtime option.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin 2017-06-23 16:05:26 +02:00 committed by Daniel Stenberg
parent 118b074fba
commit 69039fd1fa
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
12 changed files with 88 additions and 26 deletions

View file

@ -3394,6 +3394,14 @@ static bool Curl_ossl_cert_status_request(void)
#endif
}
static void *Curl_ossl_get_internals(struct ssl_connect_data *connssl,
CURLINFO info)
{
/* Legacy: CURLINFO_TLS_SESSION must return an SSL_CTX pointer. */
return info == CURLINFO_TLS_SESSION ?
(void *)connssl->ctx : (void *)connssl->handle;
}
const struct Curl_ssl Curl_ssl_openssl = {
"openssl", /* name */
@ -3413,6 +3421,7 @@ const struct Curl_ssl Curl_ssl_openssl = {
Curl_ossl_cert_status_request, /* cert_status_request */
Curl_ossl_connect, /* connect */
Curl_ossl_connect_nonblocking, /* connect_nonblocking */
Curl_ossl_get_internals, /* get_internals */
Curl_ossl_close, /* close */
Curl_ossl_close_all, /* close_all */
Curl_ossl_session_free, /* session_free */