if ((err = SSL_connect (data->ssl)) != 1) { unsigned long e; SSL_load_error_strings(); while ((e = ERR_get_error()) != 0) { mutt_error ("%s", ERR_reason_error_string(e)); sleep (1); } ssl_socket_close (conn); return -1; }  data->cert = SSL_get_peer_certificate (data->ssl); if (!data->cert) { mutt_error (_("Unable to get certificate from peer")); sleep (1); return -1; }  if (!ssl_check_certificate (data))
if (ssl_negotiate(data))
int ssl_socket_open (CONNECTION * conn){  sslsockdata *data;  int err;  if (raw_socket_open (conn) < 0)    return -1;  data = (sslsockdata *) safe_calloc (1, sizeof (sslsockdata));  conn->sockdata = data;  SSL_library_init();  data->ctx = SSL_CTX_new (SSLv23_client_method ());  /* disable SSL protocols as needed */  if (!option(OPTTLSV1))   {    SSL_CTX_set_options(data->ctx, SSL_OP_NO_TLSv1);  }  if (!option(OPTSSLV2))   {    SSL_CTX_set_options(data->ctx, SSL_OP_NO_SSLv2);  }  if (!option(OPTSSLV3))   {    SSL_CTX_set_options(data->ctx, SSL_OP_NO_SSLv3);  }  data->ssl = SSL_new (data->ctx);  SSL_set_fd (data->ssl, conn->fd);  if ((err = SSL_connect (data->ssl)) != 1)  {    unsigned long e;    SSL_load_error_strings();    while ((e = ERR_get_error()) != 0)    {      mutt_error ("%s", ERR_reason_error_string(e));      sleep (1);    }    ssl_socket_close (conn);    return -1;  }  data->cert = SSL_get_peer_certificate (data->ssl);  if (!data->cert)  {    mutt_error (_("Unable to get certificate from peer"));    sleep (1);    return -1;  }  if (!ssl_check_certificate (data))  {    ssl_socket_close (conn);    return -1;  }  mutt_message (_("SSL connection using %s (%s)"),     SSL_get_cipher_version (data->ssl), SSL_get_cipher_name (data->ssl));  sleep (1);  return 0;}