Fix errors when OPENSSL_NO_DEPRECATED is defined.
This commit is contained in:
parent
443bc17d13
commit
69e44a4cc6
@ -44,8 +44,10 @@ public:
|
|||||||
for (size_t i = 0; i < mutexes_.size(); ++i)
|
for (size_t i = 0; i < mutexes_.size(); ++i)
|
||||||
mutexes_[i].reset(new asio::detail::mutex);
|
mutexes_[i].reset(new asio::detail::mutex);
|
||||||
::CRYPTO_set_locking_callback(&do_init::openssl_locking_func);
|
::CRYPTO_set_locking_callback(&do_init::openssl_locking_func);
|
||||||
::CRYPTO_set_id_callback(&do_init::openssl_id_func);
|
|
||||||
#endif // (OPENSSL_VERSION_NUMBER < 0x10100000L)
|
#endif // (OPENSSL_VERSION_NUMBER < 0x10100000L)
|
||||||
|
#if (OPENSSL_VERSION_NUMBER < 0x10000000L)
|
||||||
|
::CRYPTO_set_id_callback(&do_init::openssl_id_func);
|
||||||
|
#endif // (OPENSSL_VERSION_NUMBER < 0x10000000L)
|
||||||
|
|
||||||
#if !defined(SSL_OP_NO_COMPRESSION) \
|
#if !defined(SSL_OP_NO_COMPRESSION) \
|
||||||
&& (OPENSSL_VERSION_NUMBER >= 0x00908000L)
|
&& (OPENSSL_VERSION_NUMBER >= 0x00908000L)
|
||||||
@ -62,8 +64,10 @@ public:
|
|||||||
#endif // !defined(SSL_OP_NO_COMPRESSION)
|
#endif // !defined(SSL_OP_NO_COMPRESSION)
|
||||||
// && (OPENSSL_VERSION_NUMBER >= 0x00908000L)
|
// && (OPENSSL_VERSION_NUMBER >= 0x00908000L)
|
||||||
|
|
||||||
#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
|
#if (OPENSSL_VERSION_NUMBER < 0x10000000L)
|
||||||
::CRYPTO_set_id_callback(0);
|
::CRYPTO_set_id_callback(0);
|
||||||
|
#endif // (OPENSSL_VERSION_NUMBER < 0x10000000L)
|
||||||
|
#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
|
||||||
::CRYPTO_set_locking_callback(0);
|
::CRYPTO_set_locking_callback(0);
|
||||||
::ERR_free_strings();
|
::ERR_free_strings();
|
||||||
::EVP_cleanup();
|
::EVP_cleanup();
|
||||||
@ -94,38 +98,33 @@ public:
|
|||||||
// && (OPENSSL_VERSION_NUMBER >= 0x00908000L)
|
// && (OPENSSL_VERSION_NUMBER >= 0x00908000L)
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
#if (OPENSSL_VERSION_NUMBER < 0x10000000L)
|
||||||
static unsigned long openssl_id_func()
|
static unsigned long openssl_id_func()
|
||||||
{
|
{
|
||||||
#if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
|
#if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
|
||||||
return ::GetCurrentThreadId();
|
return ::GetCurrentThreadId();
|
||||||
#else // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
|
#else // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
|
||||||
void* id = instance()->thread_id_;
|
void* id = &errno;
|
||||||
if (id == 0)
|
|
||||||
instance()->thread_id_ = id = &id; // Ugh.
|
|
||||||
ASIO_ASSERT(sizeof(unsigned long) >= sizeof(void*));
|
ASIO_ASSERT(sizeof(unsigned long) >= sizeof(void*));
|
||||||
return reinterpret_cast<unsigned long>(id);
|
return reinterpret_cast<unsigned long>(id);
|
||||||
#endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
|
#endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
|
||||||
}
|
}
|
||||||
|
#endif // (OPENSSL_VERSION_NUMBER < 0x10000000L)
|
||||||
|
|
||||||
|
#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
|
||||||
static void openssl_locking_func(int mode, int n,
|
static void openssl_locking_func(int mode, int n,
|
||||||
const char* /*file*/, int /*line*/)
|
const char* /*file*/, int /*line*/)
|
||||||
{
|
{
|
||||||
#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
|
|
||||||
if (mode & CRYPTO_LOCK)
|
if (mode & CRYPTO_LOCK)
|
||||||
instance()->mutexes_[n]->lock();
|
instance()->mutexes_[n]->lock();
|
||||||
else
|
else
|
||||||
instance()->mutexes_[n]->unlock();
|
instance()->mutexes_[n]->unlock();
|
||||||
#endif // (OPENSSL_VERSION_NUMBER < 0x10100000L)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mutexes to be used in locking callbacks.
|
// Mutexes to be used in locking callbacks.
|
||||||
std::vector<asio::detail::shared_ptr<
|
std::vector<asio::detail::shared_ptr<
|
||||||
asio::detail::mutex> > mutexes_;
|
asio::detail::mutex> > mutexes_;
|
||||||
|
#endif // (OPENSSL_VERSION_NUMBER < 0x10100000L)
|
||||||
#if !defined(ASIO_WINDOWS) && !defined(__CYGWIN__)
|
|
||||||
// The thread identifiers to be used by openssl.
|
|
||||||
asio::detail::tss_ptr<void> thread_id_;
|
|
||||||
#endif // !defined(ASIO_WINDOWS) && !defined(__CYGWIN__)
|
|
||||||
|
|
||||||
#if !defined(SSL_OP_NO_COMPRESSION) \
|
#if !defined(SSL_OP_NO_COMPRESSION) \
|
||||||
&& (OPENSSL_VERSION_NUMBER >= 0x00908000L)
|
&& (OPENSSL_VERSION_NUMBER >= 0x00908000L)
|
||||||
|
@ -21,7 +21,9 @@
|
|||||||
#if !defined(OPENSSL_NO_ENGINE)
|
#if !defined(OPENSSL_NO_ENGINE)
|
||||||
# include <openssl/engine.h>
|
# include <openssl/engine.h>
|
||||||
#endif // !defined(OPENSSL_NO_ENGINE)
|
#endif // !defined(OPENSSL_NO_ENGINE)
|
||||||
|
#include <openssl/dh.h>
|
||||||
#include <openssl/err.h>
|
#include <openssl/err.h>
|
||||||
|
#include <openssl/rsa.h>
|
||||||
#include <openssl/x509v3.h>
|
#include <openssl/x509v3.h>
|
||||||
#include "asio/detail/socket_types.hpp"
|
#include "asio/detail/socket_types.hpp"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user