Foobar
Foobar

Reputation: 8467

Correct order of methods to load OpenSSL?

There are several initialization methods in OpenSSL

OpenSSL_add_all_algorithms(); /* Load cryptos, et.al. */
SSL_load_error_strings();     /* Bring in and register error messages */
SSL_library_init();

Is there a specific order in which they have to be called, if I am using TLS?

Upvotes: 1

Views: 2868

Answers (1)

Cinder Biscuits
Cinder Biscuits

Reputation: 5241

This question is a little vague, yet:

The order of SSL_load_error_strings() and OpenSSL_add_all_algorithms() doesn't technically matter.

If you are using OpenSSL 1.1.0 or newer, you do not need to call OpenSSL_add_all_algorithms() at all. The function has been deprecated and superseded by OPENSSL_init_crypto().

This suggests initialization be performed in this order:

[first, set up threading callbacks if your program is multithreaded]
SSL_load_error_strings ();
SSL_library_init ();
OpenSSL_add_all_algorithms ();
OPENSSL_config (NULL);

You may also want to check out what it says in the OpenSSL Wiki on initialization

Upvotes: 1

Related Questions