$NetBSD: patch-ba,v 1.7 2008/08/17 21:46:06 dholland Exp $ --- src/ptclib/pssl.cxx.orig 2004-04-09 02:52:17.000000000 -0400 +++ src/ptclib/pssl.cxx 2008-08-17 17:30:14.000000000 -0400 @@ -297,14 +297,22 @@ PSSLPrivateKey::PSSLPrivateKey(const PFi PSSLPrivateKey::PSSLPrivateKey(const BYTE * keyData, PINDEX keySize) { +#if OPENSSL_VERSION_NUMBER >= 0x00908000L + key = d2i_AutoPrivateKey(NULL, &keyData, keySize); +#else key = d2i_AutoPrivateKey(NULL, (BYTE **)&keyData, keySize); +#endif } PSSLPrivateKey::PSSLPrivateKey(const PBYTEArray & keyData) { +#if OPENSSL_VERSION_NUMBER >= 0x00908000L const BYTE * keyPtr = keyData; - key = d2i_AutoPrivateKey(NULL, (BYTE **)&keyPtr, keyData.GetSize()); +#else + BYTE * keyPtr = (BYTE *)&keyData; +#endif + key = d2i_AutoPrivateKey(NULL, &keyPtr, keyData.GetSize()); } @@ -472,14 +480,22 @@ PSSLCertificate::PSSLCertificate(const P PSSLCertificate::PSSLCertificate(const BYTE * certData, PINDEX certSize) { - certificate = d2i_X509(NULL, (unsigned char **)&certData, certSize); +#if OPENSSL_VERSION_NUMBER >= 0x00908000L + certificate = d2i_X509(NULL, &certData, certSize); +#else + certificate = d2i_X509(NULL, (BYTE **)&certData, certSize); +#endif } PSSLCertificate::PSSLCertificate(const PBYTEArray & certData) { - const BYTE * certPtr = certData; - certificate = d2i_X509(NULL, (unsigned char **)&certPtr, certData.GetSize()); +#if OPENSSL_VERSION_NUMBER >= 0x00908000L + const BYTE *certPtr = certData; +#else + BYTE *certPtr = (BYTE *)&certData; +#endif + certificate = d2i_X509(NULL, &certPtr, certData.GetSize()); } @@ -488,8 +504,12 @@ PSSLCertificate::PSSLCertificate(const P PBYTEArray certData; PBase64::Decode(certStr, certData); if (certData.GetSize() > 0) { - const BYTE * certPtr = certData; - certificate = d2i_X509(NULL, (unsigned char **)&certPtr, certData.GetSize()); +#if OPENSSL_VERSION_NUMBER >= 0x00908000L + const BYTE *certPtr = certData; +#else + BYTE *certPtr = (BYTE *)&certData; +#endif + certificate = d2i_X509(NULL, &certPtr, certData.GetSize()); } else certificate = NULL; @@ -743,7 +763,7 @@ PSSLDiffieHellman::~PSSLDiffieHellman() DH_free(dh); } -#ifdef __BEOS__ +#if defined(__BEOS__) || ((defined(__NetBSD__) || defined(__APPLE__)) && OPENSSL_VERSION_NUMBER < 0x00908000L) // 2/21/04 Yuri Kiryanov - fix for compiler choke on BeOS for usage of // SSL function d2i_DHparams_bio below in PSSLDiffieHellman::Load #undef d2i_DHparams_bio @@ -862,6 +882,9 @@ PSSLContext::PSSLContext(const void * se InitialisationMutex.Signal(); // create the new SSL context +#if OPENSSL_VERSION_NUMBER >= 0x00909000L + const +#endif SSL_METHOD * meth = SSLv23_method(); context = SSL_CTX_new(meth); if (context == NULL)