File h323plus-openssl-1.1-compatibility.patch of Package h323plus
Index: h323plus/src/h323ep.cxx
===================================================================
--- h323plus.orig/src/h323ep.cxx 2016-03-07 12:11:37.000000000 +0100
+++ h323plus/src/h323ep.cxx 2018-01-17 16:07:57.177989087 +0100
@@ -433,8 +433,9 @@ PBoolean H323_TLSContext::SetDHParameter
return false;
};
- dh->p = BN_bin2bn(dh_p, dh_p.GetSize(), NULL);
- dh->g = BN_bin2bn(dh_g, dh_g.GetSize(), NULL);
+ BIGNUM *dhp = BN_bin2bn(dh_p, dh_p.GetSize(), NULL);
+ BIGNUM *dhg = BN_bin2bn(dh_g, dh_g.GetSize(), NULL);
+ DH_set0_pqg(dh, dhp, NULL, dhg);
#if PTLIB_VER < 2120
ssl_ctx_st * m_context = context;
@@ -969,7 +970,6 @@ H323EndPoint::~H323EndPoint()
// OpenSSL Cleanup
EVP_cleanup();
CRYPTO_cleanup_all_ex_data();
- ERR_remove_state(0);
ERR_free_strings();
#endif
Index: h323plus/src/transports.cxx
===================================================================
--- h323plus.orig/src/transports.cxx 2017-05-30 10:29:52.000000000 +0200
+++ h323plus/src/transports.cxx 2018-01-17 16:09:40.459563965 +0100
@@ -1397,9 +1397,6 @@ void H323ListenerTCP::Main()
if (transport != NULL)
new H225TransportThread(endpoint, transport);
}
-#ifdef P_SSL
- ERR_remove_state(0);
-#endif
}
/////////////////////////////////////////////////////////////////////////////
Index: h323plus/src/h235auth1.cxx
===================================================================
--- h323plus.orig/src/h235auth1.cxx 2015-11-27 18:49:50.000000000 +0100
+++ h323plus/src/h235auth1.cxx 2018-01-17 16:51:30.395668643 +0100
@@ -102,7 +102,7 @@ static void hmac_sha (const unsigned cha
char* out, /* output buffer, at least "t" bytes */
int t)
{
- EVP_MD_CTX ictx, octx;
+ EVP_MD_CTX *ictx, *octx;
unsigned char isha[SHA_DIGESTSIZE], osha[SHA_DIGESTSIZE] ;
unsigned char key[SHA_DIGESTSIZE] ;
char buf[SHA_BLOCKSIZE] ;
@@ -112,13 +112,15 @@ static void hmac_sha (const unsigned cha
if (lk > SHA_BLOCKSIZE) {
- EVP_MD_CTX tctx;
-
- EVP_MD_CTX_init(&tctx);
- EVP_DigestInit_ex(&tctx, sha1, NULL);
- EVP_DigestUpdate(&tctx, k, lk);
- EVP_DigestFinal_ex(&tctx, key, NULL);
- EVP_MD_CTX_cleanup(&tctx);
+ EVP_MD_CTX *tctx;
+ tctx = EVP_MD_CTX_new();
+ if (!tctx)
+ return;
+
+ EVP_DigestInit_ex(tctx, sha1, NULL);
+ EVP_DigestUpdate(tctx, k, lk);
+ EVP_DigestFinal_ex(tctx, key, NULL);
+ EVP_MD_CTX_free(tctx);
k = key ;
lk = SHA_DIGESTSIZE ;
@@ -126,34 +128,39 @@ static void hmac_sha (const unsigned cha
/**** Inner Digest ****/
- EVP_MD_CTX_init(&ictx);
- EVP_DigestInit_ex(&ictx, sha1, NULL);
+ ictx = EVP_MD_CTX_new();
+ if (!ictx)
+ return;
+
+ EVP_DigestInit_ex(ictx, sha1, NULL);
/* Pad the key for inner digest */
for (i = 0 ; i < lk ; ++i) buf[i] = (char)(k[i] ^ 0x36);
for (i = lk ; i < SHA_BLOCKSIZE ; ++i) buf[i] = 0x36;
- EVP_DigestUpdate(&ictx, buf, SHA_BLOCKSIZE) ;
- EVP_DigestUpdate(&ictx, d, ld) ;
+ EVP_DigestUpdate(ictx, buf, SHA_BLOCKSIZE) ;
+ EVP_DigestUpdate(ictx, d, ld) ;
- EVP_DigestFinal_ex(&ictx, isha, NULL) ;
- EVP_MD_CTX_cleanup(&ictx);
+ EVP_DigestFinal_ex(ictx, isha, NULL) ;
+ EVP_MD_CTX_free(ictx);
/**** Outer Digest ****/
- EVP_MD_CTX_init(&octx);
- EVP_DigestInit_ex(&octx, sha1, NULL);
+ octx = EVP_MD_CTX_new();
+ if (!octx)
+ return;
+ EVP_DigestInit_ex(octx, sha1, NULL);
/* Pad the key for outer digest */
for (i = 0 ; i < lk ; ++i) buf[i] = (char)(k[i] ^ 0x5C);
for (i = lk ; i < SHA_BLOCKSIZE ; ++i) buf[i] = 0x5C;
- EVP_DigestUpdate(&octx, buf, SHA_BLOCKSIZE) ;
- EVP_DigestUpdate(&octx, isha, SHA_DIGESTSIZE) ;
+ EVP_DigestUpdate(octx, buf, SHA_BLOCKSIZE) ;
+ EVP_DigestUpdate(octx, isha, SHA_DIGESTSIZE) ;
- EVP_DigestFinal_ex(&octx, osha, NULL);
- EVP_MD_CTX_cleanup(&octx);
+ EVP_DigestFinal_ex(octx, osha, NULL);
+ EVP_MD_CTX_free(octx);
/* truncate and print the results */
t = t > SHA_DIGESTSIZE ? SHA_DIGESTSIZE : t ;
@@ -164,15 +171,17 @@ static void hmac_sha (const unsigned cha
static void SHA1(const unsigned char * data, unsigned len, unsigned char * hash)
{
const EVP_MD * sha1 = EVP_sha1();
- EVP_MD_CTX ctx;
- EVP_MD_CTX_init(&ctx);
- if (EVP_DigestInit_ex(&ctx, sha1, NULL)) {
- EVP_DigestUpdate(&ctx, data, len);
- EVP_DigestFinal_ex(&ctx, hash, NULL);
+ EVP_MD_CTX *ctx;
+ ctx = EVP_MD_CTX_new();
+ if (!ctx)
+ return;
+ if (EVP_DigestInit_ex(ctx, sha1, NULL)) {
+ EVP_DigestUpdate(ctx, data, len);
+ EVP_DigestFinal_ex(ctx, hash, NULL);
} else {
PTRACE(1, "H235\tOpenSSH SHA1 implementation failed");
}
- EVP_MD_CTX_cleanup(&ctx);
+ EVP_MD_CTX_free(ctx);
}