version 1.38.6.4, 2014/03/12 22:35:02
|
version 1.39, 2011/08/09 07:32:48
|
|
|
# include <openssl/err.h> | # include <openssl/err.h> |
# include <openssl/ssl.h> | # include <openssl/ssl.h> |
# include <openssl/rand.h> | # include <openssl/rand.h> |
|
|
//Include the applink.c to stop crashes as per OpenSSL FAQ |
|
//http://www.openssl.org/support/faq.html#PROG |
|
# ifdef PEGASUS_OS_TYPE_WINDOWS |
|
# include<openssl/applink.c> |
|
# endif |
|
|
|
#else | #else |
# define SSL_CTX void | # define SSL_CTX void |
#endif | #endif |
|
|
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
#ifdef PEGASUS_HAS_SSL |
|
struct FreeX509STOREPtr | struct FreeX509STOREPtr |
{ | { |
void operator()(X509_STORE* ptr) | void operator()(X509_STORE* ptr) |
{ | { |
|
#ifdef PEGASUS_HAS_SSL |
X509_STORE_free(ptr); | X509_STORE_free(ptr); |
|
#endif |
} | } |
}; | }; |
#else |
|
struct FreeX509STOREPtr |
|
{ |
|
void operator()(X509_STORE*) |
|
{ |
|
} |
|
}; |
|
#endif |
|
|
|
| |
#ifdef PEGASUS_HAS_SSL | #ifdef PEGASUS_HAS_SSL |
| |
|
|
if (_instanceCount == 0) | if (_instanceCount == 0) |
{ | { |
_initializeCallbacks(); | _initializeCallbacks(); |
|
|
//important as per following site for |
|
//http://www.openssl.org/support/faq.html#PROG |
|
CRYPTO_malloc_init(); |
|
SSL_library_init(); |
|
SSL_load_error_strings(); | SSL_load_error_strings(); |
|
SSL_library_init(); |
} | } |
| |
_instanceCount++; | _instanceCount++; |
|
|
"In ~SSLEnvironmentInitializer(), _instanceCount is %d", | "In ~SSLEnvironmentInitializer(), _instanceCount is %d", |
_instanceCount)); | _instanceCount)); |
| |
|
|
if (_instanceCount == 0) | if (_instanceCount == 0) |
{ | { |
EVP_cleanup(); |
|
CRYPTO_cleanup_all_ex_data(); |
|
ERR_free_strings(); | ERR_free_strings(); |
_uninitializeCallbacks(); | _uninitializeCallbacks(); |
} | } |
ERR_remove_state(0); |
|
} | } |
| |
private: | private: |
|
|
static void _lockingCallback( | static void _lockingCallback( |
int mode, | int mode, |
int type, | int type, |
const char*, |
const char* file, |
int) |
int line) |
{ | { |
if (mode & CRYPTO_LOCK) | if (mode & CRYPTO_LOCK) |
{ | { |
|
|
const String& crlPath = String::EMPTY, | const String& crlPath = String::EMPTY, |
SSLCertificateVerifyFunction* verifyCert = NULL, | SSLCertificateVerifyFunction* verifyCert = NULL, |
const String& randomFile = String::EMPTY, | const String& randomFile = String::EMPTY, |
const String& cipherSuite = String::EMPTY, |
const String& cipherSuite = String::EMPTY); |
const Boolean& sslCompatibility = false); |
|
| |
SSLContextRep(const SSLContextRep& sslContextRep); | SSLContextRep(const SSLContextRep& sslContextRep); |
| |
|
|
String _crlPath; | String _crlPath; |
String _randomFile; | String _randomFile; |
String _cipherSuite; | String _cipherSuite; |
Boolean _sslCompatibility; |
|
SSL_CTX * _sslContext; | SSL_CTX * _sslContext; |
| |
Boolean _verifyPeer; | Boolean _verifyPeer; |