Hi all,

 I am developing a network application base on OpenSSL-0.9.8.b, on Redhat
Linux.
 I have added OpenSSL API in my source code, but there is something wrong
when connecting to server. I have traced the source code, find that:
 SSL_CTX_new(SSLv23_client_method()); return NULL.;
 I really cannot figure out the reason return NULL.

 Then I have try another way to initialize SSL:
 I use :
     SSL_library_init();
     SSL_load_error_strings();
 instead
      SSL_load_error_strings();
      ERR_load_BIO_strings();
      OpenSSL_add_all_algorithms();
 the result is even worse: after run
SSL_CTX_new(SSLv23_client_method()); the program will quit with exception.

 So if anyone can tell me why this error happens?How can I initialize
OpenSSL correctly?Any sample code is better.
 Thanks a lot!

 The following is picked out from my source code. Please refer to it.
-----------------------------part of source code
---------------------------------------------
int SSLOpen(ConnectCtrl *ctrl)
{
SSL *ssl;
int result;
SSLOption *pOpt = &(ctrl->sslOpt);


/* SSL Global Initialization */
SSL_load_error_strings();
ERR_load_BIO_strings();
OpenSSL_add_all_algorithms();

/* Create our context*/
_ctx = SSL_CTX_new(SSLv23_client_method());
if(_ctx == NULL)
{
 result = SSL_ERROR_CREATE_NEW_CTX;
 czEmail_Report("SSL create new contex ERROR!", result);
 return result;
}

...

return 0;

}

-----------------------------part of source code
end---------------------------------------------

Reply via email to