[lfs-patches] r3603 - in trunk: balsa transmission

dj at higgs.linuxfromscratch.org dj at higgs.linuxfromscratch.org
Sat Jul 8 22:16:12 PDT 2017


Author: dj
Date: Sat Jul  8 22:16:12 2017
New Revision: 3603

Log:
Add missing balsa-2.5.3-openssl-1.1.0-1.patch and transmission-2.92-openssl-1.1.0-1.patch patches.

Added:
   trunk/balsa/
   trunk/balsa/balsa-2.5.3-openssl-1.1.0-1.patch
   trunk/transmission/transmission-2.92-openssl-1.1.0-1.patch

Added: trunk/balsa/balsa-2.5.3-openssl-1.1.0-1.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/balsa/balsa-2.5.3-openssl-1.1.0-1.patch	Sat Jul  8 22:16:12 2017	(r3603)
@@ -0,0 +1,84 @@
+Submitted by:            DJ Lucas (dj_AT_linuxfromscratch_DOT_org)
+Date:                    2017-07-09
+Initial Package Version: 2.5.3
+Upstream Status:         Comitted
+Origin:                  https://git.gnome.org/browse/balsa/commit/?id=2884d337a44649576235f6b8b81ed10dbfe0f135
+Description:             Fixes build with OpenSSL-1.1.0.
+
+
+diff -Naurp balsa-2.5.3-orig/libbalsa/imap/auth-cram.c balsa-2.5.3/libbalsa/imap/auth-cram.c
+--- balsa-2.5.3-orig/libbalsa/imap/auth-cram.c	2016-12-09 11:59:19.000000000 -0600
++++ balsa-2.5.3/libbalsa/imap/auth-cram.c	2017-05-30 18:16:26.693436302 -0500
+@@ -131,7 +131,7 @@ static void
+ hmac_md5 (const char* password, char* challenge,
+           unsigned char* response)
+ {  
+-  EVP_MD_CTX ctx;
++  EVP_MD_CTX *ctx = EVP_MD_CTX_create();
+   unsigned char ipad[MD5_BLOCK_LEN], opad[MD5_BLOCK_LEN];
+   unsigned char secret[MD5_BLOCK_LEN+1];
+   unsigned int secret_len, chal_len;
+@@ -143,9 +143,9 @@ hmac_md5 (const char* password, char* ch
+   /* passwords longer than MD5_BLOCK_LEN bytes are substituted with their MD5
+    * digests */
+   if (secret_len > MD5_BLOCK_LEN) {
+-	EVP_DigestInit(&ctx, EVP_md5());
+-	EVP_DigestUpdate(&ctx, (const unsigned char*) password, secret_len);
+-	EVP_DigestFinal(&ctx, secret, &secret_len);
++	EVP_DigestInit(ctx, EVP_md5());
++	EVP_DigestUpdate(ctx, (const unsigned char*) password, secret_len);
++	EVP_DigestFinal(ctx, secret, &secret_len);
+   }
+   else
+     strncpy ((char *) secret, password, sizeof (secret));
+@@ -161,14 +161,16 @@ hmac_md5 (const char* password, char* ch
+   }
+ 
+   /* inner hash: challenge and ipadded secret */
+-  EVP_DigestInit(&ctx, EVP_md5());
+-  EVP_DigestUpdate(&ctx, ipad, MD5_BLOCK_LEN);
+-  EVP_DigestUpdate(&ctx, (unsigned char*) challenge, chal_len);
+-  EVP_DigestFinal(&ctx, response, NULL);
++  EVP_DigestInit(ctx, EVP_md5());
++  EVP_DigestUpdate(ctx, ipad, MD5_BLOCK_LEN);
++  EVP_DigestUpdate(ctx, (unsigned char*) challenge, chal_len);
++  EVP_DigestFinal(ctx, response, NULL);
+ 
+   /* outer hash: inner hash and opadded secret */
+-  EVP_DigestInit(&ctx, EVP_md5());
+-  EVP_DigestUpdate(&ctx, opad, MD5_BLOCK_LEN);
+-  EVP_DigestUpdate(&ctx, response, chal_len);
+-  EVP_DigestFinal(&ctx, response, NULL);
++  EVP_DigestInit(ctx, EVP_md5());
++  EVP_DigestUpdate(ctx, opad, MD5_BLOCK_LEN);
++  EVP_DigestUpdate(ctx, response, MD5_DIGEST_LEN);
++  EVP_DigestFinal(ctx, response, NULL);
++
++  EVP_MD_CTX_destroy(ctx);
+ }
+diff -Naurp balsa-2.5.3-orig/libbalsa/imap/pop3.c balsa-2.5.3/libbalsa/imap/pop3.c
+--- balsa-2.5.3-orig/libbalsa/imap/pop3.c	2016-12-09 11:59:19.000000000 -0600
++++ balsa-2.5.3/libbalsa/imap/pop3.c	2017-05-30 18:14:44.660192922 -0500
+@@ -310,16 +310,17 @@ get_apop_stamp(const char *greeting, cha
+ static void
+ compute_auth_hash(char *stamp, char *hash, const char *passwd)
+ {
+-  EVP_MD_CTX ctx;
++  EVP_MD_CTX* ctx = EVP_MD_CTX_create();
+   register unsigned char *dp;
+   register char *cp;
+   unsigned char *ep;
+   unsigned char digest[16];
+   
+-  EVP_DigestInit(&ctx, EVP_md5());
+-  EVP_DigestUpdate(&ctx, stamp, strlen(stamp));
+-  EVP_DigestUpdate(&ctx, passwd, strlen(passwd));
+-  EVP_DigestFinal(&ctx, digest, NULL);
++  EVP_DigestInit(ctx, EVP_md5());
++  EVP_DigestUpdate(ctx, stamp, strlen(stamp));
++  EVP_DigestUpdate(ctx, passwd, strlen(passwd));
++  EVP_DigestFinal(ctx, digest, NULL);
++  EVP_MD_CTX_destroy(ctx);
+   
+   cp = hash;
+   dp = digest;

Added: trunk/transmission/transmission-2.92-openssl-1.1.0-1.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/transmission/transmission-2.92-openssl-1.1.0-1.patch	Sat Jul  8 22:16:12 2017	(r3603)
@@ -0,0 +1,269 @@
+Submitted by:            DJ Lucas (dj_AT_linuxfromscratch_DOT_org)
+Date:                    2017-05-30
+Initial Package Version: 2.92
+Upstream Status:         Committed
+Origin:                  https://github.com/transmission/transmission/commit/f91cf5ad8c677b61ceb0bf5877b87f9e93256dd7
+                         https://github.com/transmission/transmission/commit/8c8386a7f3f482a9c917f51d28e0042e55f56b3e
+Description:             Fixes build issue with OpenSSL-1.1.0.
+
+From f91cf5ad8c677b61ceb0bf5877b87f9e93256dd7 Mon Sep 17 00:00:00 2001
+From: Sebastian Andrzej Siewior <sebastian at breakpoint.cc>
+Date: Mon, 5 Sep 2016 21:49:07 +0000
+Subject: [PATCH] transmission: build against openssl 1.1.0
+
+Signed-off-by: Sebastian Andrzej Siewior <sebastian at breakpoint.cc>
+---
+ libtransmission/crypto-utils-openssl.c | 73 ++++++++++++++++++++++++++++++++--
+ 1 file changed, 69 insertions(+), 4 deletions(-)
+
+diff --git a/libtransmission/crypto-utils-openssl.c b/libtransmission/crypto-utils-openssl.c
+index c4539dc..972e24a 100644
+--- a/libtransmission/crypto-utils-openssl.c
++++ b/libtransmission/crypto-utils-openssl.c
+@@ -229,6 +229,61 @@ tr_rc4_process (tr_rc4_ctx_t   handle,
+ ****
+ ***/
+ 
++#if OPENSSL_VERSION_NUMBER < 0x10100000
++static inline int
++DH_set0_pqg (DH     * dh,
++             BIGNUM * p,
++             BIGNUM * q,
++             BIGNUM * g)
++{
++  /* If the fields p and g in d are NULL, the corresponding input
++   * parameters MUST be non-NULL.  q may remain NULL.
++   */
++  if ((dh->p == NULL && p == NULL)
++      || (dh->g == NULL && g == NULL))
++    return 0;
++
++  if (p != NULL) {
++    BN_free (dh->p);
++    dh->p = p;
++  }
++  if (q != NULL) {
++    BN_free (dh->q);
++    dh->q = q;
++  }
++  if (g != NULL) {
++    BN_free (dh->g);
++    dh->g = g;
++  }
++
++  if (q != NULL) {
++    dh->length = BN_num_bits (q);
++  }
++
++  return 1;
++}
++
++static inline int
++DH_set_length (DH   * dh,
++               long   length)
++{
++	dh->length = length;
++	return 1;
++}
++
++static inline void
++DH_get0_key(const DH      * dh,
++            const BIGNUM ** pub_key,
++            const BIGNUM ** priv_key)
++{
++  if (pub_key != NULL)
++    *pub_key = dh->pub_key;
++  if (priv_key != NULL)
++    *priv_key = dh->priv_key;
++}
++
++#endif
++
+ tr_dh_ctx_t
+ tr_dh_new (const uint8_t * prime_num,
+            size_t          prime_num_length,
+@@ -236,13 +291,19 @@ tr_dh_new (const uint8_t * prime_num,
+            size_t          generator_num_length)
+ {
+   DH * handle = DH_new ();
++  BIGNUM * p, * g;
+ 
+   assert (prime_num != NULL);
+   assert (generator_num != NULL);
++  p = BN_bin2bn (prime_num, prime_num_length, NULL);
++  g = BN_bin2bn (generator_num, generator_num_length, NULL);
+ 
+-  if (!check_pointer (handle->p = BN_bin2bn (prime_num, prime_num_length, NULL)) ||
+-      !check_pointer (handle->g = BN_bin2bn (generator_num, generator_num_length, NULL)))
++  if (!check_pointer (p) ||
++      !check_pointer (g) ||
++      !DH_set0_pqg (handle, p, NULL, g))
+     {
++      BN_free (p);
++      BN_free (g);
+       DH_free (handle);
+       handle = NULL;
+     }
+@@ -267,16 +328,20 @@ tr_dh_make_key (tr_dh_ctx_t   raw_handle,
+ {
+   DH * handle = raw_handle;
+   int dh_size, my_public_key_length;
++  const BIGNUM * hand_pub_key;
+ 
+   assert (handle != NULL);
+   assert (public_key != NULL);
+ 
+-  handle->length = private_key_length * 8;
++
++  DH_set_length(handle, private_key_length * 8);
+ 
+   if (!check_result (DH_generate_key (handle)))
+     return false;
+ 
+-  my_public_key_length = BN_bn2bin (handle->pub_key, public_key);
++  DH_get0_key (handle, &hand_pub_key, NULL);
++
++  my_public_key_length = BN_bn2bin (hand_pub_key, public_key);
+   dh_size = DH_size (handle);
+ 
+   tr_dh_align_key (public_key, my_public_key_length, dh_size);
+From 8c8386a7f3f482a9c917f51d28e0042e55f56b3e Mon Sep 17 00:00:00 2001
+From: Mike Gelfand <mikedld at mikedld.com>
+Date: Wed, 7 Sep 2016 01:09:04 +0300
+Subject: [PATCH] Fix coding style and building with !TR_LIGHTWEIGHT
+
+---
+ libtransmission/crypto-utils-openssl.c | 60 +++++++++++++++++++---------------
+ 1 file changed, 33 insertions(+), 27 deletions(-)
+
+diff --git a/libtransmission/crypto-utils-openssl.c b/libtransmission/crypto-utils-openssl.c
+index 972e24a..9fd2c58 100644
+--- a/libtransmission/crypto-utils-openssl.c
++++ b/libtransmission/crypto-utils-openssl.c
+@@ -14,6 +14,7 @@
+ #include <assert.h>
+ 
+ #include <openssl/bn.h>
++#include <openssl/crypto.h>
+ #include <openssl/dh.h>
+ #include <openssl/err.h>
+ #include <openssl/evp.h>
+@@ -48,7 +49,12 @@ log_openssl_error (const char * file,
+       static bool strings_loaded = false;
+       if (!strings_loaded)
+         {
++#if OPENSSL_VERSION_NUMBER < 0x10100000
+           ERR_load_crypto_strings ();
++#else
++          OPENSSL_init_crypto (OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
++#endif
++
+           strings_loaded = true;
+         }
+ #endif
+@@ -230,6 +236,7 @@ tr_rc4_process (tr_rc4_ctx_t   handle,
+ ***/
+ 
+ #if OPENSSL_VERSION_NUMBER < 0x10100000
++
+ static inline int
+ DH_set0_pqg (DH     * dh,
+              BIGNUM * p,
+@@ -237,28 +244,29 @@ DH_set0_pqg (DH     * dh,
+              BIGNUM * g)
+ {
+   /* If the fields p and g in d are NULL, the corresponding input
+-   * parameters MUST be non-NULL.  q may remain NULL.
++   * parameters MUST be non-NULL. q may remain NULL.
+    */
+-  if ((dh->p == NULL && p == NULL)
+-      || (dh->g == NULL && g == NULL))
++  if ((dh->p == NULL && p == NULL) || (dh->g == NULL && g == NULL))
+     return 0;
+ 
+-  if (p != NULL) {
+-    BN_free (dh->p);
+-    dh->p = p;
+-  }
+-  if (q != NULL) {
+-    BN_free (dh->q);
+-    dh->q = q;
+-  }
+-  if (g != NULL) {
+-    BN_free (dh->g);
+-    dh->g = g;
+-  }
+-
+-  if (q != NULL) {
++  if (p != NULL)
++    {
++      BN_free (dh->p);
++      dh->p = p;
++    }
++  if (q != NULL)
++    {
++      BN_free (dh->q);
++      dh->q = q;
++    }
++  if (g != NULL)
++    {
++      BN_free (dh->g);
++      dh->g = g;
++    }
++
++  if (q != NULL)
+     dh->length = BN_num_bits (q);
+-  }
+ 
+   return 1;
+ }
+@@ -267,8 +275,8 @@ static inline int
+ DH_set_length (DH   * dh,
+                long   length)
+ {
+-	dh->length = length;
+-	return 1;
++  dh->length = length;
++  return 1;
+ }
+ 
+ static inline void
+@@ -295,12 +303,11 @@ tr_dh_new (const uint8_t * prime_num,
+ 
+   assert (prime_num != NULL);
+   assert (generator_num != NULL);
++
+   p = BN_bin2bn (prime_num, prime_num_length, NULL);
+   g = BN_bin2bn (generator_num, generator_num_length, NULL);
+ 
+-  if (!check_pointer (p) ||
+-      !check_pointer (g) ||
+-      !DH_set0_pqg (handle, p, NULL, g))
++  if (!check_pointer (p) || !check_pointer (g) || !DH_set0_pqg (handle, p, NULL, g))
+     {
+       BN_free (p);
+       BN_free (g);
+@@ -328,20 +335,19 @@ tr_dh_make_key (tr_dh_ctx_t   raw_handle,
+ {
+   DH * handle = raw_handle;
+   int dh_size, my_public_key_length;
+-  const BIGNUM * hand_pub_key;
++  const BIGNUM * my_public_key;
+ 
+   assert (handle != NULL);
+   assert (public_key != NULL);
+ 
+-
+   DH_set_length(handle, private_key_length * 8);
+ 
+   if (!check_result (DH_generate_key (handle)))
+     return false;
+ 
+-  DH_get0_key (handle, &hand_pub_key, NULL);
++  DH_get0_key (handle, &my_public_key, NULL);
+ 
+-  my_public_key_length = BN_bn2bin (hand_pub_key, public_key);
++  my_public_key_length = BN_bn2bin (my_public_key, public_key);
+   dh_size = DH_size (handle);
+ 
+   tr_dh_align_key (public_key, my_public_key_length, dh_size);


More information about the patches mailing list