View | Details | Raw Unified | Return to bug 229023 | Differences between
and this patch

Collapse All | Expand All

(-)devel/ptlib/Makefile (+6 lines)
Lines 46-51 DEBUG_DESC= Install debug library Link Here
46
46
47
.include <bsd.port.options.mk>
47
.include <bsd.port.options.mk>
48
48
49
.if ${OSVERSION} > 1200085
50
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-src_ptclib_pssl.cxx-openssl111
51
.else
52
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-src_ptclib_pssl.cxx
53
.endif
54
49
PLIST_SUB+=	PORTVERSION=${PORTVERSION} \
55
PLIST_SUB+=	PORTVERSION=${PORTVERSION} \
50
		PVERSION_MAJOR=${PVERSION_MAJOR} \
56
		PVERSION_MAJOR=${PVERSION_MAJOR} \
51
		PVERSION_MINOR=${PVERSION_MINOR}
57
		PVERSION_MINOR=${PVERSION_MINOR}
(-)devel/ptlib/files/extra-patch-src_ptclib_pssl.cxx-openssl111 (+143 lines)
Added Link Here
1
--- src/ptclib/pssl.cxx.orig	2013-08-14 18:20:27.000000000 -0500
2
+++ src/ptclib/pssl.cxx	2018-11-06 11:53:45.651466000 -0600
3
@@ -140,7 +140,7 @@
4
 class PSSL_BIO
5
 {
6
   public:
7
-    PSSL_BIO(BIO_METHOD *method = BIO_s_file_internal())
8
+    PSSL_BIO(const BIO_METHOD *method = BIO_s_file())
9
       { bio = BIO_new(method); }
10
 
11
     ~PSSL_BIO()
12
@@ -627,9 +627,10 @@
13
   if (dh == NULL)
14
     return;
15
 
16
-  dh->p = BN_bin2bn(pData, pSize, NULL);
17
-  dh->g = BN_bin2bn(gData, gSize, NULL);
18
-  if (dh->p != NULL && dh->g != NULL)
19
+  BIGNUM *p = BN_bin2bn(pData, pSize, NULL);
20
+  BIGNUM *g = BN_bin2bn(gData, gSize, NULL);
21
+  DH_set0_pqg(dh, p, NULL, g);
22
+  if (p != NULL && p != NULL)
23
     return;
24
 
25
   DH_free(dh);
26
@@ -805,13 +806,11 @@
27
   SSL_METHOD * meth;
28
 
29
   switch (method) {
30
-    case SSLv3:
31
-      meth = SSLv3_method();
32
-      break;
33
     case TLSv1:
34
       meth = TLSv1_method(); 
35
       break;
36
     case SSLv23:
37
+    case SSLv3:
38
     default:
39
       meth = SSLv23_method();
40
       break;
41
@@ -1117,7 +1116,7 @@
42
 //
43
 
44
 
45
-#define PSSLCHANNEL(bio)      ((PSSLChannel *)(bio->ptr))
46
+#define PSSLCHANNEL(bio)      ((PSSLChannel *)BIO_get_data(bio))
47
 
48
 extern "C" {
49
 
50
@@ -1130,10 +1129,9 @@
51
 
52
 static int Psock_new(BIO * bio)
53
 {
54
-  bio->init     = 0;
55
-  bio->num      = 0;
56
-  bio->ptr      = NULL;    // this is really (PSSLChannel *)
57
-  bio->flags    = 0;
58
+  BIO_set_init(bio, 0);
59
+  BIO_set_data(bio, NULL);
60
+  BIO_clear_flags(bio, ~0);
61
 
62
   return(1);
63
 }
64
@@ -1144,13 +1142,13 @@
65
   if (bio == NULL)
66
     return 0;
67
 
68
-  if (bio->shutdown) {
69
-    if (bio->init) {
70
+  if (BIO_get_shutdown(bio)) {
71
+    if (BIO_get_init(bio)) {
72
       PSSLCHANNEL(bio)->Shutdown(PSocket::ShutdownReadAndWrite);
73
       PSSLCHANNEL(bio)->Close();
74
     }
75
-    bio->init  = 0;
76
-    bio->flags = 0;
77
+    BIO_set_init(bio, 0);
78
+    BIO_clear_flags(bio, ~0);
79
   }
80
   return 1;
81
 }
82
@@ -1160,11 +1158,11 @@
83
 {
84
   switch (cmd) {
85
     case BIO_CTRL_SET_CLOSE:
86
-      bio->shutdown = (int)num;
87
+      BIO_set_shutdown(bio, (int)num);
88
       return 1;
89
 
90
     case BIO_CTRL_GET_CLOSE:
91
-      return bio->shutdown;
92
+      return BIO_get_shutdown(bio);
93
 
94
     case BIO_CTRL_FLUSH:
95
       return 1;
96
@@ -1239,7 +1237,8 @@
97
 };
98
 
99
 
100
-static BIO_METHOD methods_Psock =
101
+static BIO_METHOD *methods_Psock = NULL;
102
+/*
103
 {
104
   BIO_TYPE_SOCKET,
105
   "PTLib-PSSLChannel",
106
@@ -1261,19 +1260,33 @@
107
   Psock_free
108
 #endif
109
 };
110
+*/
111
 
112
-
113
 PBoolean PSSLChannel::OnOpen()
114
 {
115
-  BIO * bio = BIO_new(&methods_Psock);
116
+  if (methods_Psock == NULL) {
117
+    methods_Psock = BIO_meth_new(BIO_TYPE_SOCKET | BIO_get_new_index(), "PTLib-PSSLChannel");
118
+    if (methods_Psock == NULL ||
119
+        BIO_meth_set_write(methods_Psock, Psock_write) ||
120
+	BIO_meth_set_read(methods_Psock, Psock_read) ||
121
+	BIO_meth_set_puts(methods_Psock, Psock_puts) ||
122
+	BIO_meth_set_gets(methods_Psock, NULL) ||
123
+	BIO_meth_set_ctrl(methods_Psock, Psock_ctrl) ||
124
+	BIO_meth_set_create(methods_Psock, Psock_new) ||
125
+	BIO_meth_set_destroy(methods_Psock, Psock_free)) {
126
+      SSLerr(SSL_F_SSL_SET_FD,ERR_R_BUF_LIB);
127
+      return PFalse;
128
+    }
129
+  }
130
+  BIO * bio = BIO_new(methods_Psock);
131
   if (bio == NULL) {
132
     SSLerr(SSL_F_SSL_SET_FD,ERR_R_BUF_LIB);
133
     return PFalse;
134
   }
135
 
136
   // "Open" then bio
137
-  bio->ptr  = this;
138
-  bio->init = 1;
139
+  BIO_set_data(bio, this);
140
+  BIO_set_init(bio, 1);
141
 
142
   SSL_set_bio(ssl, bio, bio);
143
   return PTrue;

Return to bug 229023