wok-next view ptlib/stuff/patches/ptlib-2.10.11-openssl-1.1.0-1.patch @ rev 20655
Up boxbackup (0.12)
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Fri May 04 14:33:10 2018 +0300 (2018-05-04) |
parents | |
children |
line source
1 Submitted by: DJ Lucas (dj_AT_linuxfromscratch_DOT_org)
2 Date: 2017-05-27
3 Initial Package Version: 2.10.11
4 Upstream Status: Submitted
5 Origin: https://git.archlinux.org/svntogit/packages.git/plain/trunk/openssl-1.1.0.patch?h=packages/ptlib
6 Description: Fixes build with OpenSSL-1.1.0.
9 diff -Naurp ptlib-2.10.11-orig/src/ptclib/pssl.cxx ptlib-2.10.11/src/ptclib/pssl.cxx
10 --- ptlib-2.10.11-orig/src/ptclib/pssl.cxx 2017-05-27 14:10:00.609612786 -0500
11 +++ ptlib-2.10.11/src/ptclib/pssl.cxx 2017-05-27 14:11:20.232842073 -0500
12 @@ -140,7 +140,7 @@ PFACTORY_CREATE_SINGLETON(PProcessStartu
13 class PSSL_BIO
14 {
15 public:
16 - PSSL_BIO(BIO_METHOD *method = BIO_s_file_internal())
17 + PSSL_BIO(const BIO_METHOD *method = BIO_s_file())
18 { bio = BIO_new(method); }
20 ~PSSL_BIO()
21 @@ -627,9 +627,10 @@ PSSLDiffieHellman::PSSLDiffieHellman(con
22 if (dh == NULL)
23 return;
25 - dh->p = BN_bin2bn(pData, pSize, NULL);
26 - dh->g = BN_bin2bn(gData, gSize, NULL);
27 - if (dh->p != NULL && dh->g != NULL)
28 + BIGNUM *p = BN_bin2bn(pData, pSize, NULL);
29 + BIGNUM *g = BN_bin2bn(gData, gSize, NULL);
30 + DH_set0_pqg(dh, p, NULL, g);
31 + if (p != NULL && p != NULL)
32 return;
34 DH_free(dh);
35 @@ -805,13 +806,11 @@ void PSSLContext::Construct(Method metho
36 SSL_METHOD * meth;
38 switch (method) {
39 - case SSLv3:
40 - meth = SSLv3_method();
41 - break;
42 case TLSv1:
43 meth = TLSv1_method();
44 break;
45 case SSLv23:
46 + case SSLv3:
47 default:
48 meth = SSLv23_method();
49 break;
50 @@ -1117,7 +1116,7 @@ PBoolean PSSLChannel::RawSSLRead(void *
51 //
54 -#define PSSLCHANNEL(bio) ((PSSLChannel *)(bio->ptr))
55 +#define PSSLCHANNEL(bio) ((PSSLChannel *)BIO_get_data(bio))
57 extern "C" {
59 @@ -1130,10 +1129,9 @@ typedef long (*lfptr)();
61 static int Psock_new(BIO * bio)
62 {
63 - bio->init = 0;
64 - bio->num = 0;
65 - bio->ptr = NULL; // this is really (PSSLChannel *)
66 - bio->flags = 0;
67 + BIO_set_init(bio, 0);
68 + BIO_set_data(bio, NULL);
69 + BIO_clear_flags(bio, ~0);
71 return(1);
72 }
73 @@ -1144,13 +1142,13 @@ static int Psock_free(BIO * bio)
74 if (bio == NULL)
75 return 0;
77 - if (bio->shutdown) {
78 - if (bio->init) {
79 + if (BIO_get_shutdown(bio)) {
80 + if (BIO_get_init(bio)) {
81 PSSLCHANNEL(bio)->Shutdown(PSocket::ShutdownReadAndWrite);
82 PSSLCHANNEL(bio)->Close();
83 }
84 - bio->init = 0;
85 - bio->flags = 0;
86 + BIO_set_init(bio, 0);
87 + BIO_clear_flags(bio, ~0);
88 }
89 return 1;
90 }
91 @@ -1160,11 +1158,11 @@ static long Psock_ctrl(BIO * bio, int cm
92 {
93 switch (cmd) {
94 case BIO_CTRL_SET_CLOSE:
95 - bio->shutdown = (int)num;
96 + BIO_set_shutdown(bio, (int)num);
97 return 1;
99 case BIO_CTRL_GET_CLOSE:
100 - return bio->shutdown;
101 + return BIO_get_shutdown(bio);
103 case BIO_CTRL_FLUSH:
104 return 1;
105 @@ -1239,7 +1237,8 @@ static int Psock_puts(BIO * bio, const c
106 };
109 -static BIO_METHOD methods_Psock =
110 +static BIO_METHOD *methods_Psock = NULL;
111 +/*
112 {
113 BIO_TYPE_SOCKET,
114 "PTLib-PSSLChannel",
115 @@ -1261,19 +1260,33 @@ static BIO_METHOD methods_Psock =
116 Psock_free
117 #endif
118 };
119 -
120 +*/
122 PBoolean PSSLChannel::OnOpen()
123 {
124 - BIO * bio = BIO_new(&methods_Psock);
125 + if (methods_Psock == NULL) {
126 + methods_Psock = BIO_meth_new(BIO_TYPE_SOCKET | BIO_get_new_index(), "PTLib-PSSLChannel");
127 + if (methods_Psock == NULL ||
128 + BIO_meth_set_write(methods_Psock, Psock_write) ||
129 + BIO_meth_set_read(methods_Psock, Psock_read) ||
130 + BIO_meth_set_puts(methods_Psock, Psock_puts) ||
131 + BIO_meth_set_gets(methods_Psock, NULL) ||
132 + BIO_meth_set_ctrl(methods_Psock, Psock_ctrl) ||
133 + BIO_meth_set_create(methods_Psock, Psock_new) ||
134 + BIO_meth_set_destroy(methods_Psock, Psock_free)) {
135 + SSLerr(SSL_F_SSL_SET_FD,ERR_R_BUF_LIB);
136 + return PFalse;
137 + }
138 + }
139 + BIO * bio = BIO_new(methods_Psock);
140 if (bio == NULL) {
141 SSLerr(SSL_F_SSL_SET_FD,ERR_R_BUF_LIB);
142 return PFalse;
143 }
145 // "Open" then bio
146 - bio->ptr = this;
147 - bio->init = 1;
148 + BIO_set_data(bio, this);
149 + BIO_set_init(bio, 1);
151 SSL_set_bio(ssl, bio, bio);
152 return PTrue;