mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Core/SSL: SSL 1.1 support
git-svn-id: svn://ultimatepp.org/upp/trunk@10927 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
244d4cc57b
commit
7979612296
2 changed files with 22 additions and 8 deletions
|
|
@ -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)();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue