int swClient_ssl_handshake(swClient *cli) { if (!cli->socket->ssl) { if (swSSL_create(cli->socket, cli->ssl_context, SW_SSL_CLIENT) < 0) { return SW_ERR; } #ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME if (cli->ssl_option.tls_host_name) { SSL_set_tlsext_host_name(cli->socket->ssl, cli->ssl_option.tls_host_name); } #endif } if (swSSL_connect(cli->socket) < 0) { return SW_ERR; } if (cli->socket->ssl_state == SW_SSL_STATE_READY && cli->ssl_option.verify_peer) { if (swClient_ssl_verify(cli, cli->ssl_option.allow_self_signed) < 0) { return SW_ERR; } } return SW_OK; }
static int swClient_ssl_handshake(swClient *cli) { if (!cli->socket->ssl) { if (swSSL_create(cli->socket, cli->ssl_context, SW_SSL_CLIENT) < 0) { return SW_ERR; } } if (swSSL_connect(cli->socket) < 0) { return SW_ERR; } return SW_OK; }