netops: init OpenSSL once under lock

The OpenSSL init functions are not reentrant, which means that running
multiple fetches in parallel can cause us to crash.

Use a mutex to init OpenSSL, and since we're adding this extra checks,
init it only once.
ssl: use locking

When using in a multithreaded context, OpenSSL needs to lock, and leaves
it up to application to provide said locks.

We were not doing this, and it's just luck that's kept us from crashing
up to now.
ssl: cargo-cult thread safety

OpenSSL's tests init everything in the main thread, so let's do that.
ssl: init also without threads
ssl: init everything all the time

Bring together all of the OpenSSL initialization to
git_threads_init() so it's together and doesn't need locks.

Moving it here also gives us libssh2 thread safety (when built against
openssl).
Merge pull request #2421 from libgit2/cmn/init-ssl-once

netops: init OpenSSL once under lock