upgpkg: ocaml-topkg 1.0.5-2
[arch-packages.git] / ptlib / trunk / openssl-1.1.0.patch
blob20c4956f937a53142a839d15e41fcb17a07d9fb2
1 --- a/src/ptclib/pssl.cxx 2017-03-28 14:35:23.261060113 +0200
2 +++ b/src/ptclib/pssl.cxx 2017-03-28 14:30:20.593853443 +0200
3 @@ -140,7 +140,7 @@
4 class PSSL_BIO
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); }
11 ~PSSL_BIO()
12 @@ -627,9 +627,10 @@
13 if (dh == NULL)
14 return;
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;
25 DH_free(dh);
26 @@ -1115,7 +1116,7 @@
30 -#define PSSLCHANNEL(bio) ((PSSLChannel *)(bio->ptr))
31 +#define PSSLCHANNEL(bio) ((PSSLChannel *)BIO_get_data(bio))
33 extern "C" {
35 @@ -1128,10 +1129,9 @@
37 static int Psock_new(BIO * bio)
39 - bio->init = 0;
40 - bio->num = 0;
41 - bio->ptr = NULL; // this is really (PSSLChannel *)
42 - bio->flags = 0;
43 + BIO_set_init(bio, 0);
44 + BIO_set_data(bio, NULL);
45 + BIO_clear_flags(bio, ~0);
47 return(1);
49 @@ -1142,13 +1142,13 @@
50 if (bio == NULL)
51 return 0;
53 - if (bio->shutdown) {
54 - if (bio->init) {
55 + if (BIO_get_shutdown(bio)) {
56 + if (BIO_get_init(bio)) {
57 PSSLCHANNEL(bio)->Shutdown(PSocket::ShutdownReadAndWrite);
58 PSSLCHANNEL(bio)->Close();
60 - bio->init = 0;
61 - bio->flags = 0;
62 + BIO_set_init(bio, 0);
63 + BIO_clear_flags(bio, ~0);
65 return 1;
67 @@ -1158,11 +1158,11 @@
69 switch (cmd) {
70 case BIO_CTRL_SET_CLOSE:
71 - bio->shutdown = (int)num;
72 + BIO_set_shutdown(bio, (int)num);
73 return 1;
75 case BIO_CTRL_GET_CLOSE:
76 - return bio->shutdown;
77 + return BIO_get_shutdown(bio);
79 case BIO_CTRL_FLUSH:
80 return 1;
81 @@ -1237,7 +1237,8 @@
85 -static BIO_METHOD methods_Psock =
86 +static BIO_METHOD *methods_Psock = NULL;
87 +/*
89 BIO_TYPE_SOCKET,
90 "PTLib-PSSLChannel",
91 @@ -1259,19 +1260,33 @@
92 Psock_free
93 #endif
96 +*/
98 PBoolean PSSLChannel::OnOpen()
100 - BIO * bio = BIO_new(&methods_Psock);
101 + if (methods_Psock == NULL) {
102 + methods_Psock = BIO_meth_new(BIO_TYPE_SOCKET | BIO_get_new_index(), "PTLib-PSSLChannel");
103 + if (methods_Psock == NULL ||
104 + BIO_meth_set_write(methods_Psock, Psock_write) ||
105 + BIO_meth_set_read(methods_Psock, Psock_read) ||
106 + BIO_meth_set_puts(methods_Psock, Psock_puts) ||
107 + BIO_meth_set_gets(methods_Psock, NULL) ||
108 + BIO_meth_set_ctrl(methods_Psock, Psock_ctrl) ||
109 + BIO_meth_set_create(methods_Psock, Psock_new) ||
110 + BIO_meth_set_destroy(methods_Psock, Psock_free)) {
111 + SSLerr(SSL_F_SSL_SET_FD,ERR_R_BUF_LIB);
112 + return PFalse;
115 + BIO * bio = BIO_new(methods_Psock);
116 if (bio == NULL) {
117 SSLerr(SSL_F_SSL_SET_FD,ERR_R_BUF_LIB);
118 return PFalse;
121 // "Open" then bio
122 - bio->ptr = this;
123 - bio->init = 1;
124 + BIO_set_data(bio, this);
125 + BIO_set_init(bio, 1);
127 SSL_set_bio(ssl, bio, bio);
128 return PTrue;