]> git.pld-linux.org Git - packages/ptlib.git/blob - openssl-1.1.0.patch
- rel 4; fix build & openssl build and disable odbc as seriously conflicting with...
[packages/ptlib.git] / openssl-1.1.0.patch
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
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 @@ -1115,7 +1116,7 @@
27  //
28  
29  
30 -#define PSSLCHANNEL(bio)      ((PSSLChannel *)(bio->ptr))
31 +#define PSSLCHANNEL(bio)      ((PSSLChannel *)BIO_get_data(bio))
32  
33  extern "C" {
34  
35 @@ -1128,10 +1129,9 @@
36  
37  static int Psock_new(BIO * bio)
38  {
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);
46  
47    return(1);
48  }
49 @@ -1142,13 +1142,13 @@
50    if (bio == NULL)
51      return 0;
52  
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();
59      }
60 -    bio->init  = 0;
61 -    bio->flags = 0;
62 +    BIO_set_init(bio, 0);
63 +    BIO_clear_flags(bio, ~0);
64    }
65    return 1;
66  }
67 @@ -1158,11 +1158,11 @@
68  {
69    switch (cmd) {
70      case BIO_CTRL_SET_CLOSE:
71 -      bio->shutdown = (int)num;
72 +      BIO_set_shutdown(bio, (int)num);
73        return 1;
74  
75      case BIO_CTRL_GET_CLOSE:
76 -      return bio->shutdown;
77 +      return BIO_get_shutdown(bio);
78  
79      case BIO_CTRL_FLUSH:
80        return 1;
81 @@ -1237,7 +1237,8 @@
82  };
83  
84  
85 -static BIO_METHOD methods_Psock =
86 +static BIO_METHOD *methods_Psock = NULL;
87 +/*
88  {
89    BIO_TYPE_SOCKET,
90    "PTLib-PSSLChannel",
91 @@ -1259,19 +1260,33 @@
92    Psock_free
93  #endif
94  };
95 -
96 +*/
97  
98  PBoolean PSSLChannel::OnOpen()
99  {
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;
113 +    }
114 +  }
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;
119    }
120  
121    // "Open" then bio
122 -  bio->ptr  = this;
123 -  bio->init = 1;
124 +  BIO_set_data(bio, this);
125 +  BIO_set_init(bio, 1);
126  
127    SSL_set_bio(ssl, bio, bio);
128    return PTrue;
This page took 0.068835 seconds and 3 git commands to generate.