Add mutexes to make OpenSSL thread safe