summaryrefslogtreecommitdiff
path: root/devel/pwlib/patches/patch-ba
blob: fc2fcf5658dfe6763848ed370ce78608e3fb89c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
$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)