I have the following code:
setup_ssl (char *server_name, char *port, SSL_CTX *ctx)
{
BIO *output = BIO_new_ssl_connect (ctx);
if (!output)
{
return (NULL);
}
BIO_get_ssl (output, &ssl);
SSL_set_mode (ssl, SSL_MODE_AUTO_RETRY);
SSL_set_verify (ssl, true, NULL);
BIO_set_conn_hostname (output, server_name);
BIO_set_conn_port(output, port);
if (BIO_do_connect (output) <= 0)
{
BIO_free (output);
return (NULL);
}
}
If the server I'm trying to connect to does not have ssl enabled, I get the error:setup_ssl (char *server_name, char *port, SSL_CTX *ctx)
{
BIO *output = BIO_new_ssl_connect (ctx);
if (!output)
{
return (NULL);
}
BIO_get_ssl (output, &ssl);
SSL_set_mode (ssl, SSL_MODE_AUTO_RETRY);
SSL_set_verify (ssl, true, NULL);
BIO_set_conn_hostname (output, server_name);
BIO_set_conn_port(output, port);
if (BIO_do_connect (output) <= 0)
{
BIO_free (output);
return (NULL);
}
}
SSL23_GET_SERVER_HELLO:unknown protocol
SSL_shutdown:shutdown while in init
--
Chris Bare
-- openssl-users mailing list To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users