[packages/libdomainkeys] - rel 3; fix openssl build

arekm arekm at pld-linux.org
Fri Sep 14 21:18:20 CEST 2018


commit 0b35df2ead77bfee132c88109c001ba079da27cd
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Fri Sep 14 21:18:13 2018 +0200

    - rel 3; fix openssl build

 libdomainkeys.spec |   4 +-
 openssl.patch      | 132 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 135 insertions(+), 1 deletion(-)
---
diff --git a/libdomainkeys.spec b/libdomainkeys.spec
index d86cd7f..f2bc64d 100644
--- a/libdomainkeys.spec
+++ b/libdomainkeys.spec
@@ -2,7 +2,7 @@ Summary:	DomainKey Library for email servers & clients
 Summary(pl.UTF-8):	Biblioteka DomainKey dla serwerów i klientów poczty elektronicznej
 Name:		libdomainkeys
 Version:	0.69
-Release:	2
+Release:	3
 License:	Yahoo! DomainKeys Public License Agreement v1.1
 Group:		Libraries
 Source0:	http://downloads.sourceforge.net/domainkeys/%{name}-%{version}.tar.gz
@@ -10,6 +10,7 @@ Source0:	http://downloads.sourceforge.net/domainkeys/%{name}-%{version}.tar.gz
 Patch0:		%{name}-libtool.patch
 Patch1:		%{name}-segv.patch
 Patch2:		%{name}-dknewkey.patch
+Patch3:		openssl.patch
 URL:		http://domainkeys.sourceforge.net/
 BuildRequires:	libtool >= 2:1.5
 BuildRequires:	openssl-devel
@@ -52,6 +53,7 @@ Statyczna biblioteka libdomainkeys.
 %patch0 -p1
 %patch1 -p1
 %patch2 -p1
+%patch3 -p1
 
 %build
 %{__make} \
diff --git a/openssl.patch b/openssl.patch
new file mode 100644
index 0000000..a79c3f6
--- /dev/null
+++ b/openssl.patch
@@ -0,0 +1,132 @@
+--- libdomainkeys-0.69/domainkeys.c~	2018-09-14 21:04:26.000000000 +0200
++++ libdomainkeys-0.69/domainkeys.c	2018-09-14 21:13:25.324514075 +0200
+@@ -120,7 +120,7 @@ typedef struct
+ {
+ /* STARTPRIV */
+   int dkmarker;     /* in case somebody casts in */
+-  EVP_MD_CTX mdctx;   /* the hash */
++  EVP_MD_CTX *mdctx;   /* the hash */
+   int signing;      /* our current signing/verifying state */
+   int in_headers;   /* true if we're still processing headers */
+   char *header;     /* points to a malloc'ed block for header. */
+@@ -503,7 +503,14 @@ DK *dk_sign(DK_LIB *dklib, DK_STAT *stat
+     return NULL;
+   }
+   dk->canon = canon; /* TC13-simple, TC13-nofws */
+-  EVP_SignInit(&dk->mdctx, dklib->md);
++  dk->mdctx = EVP_MD_CTX_create();
++  if (!EVP_SignInit(dk->mdctx, dklib->md)) {
++    if (statp)
++    {
++      *statp = DKERR(DK_STAT_NORESOURCE);
++    }
++    return NULL;
++  }
+ 
+   if (statp)
+   {
+@@ -541,7 +548,14 @@ DK *dk_verify(DK_LIB *dklib, DK_STAT *st
+     }
+     return NULL;
+   }
+-  EVP_VerifyInit(&dk->mdctx, dklib->md);
++  dk->mdctx = EVP_MD_CTX_create();
++  if (!EVP_VerifyInit(dk->mdctx, dklib->md)) {
++    if (statp)
++    {
++      *statp = DKERR(DK_STAT_NORESOURCE);
++    }
++    return NULL;
++  }
+ 
+   if (statp)
+   {
+@@ -928,14 +942,14 @@ static void dkhash(DK *dk, const unsigne
+     {
+ 
+ #ifndef DK_HASH_BUFF
+-      EVP_DigestUpdate(&dk->mdctx, "\r\n", 2);
++      EVP_DigestUpdate(dk->mdctx, "\r\n", 2);
+ #else
+       /* buffer hack */
+       dk->hash_buff[dk->hash_buff_len++] = '\r';
+       dk->hash_buff[dk->hash_buff_len++] = '\n';
+       if (dk->hash_buff_len >= (DK_BLOCK - 1))
+       {
+-        EVP_DigestUpdate(&dk->mdctx, dk->hash_buff, dk->hash_buff_len);
++        EVP_DigestUpdate(dk->mdctx, dk->hash_buff, dk->hash_buff_len);
+         dk->hash_buff_len = 0;
+       }
+       /* buffer hack */
+@@ -955,13 +969,13 @@ static void dkhash(DK *dk, const unsigne
+       if (dk->canon == DK_CANON_SIMPLE)//if nofws we ignore \r
+       {
+ #ifndef DK_HASH_BUFF
+-        EVP_DigestUpdate(&dk->mdctx, "\r", 1);
++        EVP_DigestUpdate(dk->mdctx, "\r", 1);
+ #else
+         /* buffer hack */
+         dk->hash_buff[dk->hash_buff_len++] = '\r';
+         if (dk->hash_buff_len >= (DK_BLOCK - 1))
+         {
+-          EVP_DigestUpdate(&dk->mdctx, dk->hash_buff, dk->hash_buff_len);
++          EVP_DigestUpdate(dk->mdctx, dk->hash_buff, dk->hash_buff_len);
+           dk->hash_buff_len = 0;
+         }
+         /* buffer hack */
+@@ -977,13 +991,13 @@ static void dkhash(DK *dk, const unsigne
+       dk->state --;
+     }
+ #ifndef DK_HASH_BUFF
+-    EVP_DigestUpdate(&dk->mdctx, ptr, 1);
++    EVP_DigestUpdate(dk->mdctx, ptr, 1);
+ #else
+     /* buffer hack */
+     dk->hash_buff[dk->hash_buff_len++] = *ptr;
+     if (dk->hash_buff_len >= (DK_BLOCK - 1))
+     {
+-      EVP_DigestUpdate(&dk->mdctx, dk->hash_buff, dk->hash_buff_len);
++      EVP_DigestUpdate(dk->mdctx, dk->hash_buff, dk->hash_buff_len);
+       dk->hash_buff_len = 0;
+     }
+     /* buffer hack */
+@@ -1749,10 +1763,10 @@ DK_STAT dk_end(DK *dk, DK_FLAGS *dkf)
+     //clean out hash buffer
+     dk->hash_buff[dk->hash_buff_len++] = '\r';
+     dk->hash_buff[dk->hash_buff_len++] = '\n';
+-    EVP_DigestUpdate(&dk->mdctx, dk->hash_buff, dk->hash_buff_len);
++    EVP_DigestUpdate(dk->mdctx, dk->hash_buff, dk->hash_buff_len);
+     dk->hash_buff_len = 0;
+ #else
+-    EVP_DigestUpdate(&dk->mdctx, "\r\n", 2);
++    EVP_DigestUpdate(dk->mdctx, "\r\n", 2);
+ #endif
+ #ifdef DK_DEBUG
+     fprintf(stderr,"\r\n");
+@@ -1952,7 +1966,7 @@ DK_STAT dk_end(DK *dk, DK_FLAGS *dkf)
+       }
+ 
+       /* using that key, verify that the digest is properly signed */
+-      i = EVP_VerifyFinal(&dk->mdctx, md_value, md_len, publickey);
++      i = EVP_VerifyFinal(dk->mdctx, md_value, md_len, publickey);
+ 
+       if (i > 0)
+       {
+@@ -2061,7 +2075,7 @@ DK_STAT dk_getsig(DK *dk, void *privatek
+ 
+       siglen = EVP_PKEY_size(pkey);
+       sig = (unsigned char*) OPENSSL_malloc(siglen);
+-      EVP_SignFinal(&dk->mdctx, sig, &siglen, pkey);
++      EVP_SignFinal(dk->mdctx, sig, &siglen, pkey);
+       EVP_PKEY_free(pkey);
+ 
+       bio = BIO_new(BIO_s_mem());
+@@ -2155,7 +2169,7 @@ DK_STAT dk_free(DK *dk, int doClearErrSt
+ #ifdef DK_HASH_BUFF
+   DK_MFREE(dk->hash_buff);
+ #endif
+-  EVP_MD_CTX_cleanup(&dk->mdctx);
++  EVP_MD_CTX_free(dk->mdctx);
+   DK_MFREE(dk->header);   /* alloc'ing dk->header is not optional. */
+   dk->dkmarker = ~DKMARK;
+   DK_MFREE(dk);
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/libdomainkeys.git/commitdiff/0b35df2ead77bfee132c88109c001ba079da27cd



More information about the pld-cvs-commit mailing list