View | Details | Raw Unified | Return to bug 232133 | Differences between
and this patch

Collapse All | Expand All

(-)mail/libdomainkeys/Makefile (+1 lines)
Lines 3-8 Link Here
3
3
4
PORTNAME=	libdomainkeys
4
PORTNAME=	libdomainkeys
5
PORTVERSION=	0.69
5
PORTVERSION=	0.69
6
PORTREVISION=	1
6
CATEGORIES=	mail
7
CATEGORIES=	mail
7
MASTER_SITES=	SF/domainkeys/${PORTNAME}/${PORTVERSION}
8
MASTER_SITES=	SF/domainkeys/${PORTNAME}/${PORTVERSION}
8
9
(-)mail/libdomainkeys/files/patch-domainkeys.c (+148 lines)
Line 0 Link Here
1
--- domainkeys.c.orig	2008-03-31 22:50:39 UTC
2
+++ domainkeys.c
3
@@ -25,6 +25,7 @@ extern char *dns_text(char *);
4
  * Agreement: http://domainkeys.sourceforge.net/license/softwarelicense1-0.html
5
  */
6
 #include <openssl/evp.h>
7
+#include <openssl/opensslv.h>
8
 #include <openssl/pem.h>
9
 #include <openssl/err.h>
10
 
11
@@ -120,7 +121,7 @@ typedef struct
12
 {
13
 /* STARTPRIV */
14
   int dkmarker;     /* in case somebody casts in */
15
-  EVP_MD_CTX mdctx;   /* the hash */
16
+  EVP_MD_CTX *mdctx;   /* the hash */
17
   int signing;      /* our current signing/verifying state */
18
   int in_headers;   /* true if we're still processing headers */
19
   char *header;     /* points to a malloc'ed block for header. */
20
@@ -188,7 +189,6 @@ char* dk_strdup(const char* s)
21
   }
22
   return new;
23
 }
24
-
25
 /* HEADER */
26
 /* returns the source file from which an error was returned. */
27
 char * dk_errfile(DK *dk)
28
@@ -503,7 +503,7 @@ DK *dk_sign(DK_LIB *dklib, DK_STAT *statp, int canon)
29
     return NULL;
30
   }
31
   dk->canon = canon; /* TC13-simple, TC13-nofws */
32
-  EVP_SignInit(&dk->mdctx, dklib->md);
33
+  EVP_SignInit(dk->mdctx, dklib->md);
34
 
35
   if (statp)
36
   {
37
@@ -541,7 +541,7 @@ DK *dk_verify(DK_LIB *dklib, DK_STAT *statp)
38
     }
39
     return NULL;
40
   }
41
-  EVP_VerifyInit(&dk->mdctx, dklib->md);
42
+  EVP_VerifyInit(dk->mdctx, dklib->md);
43
 
44
   if (statp)
45
   {
46
@@ -877,7 +877,7 @@ Should ONLY be called when
47
   dk->signing == DK_SIGNING_SIGN||DK_SIGNING_VERIFY
48
 otherwise its pointless
49
 */
50
-static void dkhash(DK *dk, const unsigned char *ptr)
51
+static void dkhash(DK *dk, char *ptr)
52
 {
53
 #ifdef DK_DEBUG
54
   if ((dk->signing != DK_SIGNING_SIGN)&&(dk->signing != DK_SIGNING_VERIFY))
55
@@ -935,7 +935,7 @@ static void dkhash(DK *dk, const unsigned char *ptr)
56
       dk->hash_buff[dk->hash_buff_len++] = '\n';
57
       if (dk->hash_buff_len >= (DK_BLOCK - 1))
58
       {
59
-        EVP_DigestUpdate(&dk->mdctx, dk->hash_buff, dk->hash_buff_len);
60
+        EVP_DigestUpdate(dk->mdctx, dk->hash_buff, dk->hash_buff_len);
61
         dk->hash_buff_len = 0;
62
       }
63
       /* buffer hack */
64
@@ -961,7 +961,7 @@ static void dkhash(DK *dk, const unsigned char *ptr)
65
         dk->hash_buff[dk->hash_buff_len++] = '\r';
66
         if (dk->hash_buff_len >= (DK_BLOCK - 1))
67
         {
68
-          EVP_DigestUpdate(&dk->mdctx, dk->hash_buff, dk->hash_buff_len);
69
+          EVP_DigestUpdate(dk->mdctx, dk->hash_buff, dk->hash_buff_len);
70
           dk->hash_buff_len = 0;
71
         }
72
         /* buffer hack */
73
@@ -983,7 +983,7 @@ static void dkhash(DK *dk, const unsigned char *ptr)
74
     dk->hash_buff[dk->hash_buff_len++] = *ptr;
75
     if (dk->hash_buff_len >= (DK_BLOCK - 1))
76
     {
77
-      EVP_DigestUpdate(&dk->mdctx, dk->hash_buff, dk->hash_buff_len);
78
+      EVP_DigestUpdate(dk->mdctx, dk->hash_buff, dk->hash_buff_len);
79
       dk->hash_buff_len = 0;
80
     }
81
     /* buffer hack */
82
@@ -1008,7 +1008,7 @@ static void dkhash(DK *dk, const unsigned char *ptr)
83
  */
84
 static DK_STAT dkheaders_header(DK *dk)
85
 {
86
-  char *header_line_start,*header_label_end;
87
+  int *header_line_start,*header_label_end;
88
   char header_list[1024];
89
   char header_label[1024];
90
 
91
@@ -1074,7 +1074,7 @@ static DK_STAT dkheaders_header(DK *dk)
92
             continue;
93
           }
94
         }
95
-        dkhash(dk,&header_line_start[0]);
96
+        dkhash(dk,header_line_start[0]);
97
         ++header_line_start;
98
       }
99
       dkhash(dk, "\r");
100
@@ -1746,7 +1746,7 @@ DK_STAT dk_end(DK *dk, DK_FLAGS *dkf)
101
     //clean out hash buffer
102
     dk->hash_buff[dk->hash_buff_len++] = '\r';
103
     dk->hash_buff[dk->hash_buff_len++] = '\n';
104
-    EVP_DigestUpdate(&dk->mdctx, dk->hash_buff, dk->hash_buff_len);
105
+    EVP_DigestUpdate(dk->mdctx, dk->hash_buff, dk->hash_buff_len);
106
     dk->hash_buff_len = 0;
107
 #else
108
     EVP_DigestUpdate(&dk->mdctx, "\r\n", 2);
109
@@ -1949,7 +1949,7 @@ DK_STAT dk_end(DK *dk, DK_FLAGS *dkf)
110
       }
111
 
112
       /* using that key, verify that the digest is properly signed */
113
-      i = EVP_VerifyFinal(&dk->mdctx, md_value, md_len, publickey);
114
+      i = EVP_VerifyFinal(dk->mdctx, md_value, md_len, publickey);
115
 
116
       if (i > 0)
117
       {
118
@@ -2058,7 +2058,7 @@ DK_STAT dk_getsig(DK *dk, void *privatekey, unsigned c
119
 
120
       siglen = EVP_PKEY_size(pkey);
121
       sig = (unsigned char*) OPENSSL_malloc(siglen);
122
-      EVP_SignFinal(&dk->mdctx, sig, &siglen, pkey);
123
+      EVP_SignFinal(dk->mdctx, sig, &siglen, pkey);
124
       EVP_PKEY_free(pkey);
125
 
126
       bio = BIO_new(BIO_s_mem());
127
@@ -2152,14 +2152,20 @@ DK_STAT dk_free(DK *dk, int doClearErrState)
128
 #ifdef DK_HASH_BUFF
129
   DK_MFREE(dk->hash_buff);
130
 #endif
131
-  EVP_MD_CTX_cleanup(&dk->mdctx);
132
+#ifdef HAVE_EVP_MD_CTX_FREE
133
+  EVP_MD_CTX_free(dk->mdctx);
134
+#else
135
+  EVP_MD_CTX_destroy(dk->mdctx);
136
+#endif
137
   DK_MFREE(dk->header);   /* alloc'ing dk->header is not optional. */
138
   dk->dkmarker = ~DKMARK;
139
   DK_MFREE(dk);
140
 
141
   if (doClearErrState)
142
   {
143
+#ifdef HAVE_ERR_REMOVE_STATE 
144
      ERR_remove_state(0);
145
+#endif
146
   }
147
   return DK_STAT_OK;
148
 }

Return to bug 232133