Initialize OpenSSL locking functions

This sets up the OpenSSL locking and thread callback functions.
Without this, OpenSSL is not truely thread safe and may randomly crash when used from multiple threads.
That doesn't happen normaly, but if a plugin uses OpenSSL, for example to download something in a thread, it leads to random segfaults in OpenSSL.
Unused variable (which should generate a compiler warning)