wok-next diff ptlib/stuff/patches/ptlib-2.10.11-openssl-1.1.0-1.patch @ rev 21569

updated cryptopp (5.6.5 -> 8.2.0)
author Hans-G?nter Theisgen
date Mon Jun 22 16:34:56 2020 +0100 (2020-06-22)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ptlib/stuff/patches/ptlib-2.10.11-openssl-1.1.0-1.patch	Mon Jun 22 16:34:56 2020 +0100
     1.3 @@ -0,0 +1,152 @@
     1.4 +Submitted by:            DJ Lucas (dj_AT_linuxfromscratch_DOT_org)
     1.5 +Date:                    2017-05-27
     1.6 +Initial Package Version: 2.10.11
     1.7 +Upstream Status:         Submitted
     1.8 +Origin:                  https://git.archlinux.org/svntogit/packages.git/plain/trunk/openssl-1.1.0.patch?h=packages/ptlib
     1.9 +Description:             Fixes build with OpenSSL-1.1.0.
    1.10 +
    1.11 +
    1.12 +diff -Naurp ptlib-2.10.11-orig/src/ptclib/pssl.cxx ptlib-2.10.11/src/ptclib/pssl.cxx
    1.13 +--- ptlib-2.10.11-orig/src/ptclib/pssl.cxx	2017-05-27 14:10:00.609612786 -0500
    1.14 ++++ ptlib-2.10.11/src/ptclib/pssl.cxx	2017-05-27 14:11:20.232842073 -0500
    1.15 +@@ -140,7 +140,7 @@ PFACTORY_CREATE_SINGLETON(PProcessStartu
    1.16 + class PSSL_BIO
    1.17 + {
    1.18 +   public:
    1.19 +-    PSSL_BIO(BIO_METHOD *method = BIO_s_file_internal())
    1.20 ++    PSSL_BIO(const BIO_METHOD *method = BIO_s_file())
    1.21 +       { bio = BIO_new(method); }
    1.22 + 
    1.23 +     ~PSSL_BIO()
    1.24 +@@ -627,9 +627,10 @@ PSSLDiffieHellman::PSSLDiffieHellman(con
    1.25 +   if (dh == NULL)
    1.26 +     return;
    1.27 + 
    1.28 +-  dh->p = BN_bin2bn(pData, pSize, NULL);
    1.29 +-  dh->g = BN_bin2bn(gData, gSize, NULL);
    1.30 +-  if (dh->p != NULL && dh->g != NULL)
    1.31 ++  BIGNUM *p = BN_bin2bn(pData, pSize, NULL);
    1.32 ++  BIGNUM *g = BN_bin2bn(gData, gSize, NULL);
    1.33 ++  DH_set0_pqg(dh, p, NULL, g);
    1.34 ++  if (p != NULL && p != NULL)
    1.35 +     return;
    1.36 + 
    1.37 +   DH_free(dh);
    1.38 +@@ -805,13 +806,11 @@ void PSSLContext::Construct(Method metho
    1.39 +   SSL_METHOD * meth;
    1.40 + 
    1.41 +   switch (method) {
    1.42 +-    case SSLv3:
    1.43 +-      meth = SSLv3_method();
    1.44 +-      break;
    1.45 +     case TLSv1:
    1.46 +       meth = TLSv1_method(); 
    1.47 +       break;
    1.48 +     case SSLv23:
    1.49 ++    case SSLv3:
    1.50 +     default:
    1.51 +       meth = SSLv23_method();
    1.52 +       break;
    1.53 +@@ -1117,7 +1116,7 @@ PBoolean PSSLChannel::RawSSLRead(void *
    1.54 + //
    1.55 + 
    1.56 + 
    1.57 +-#define PSSLCHANNEL(bio)      ((PSSLChannel *)(bio->ptr))
    1.58 ++#define PSSLCHANNEL(bio)      ((PSSLChannel *)BIO_get_data(bio))
    1.59 + 
    1.60 + extern "C" {
    1.61 + 
    1.62 +@@ -1130,10 +1129,9 @@ typedef long (*lfptr)();
    1.63 + 
    1.64 + static int Psock_new(BIO * bio)
    1.65 + {
    1.66 +-  bio->init     = 0;
    1.67 +-  bio->num      = 0;
    1.68 +-  bio->ptr      = NULL;    // this is really (PSSLChannel *)
    1.69 +-  bio->flags    = 0;
    1.70 ++  BIO_set_init(bio, 0);
    1.71 ++  BIO_set_data(bio, NULL);
    1.72 ++  BIO_clear_flags(bio, ~0);
    1.73 + 
    1.74 +   return(1);
    1.75 + }
    1.76 +@@ -1144,13 +1142,13 @@ static int Psock_free(BIO * bio)
    1.77 +   if (bio == NULL)
    1.78 +     return 0;
    1.79 + 
    1.80 +-  if (bio->shutdown) {
    1.81 +-    if (bio->init) {
    1.82 ++  if (BIO_get_shutdown(bio)) {
    1.83 ++    if (BIO_get_init(bio)) {
    1.84 +       PSSLCHANNEL(bio)->Shutdown(PSocket::ShutdownReadAndWrite);
    1.85 +       PSSLCHANNEL(bio)->Close();
    1.86 +     }
    1.87 +-    bio->init  = 0;
    1.88 +-    bio->flags = 0;
    1.89 ++    BIO_set_init(bio, 0);
    1.90 ++    BIO_clear_flags(bio, ~0);
    1.91 +   }
    1.92 +   return 1;
    1.93 + }
    1.94 +@@ -1160,11 +1158,11 @@ static long Psock_ctrl(BIO * bio, int cm
    1.95 + {
    1.96 +   switch (cmd) {
    1.97 +     case BIO_CTRL_SET_CLOSE:
    1.98 +-      bio->shutdown = (int)num;
    1.99 ++      BIO_set_shutdown(bio, (int)num);
   1.100 +       return 1;
   1.101 + 
   1.102 +     case BIO_CTRL_GET_CLOSE:
   1.103 +-      return bio->shutdown;
   1.104 ++      return BIO_get_shutdown(bio);
   1.105 + 
   1.106 +     case BIO_CTRL_FLUSH:
   1.107 +       return 1;
   1.108 +@@ -1239,7 +1237,8 @@ static int Psock_puts(BIO * bio, const c
   1.109 + };
   1.110 + 
   1.111 + 
   1.112 +-static BIO_METHOD methods_Psock =
   1.113 ++static BIO_METHOD *methods_Psock = NULL;
   1.114 ++/*
   1.115 + {
   1.116 +   BIO_TYPE_SOCKET,
   1.117 +   "PTLib-PSSLChannel",
   1.118 +@@ -1261,19 +1260,33 @@ static BIO_METHOD methods_Psock =
   1.119 +   Psock_free
   1.120 + #endif
   1.121 + };
   1.122 +-
   1.123 ++*/
   1.124 + 
   1.125 + PBoolean PSSLChannel::OnOpen()
   1.126 + {
   1.127 +-  BIO * bio = BIO_new(&methods_Psock);
   1.128 ++  if (methods_Psock == NULL) {
   1.129 ++    methods_Psock = BIO_meth_new(BIO_TYPE_SOCKET | BIO_get_new_index(), "PTLib-PSSLChannel");
   1.130 ++    if (methods_Psock == NULL ||
   1.131 ++        BIO_meth_set_write(methods_Psock, Psock_write) ||
   1.132 ++	BIO_meth_set_read(methods_Psock, Psock_read) ||
   1.133 ++	BIO_meth_set_puts(methods_Psock, Psock_puts) ||
   1.134 ++	BIO_meth_set_gets(methods_Psock, NULL) ||
   1.135 ++	BIO_meth_set_ctrl(methods_Psock, Psock_ctrl) ||
   1.136 ++	BIO_meth_set_create(methods_Psock, Psock_new) ||
   1.137 ++	BIO_meth_set_destroy(methods_Psock, Psock_free)) {
   1.138 ++      SSLerr(SSL_F_SSL_SET_FD,ERR_R_BUF_LIB);
   1.139 ++      return PFalse;
   1.140 ++    }
   1.141 ++  }
   1.142 ++  BIO * bio = BIO_new(methods_Psock);
   1.143 +   if (bio == NULL) {
   1.144 +     SSLerr(SSL_F_SSL_SET_FD,ERR_R_BUF_LIB);
   1.145 +     return PFalse;
   1.146 +   }
   1.147 + 
   1.148 +   // "Open" then bio
   1.149 +-  bio->ptr  = this;
   1.150 +-  bio->init = 1;
   1.151 ++  BIO_set_data(bio, this);
   1.152 ++  BIO_set_init(bio, 1);
   1.153 + 
   1.154 +   SSL_set_bio(ssl, bio, bio);
   1.155 +   return PTrue;