From fb62811749ef44ea0a54abd7101c60fa6cc4fe96 Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Wed, 16 Jan 2019 13:58:19 +0000 Subject: [PATCH] - merged openssl 1.1.1 fix from PLD --- openssl.patch | 266 ++++++++++++++++++++++++++++++++++++++++++++++++++ poldek.spec | 6 +- 2 files changed, 270 insertions(+), 2 deletions(-) create mode 100644 openssl.patch 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'; diff --git a/poldek.spec b/poldek.spec index 4e18bda..a88fda6 100644 --- a/poldek.spec +++ b/poldek.spec @@ -14,7 +14,7 @@ %define ver_db_rel 1 %define ver_rpm 4.5-49 -%define rel 6 +%define rel 7 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 @@ -38,6 +38,7 @@ Patch3: WTERMSIG.patch Patch4: %{name}-multiproto.patch Patch5: %{name}-python-fix.patch Patch6: %{name}-libdb.patch +Patch7: openssl.patch URL: http://poldek.pld-linux.org/ BuildRequires: %{db_pkg}-devel >= %{ver_db}-%{ver_db_rel} BuildRequires: autoconf @@ -205,6 +206,7 @@ Moduły języka Python dla poldka. %patch4 -p1 %patch5 -p1 %patch6 -p1 +%patch7 -p1 %{__rm} m4/libtool.m4 m4/lt*.m4 @@ -233,7 +235,7 @@ cd ../trurlib %{__automake} cd .. -CPPFLAGS="%{rpmcppflags} -std=gnu99 -fgnu89-inline" +CPPFLAGS="%{rpmcppflags} -std=gnu99 -fgnu89-inline -D_GNU_SOURCE=1" %configure \ %{?with_static:--enable-static --disable-shared} \ %{!?with_imode:--disable-imode} \ -- 2.46.0