[packages/poldek] -rel 11; fix build with openssl 1.1.1

arekm arekm at pld-linux.org
Fri Sep 14 18:59:27 CEST 2018


commit bc8085e57b94003f7d50b7e428f610c632ff94ec
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Fri Sep 14 18:59:19 2018 +0200

    -rel 11; fix build with openssl 1.1.1

 openssl.patch | 266 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 poldek.spec   |   4 +-
 2 files changed, 269 insertions(+), 1 deletion(-)
---
diff --git a/poldek.spec b/poldek.spec
index 8bd6d6a..bcc81e6 100644
--- a/poldek.spec
+++ b/poldek.spec
@@ -34,7 +34,7 @@
 %define		ver_rpm		5.4.10
 %endif
 
-%define		rel	10
+%define		rel	11
 Summary:	RPM packages management helper tool
 Summary(hu.UTF-8):	RPM csomagkezelést segítő eszköz
 Summary(pl.UTF-8):	Pomocnicze narzędzie do zarządzania pakietami RPM
@@ -68,6 +68,7 @@ Patch4:		%{name}-multiproto.patch
 Patch5:		python-fix.patch
 Patch6:		poldek-ext-down-enable.patch
 Patch7:		multiple-options.patch
+Patch8:		openssl.patch
 URL:		http://poldek.pld-linux.org/
 BuildRequires:	%{db_pkg}-devel >= %{ver_db}-%{ver_db_rel}
 BuildRequires:	autoconf
@@ -236,6 +237,7 @@ Moduły języka Python dla poldka.
 %patch5 -p1
 %patch6 -p1
 %patch7 -p1
+%patch8 -p1
 
 %{__rm} m4/libtool.m4 m4/lt*.m4
 
diff --git a/openssl.patch b/openssl.patch
new file mode 100644
index 0000000..559704d
--- /dev/null
+++ b/openssl.patch
@@ -0,0 +1,266 @@
+--- poldek-0.32.2/tndb/read.c~	2016-01-30 17:59:59.000000000 +0100
++++ poldek-0.32.2/tndb/read.c	2018-09-14 18:35:56.516594794 +0200
+@@ -53,20 +53,22 @@ static
+ int md5(FILE *stream, unsigned char *md, unsigned *md_size)
+ {
+     unsigned char buf[8*1024];
+-    EVP_MD_CTX ctx;
++    EVP_MD_CTX *ctx;
+     unsigned n, nn = 0;
+ 
+ 
+     n_assert(md_size && *md_size);
+ 
+-    EVP_DigestInit(&ctx, EVP_md5());
++    ctx = EVP_MD_CTX_create();
++    if (!EVP_DigestInit(ctx, EVP_md5()))
++        return 0;
+ 
+     while ((n = fread(buf, 1, sizeof(buf), stream)) > 0) {
+-        EVP_DigestUpdate(&ctx, buf, n);
++        EVP_DigestUpdate(ctx, buf, n);
+         nn += n; 
+     }
+     
+-    EVP_DigestFinal(&ctx, buf, &n);
++    EVP_DigestFinal(ctx, buf, &n);
+ 
+     if (n > *md_size) {
+         *md = '\0';
+@@ -75,7 +77,9 @@ int md5(FILE *stream, unsigned char *md,
+         memcpy(md, buf, n);
+         *md_size = n;
+     }
+-    
++
++    EVP_MD_CTX_destroy(ctx);
++
+     return *md_size;
+ }
+ 
+--- poldek-0.32.2/tndb/tndb.c~	2016-01-30 17:59:59.000000000 +0100
++++ poldek-0.32.2/tndb/tndb.c	2018-09-14 18:40:57.805504132 +0200
+@@ -85,13 +85,13 @@ char *tndb_bin2hex_s(const unsigned char
+ //static
+ void tndb_sign_init(struct tndb_sign *sign) 
+ {
+-    EVP_MD_CTX ctx;
++    EVP_MD_CTX *ctx;
+     
+     memset(sign, 0, sizeof(*sign));
+     
+-    EVP_DigestInit(&ctx, EVP_sha1());
+-    sign->ctx = n_malloc(sizeof(ctx));
+-    memcpy(sign->ctx, &ctx, sizeof(ctx));
++    ctx = EVP_MD_CTX_create();
++    EVP_DigestInit(ctx, EVP_sha1());
++    sign->ctx = ctx;
+     //printf("%p %p >> INIT\n", sign, sign->ctx);
+ }
+ 
+@@ -122,8 +122,8 @@ void tndb_sign_final(struct tndb_sign *s
+         *sign->md = '\0';
+     else
+         memcpy(sign->md, buf, n);
+-    
+-    free(sign->ctx);
++   
++    EVP_MD_CTX_destroy((EVP_MD_CTX *)sign->ctx); 
+     sign->ctx = NULL;
+     
+ }
+--- poldek-0.32.2/pkgdir/pdir/digest.c~	2016-01-30 15:05:57.000000000 +0100
++++ poldek-0.32.2/pkgdir/pdir/digest.c	2018-09-14 18:52:42.783229333 +0200
+@@ -195,12 +195,13 @@ int hdr_digest(tn_stream *st, unsigned c
+     int             nread, len, endvhdr_found = 0;
+     unsigned char   buf[256];
+     char            line[4096];
+-    EVP_MD_CTX      ctx;
++    EVP_MD_CTX      *ctx;
+     unsigned        n;
+ 
+     
+     n_assert(md_size && *md_size);
+-    EVP_DigestInit(&ctx, EVP_sha1());
++    ctx = EVP_MD_CTX_create();
++    EVP_DigestInit(ctx, EVP_sha1());
+ 
+     len = strlen(pdir_tag_endvarhdr);
+     n = 0;
+@@ -208,7 +209,7 @@ int hdr_digest(tn_stream *st, unsigned c
+     while ((nread = n_stream_gets(st, line, sizeof(line))) > 0) {
+         char *p = line;
+ 
+-        EVP_DigestUpdate(&ctx, line, nread);
++        EVP_DigestUpdate(ctx, line, nread);
+         if (_ctx)
+             EVP_DigestUpdate(_ctx, line, nread);
+         n++;
+@@ -228,7 +229,8 @@ int hdr_digest(tn_stream *st, unsigned c
+             break;
+     }
+ 
+-    EVP_DigestFinal(&ctx, buf, &n);
++    EVP_DigestFinal(ctx, buf, &n);
++    EVP_MD_CTX_destroy(ctx);
+     
+     if (!endvhdr_found) {
+         logn(LOGERR, _("broken index"));
+@@ -251,22 +253,24 @@ static
+ int digest(tn_stream *st, unsigned char *md, int *md_size, EVP_MD_CTX *_ctx)
+ {
+     unsigned char buf[16*1024];
+-    EVP_MD_CTX ctx;
++    EVP_MD_CTX *ctx;
+     int n, nn = 0;
+ 
+ 
+     n_assert(md_size && *md_size);
+ 
+-    EVP_DigestInit(&ctx, EVP_sha1());
++    ctx = EVP_MD_CTX_create();
++    EVP_DigestInit(ctx, EVP_sha1());
+ 
+     while ((n = n_stream_read(st, buf, sizeof(buf))) > 0) {
+-        EVP_DigestUpdate(&ctx, buf, n);
++        EVP_DigestUpdate(ctx, buf, n);
+         if (_ctx)
+             EVP_DigestUpdate(_ctx, buf, n);
+         nn += n; 
+     }
+     
+-    EVP_DigestFinal(&ctx, buf, &n);
++    EVP_DigestFinal(ctx, buf, &n);
++    EVP_MD_CTX_destroy(ctx);
+ 
+     if (n > *md_size) {
+         *md = '\0';
+@@ -288,7 +292,7 @@ int pdir_digest_calc(struct pdir_digest
+     unsigned char   mdh[64], mdd[64], md[64], mdhex[64];
+     int             mdh_size = sizeof(mdh), mdd_size = sizeof(mdd),
+                     md_size = sizeof(md);
+-    EVP_MD_CTX      ctx, *ctxp;
++    EVP_MD_CTX      *ctx, *ctxp;
+     int             is_err = 0, n;
+ 
+     
+@@ -300,27 +304,34 @@ int pdir_digest_calc(struct pdir_digest
+     
+     ctxp = NULL;
+     if (flags & CALC_MD) {
+-        EVP_DigestInit(&ctx, EVP_sha1());
+-        ctxp = &ctx;
++        ctx = EVP_MD_CTX_create();
++        EVP_DigestInit(ctx, EVP_sha1());
++        ctxp = ctx;
+     }
+     
+     if ((flags & CALC_MDD) == 0) { /* no separate header && body digests */
+         if (!digest(st, mdd, &mdd_size, ctxp)) {
+-            if (ctxp)
+-                EVP_DigestFinal(&ctx, md, &md_size);
++            if (ctxp) {
++                EVP_DigestFinal(ctx, md, &md_size);
++                EVP_MD_CTX_destroy(ctx);
++            }
+             return 0;
+         }
+         
+     } else {
+         if (!hdr_digest(st, mdh, &mdh_size, ctxp)) {
+-            if (ctxp)
+-                EVP_DigestFinal(&ctx, md, &md_size);
++            if (ctxp) {
++                EVP_DigestFinal(ctx, md, &md_size);
++                EVP_MD_CTX_destroy(ctx);
++            }
+             return 0;
+         }
+         
+         if (!digest(st, mdd, &mdd_size, ctxp)) {
+-            if (ctxp)
+-                EVP_DigestFinal(&ctx, md, &md_size);
++            if (ctxp) {
++                EVP_DigestFinal(ctx, md, &md_size);
++                EVP_MD_CTX_destroy(ctx);
++            }
+             return 0;
+         }
+     }
+@@ -336,7 +347,8 @@ int pdir_digest_calc(struct pdir_digest
+     }
+     
+     if (ctxp) {
+-        EVP_DigestFinal(&ctx, md, &md_size);
++        EVP_DigestFinal(ctx, md, &md_size);
++        EVP_MD_CTX_destroy(ctx);
+         n = bin2hex(mdhex, sizeof(mdhex), md, md_size);
+         if (n != PDIR_DIGEST_SIZE)
+             is_err = 1;
+--- poldek-0.32.2/pkgdir/pndir/digest.c~	2016-01-30 15:05:57.000000000 +0100
++++ poldek-0.32.2/pkgdir/pndir/digest.c	2018-09-14 18:53:40.521640846 +0200
+@@ -241,12 +241,13 @@ int pndir_digest_calc_pkgs(struct pndir_
+ int pndir_digest_calc(struct pndir_digest *pdg, tn_array *keys)
+ {
+     unsigned char md[256];
+-    EVP_MD_CTX ctx;
++    EVP_MD_CTX *ctx;
+     int i, n, nn = 0;
+ 
+ 
+-    EVP_DigestInit(&ctx, EVP_sha1());
+-    EVP_DigestUpdate(&ctx, "md", strlen("md"));
++    ctx = EVP_MD_CTX_create();
++    EVP_DigestInit(ctx, EVP_sha1());
++    EVP_DigestUpdate(ctx, "md", strlen("md"));
+     
+     if (keys && n_array_size(keys)) {
+         n_array_sort(keys);
+@@ -254,11 +255,12 @@ int pndir_digest_calc(struct pndir_diges
+         for (i=0; i < n_array_size(keys); i++) {
+             char *key = n_array_nth(keys, i);
+             DBGF("key = %s\n", key);
+-            EVP_DigestUpdate(&ctx, key, strlen(key));
++            EVP_DigestUpdate(ctx, key, strlen(key));
+         }
+     }
+     
+-    EVP_DigestFinal(&ctx, md, &n);
++    EVP_DigestFinal(ctx, md, &n);
++    EVP_MD_CTX_destroy(ctx);
+ 
+     if (n > (int)sizeof(pdg->md))
+         return 0;
+--- poldek-0.32.2/misc.c~	2016-01-30 15:05:57.000000000 +0100
++++ poldek-0.32.2/misc.c	2018-09-14 18:55:01.440752874 +0200
+@@ -80,23 +80,25 @@ static
+ int mdigest(FILE *stream, unsigned char *md, unsigned *md_size, int digest_type)
+ {
+     unsigned char buf[8*1024];
+-    EVP_MD_CTX ctx;
++    EVP_MD_CTX *ctx;
+     unsigned n, nn = 0;
+ 
+ 
+     n_assert(md_size && *md_size);
+ 
++    ctx = EVP_MD_CTX_create();
+     if (digest_type == DIGEST_MD5) 
+-        EVP_DigestInit(&ctx, EVP_md5());
++        EVP_DigestInit(ctx, EVP_md5());
+     else
+-        EVP_DigestInit(&ctx, EVP_sha1());
++        EVP_DigestInit(ctx, EVP_sha1());
+ 
+     while ((n = fread(buf, 1, sizeof(buf), stream)) > 0) {
+-        EVP_DigestUpdate(&ctx, buf, n);
++        EVP_DigestUpdate(ctx, buf, n);
+         nn += n; 
+     }
+     
+-    EVP_DigestFinal(&ctx, buf, &n);
++    EVP_DigestFinal(ctx, buf, &n);
++    EVP_MD_CTX_destroy(ctx);
+ 
+     if (n > *md_size) {
+         *md = '\0';
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/poldek.git/commitdiff/bc8085e57b94003f7d50b7e428f610c632ff94ec



More information about the pld-cvs-commit mailing list