Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenSSL: Unable to create SSL_CTX * using SSL_CTX_new()

Tags:

c

linux

ssl

openssl

Following the instructions on page , I am trying to use openSSL to connect client/server in secure manner.

I am not able to create the SSL_CTX as follows:

 /* OpenSSL headers */

 #include "openssl/bio.h"
 #include "openssl/ssl.h"
 #include "openssl/err.h"

 int main()
 {

       /* Initializing OpenSSL */

       SSL_load_error_strings();
       ERR_load_BIO_strings();
       OpenSSL_add_all_algorithms();

       SSL_CTX * ctx = SSL_CTX_new(SSLv23_client_method());

       .....
  }

The ctx reference always turns out to be NULL. Can anyone please tell what step am I missing?

Thanks.

Update

On checking error, the message was

 Error: library has no ciphers
like image 768
Jake Avatar asked Apr 15 '12 16:04

Jake


1 Answers

I used the following call at start of main() function:

SSL_library_init();

Solution found at: here

like image 58
Jake Avatar answered Oct 30 '22 05:10

Jake