diff --git a/uppsrc/Core/SSL/InitExit.cpp b/uppsrc/Core/SSL/InitExit.cpp index c0aa61cf4..287b8bb8e 100644 --- a/uppsrc/Core/SSL/InitExit.cpp +++ b/uppsrc/Core/SSL/InitExit.cpp @@ -6,7 +6,11 @@ namespace Upp { static int64 UPP_SSL_alloc = 0; +#if OPENSSL_VERSION_NUMBER >= 0x10100000L +static void *SslAlloc(size_t size, const char *, int) +#else static void *SslAlloc(size_t size) +#endif { LLOG("Alloc " << size); size_t alloc = size + sizeof(int64); @@ -17,7 +21,11 @@ static void *SslAlloc(size_t size) return aptr; } +#if OPENSSL_VERSION_NUMBER >= 0x10100000L +static void SslFree(void *ptr, const char *, int) +#else static void SslFree(void *ptr) +#endif { if(!ptr) return; @@ -27,7 +35,11 @@ static void SslFree(void *ptr) MemoryFree(aptr); } +#if OPENSSL_VERSION_NUMBER >= 0x10100000L +static void *SslRealloc(void *ptr, size_t size, const char *, int) +#else static void *SslRealloc(void *ptr, size_t size) +#endif { if(!ptr) return NULL; @@ -69,7 +81,9 @@ EXITBLOCK EVP_cleanup(); ENGINE_cleanup(); CRYPTO_cleanup_all_ex_data(); +#if OPENSSL_VERSION_NUMBER < 0x10100000L ERR_remove_state(0); +#endif ERR_free_strings(); STACK_OF(SSL_COMP) *pCOMP = SSL_COMP_get_compression_methods(); @@ -77,7 +91,7 @@ EXITBLOCK sk_SSL_COMP_free( pCOMP ); } -#ifdef _MULTITHREADED +#if defined(_MULTITHREADED) && OPENSSL_VERSION_NUMBER < 0x10100000L static thread__ bool sThreadInit; static thread__ void (*sPrevExit)(); diff --git a/uppsrc/Core/SSL/SSL.h b/uppsrc/Core/SSL/SSL.h index e4a355e36..2e2234fb3 100644 --- a/uppsrc/Core/SSL/SSL.h +++ b/uppsrc/Core/SSL/SSL.h @@ -40,20 +40,20 @@ private: class SslStream { public: - SslStream(BIO *b = NULL) : bio(b) {} - ~SslStream() { Clear(); } + SslStream(BIO *b = NULL) : bio(b) {} + ~SslStream() { Clear(); } - bool IsEmpty() const { return !bio; } + bool IsEmpty() const { return !bio; } - bool Set(BIO *b) { Clear(); return !!(bio = b); } - bool Create(BIO_METHOD *meth) { return Set(BIO_new(meth)); } - void Clear() { if(bio) { BIO_free(bio); bio = NULL; } } + bool Set(BIO *b) { Clear(); return !!(bio = b); } + bool Create(const BIO_METHOD *meth) { return Set(BIO_new(meth)); } + void Clear() { if(bio) { BIO_free(bio); bio = NULL; } } bool OpenBuffer(const char *data, int length); bool CreateBuffer(); String GetResult() const; - operator BIO * () const { return bio; } + operator BIO * () const { return bio; } private: BIO *bio;