SSL context
libcurl offers a special TLS related callback calledCURLOPT_SSL_CTX_FUNCTION
. This option only works for libcurl powered byOpenSSL, wolfSSL or mbedTLS and it does nothing if libcurl is built withanother TLS backend.
This callback gets called by libcurl just before the initialization of a TLSconnection after having processed all other TLS related options to give a lastchance to an application to modify the behavior of the TLS initialization. Thessl_ctx parameter
passed to the callback in the second argument is actuallya pointer to the SSL library'sSSL_CTX
for OpenSSL or wolfSSL, and a pointertombedtls_ssl_config
for mbedTLS. If an error is returned from the callbackno attempt to establish a connection is made and the operation returns thecallback's error code. Set theuserptr
argument with theCURLOPT_SSL_CTX_DATA
option.
This function gets called on all new connections made to a server, during theTLS negotiation. The TLS context points to a newly initialized object eachtime.