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 (+186 lines)
Line 0 Link Here
1
Adapted from
2
http://git.pld-linux.org/?p=packages/libdomainkeys.git;a=blob;f=openssl.patch;h=a79c3f6b9431bb339b21937a54ce42c944f67090;hb=0b35df2ead77bfee132c88109c001ba079da27cd
3
4
--- domainkeys.c.orig	2008-03-31 22:50:39 UTC
5
+++ domainkeys.c
6
@@ -120,7 +120,11 @@ typedef struct
7
 {
8
 /* STARTPRIV */
9
   int dkmarker;     /* in case somebody casts in */
10
+#if OPENSSL_VERSION_NUMBER < 0x1010000fL
11
   EVP_MD_CTX mdctx;   /* the hash */
12
+#else
13
+  EVP_MD_CTX *mdctx;  /* the hash */
14
+#endif
15
   int signing;      /* our current signing/verifying state */
16
   int in_headers;   /* true if we're still processing headers */
17
   char *header;     /* points to a malloc'ed block for header. */
18
@@ -503,7 +507,24 @@ DK *dk_sign(DK_LIB *dklib, DK_STAT *statp, int canon)
19
     return NULL;
20
   }
21
   dk->canon = canon; /* TC13-simple, TC13-nofws */
22
-  EVP_SignInit(&dk->mdctx, dklib->md);
23
+#if OPENSSL_VERSION_NUMBER < 0x1010000fL
24
+  if (!EVP_SignInit(&dk->mdctx, dklib->md)) {
25
+    if (statp)
26
+    {
27
+      *statp = DKERR(DK_STAT_NORESOURCE);
28
+    }
29
+    return NULL;
30
+  }
31
+#else
32
+  dk->mdctx = EVP_MD_CTX_create();
33
+  if (!EVP_SignInit(dk->mdctx, dklib->md)) {
34
+    if (statp)
35
+    {
36
+      *statp = DKERR(DK_STAT_NORESOURCE);
37
+    }
38
+    return NULL;
39
+  }
40
+#endif
41
 
42
   if (statp)
43
   {
44
@@ -541,7 +562,19 @@ DK *dk_verify(DK_LIB *dklib, DK_STAT *statp)
45
     }
46
     return NULL;
47
   }
48
+#if OPENSSL_VERSION_NUMBER < 0x1010000fL
49
   EVP_VerifyInit(&dk->mdctx, dklib->md);
50
+#else
51
+  dk->mdctx = EVP_MD_CTX_create();
52
+  if (!EVP_SignInit(dk->mdctx, dklib->md)) {
53
+    if (statp)
54
+    {
55
+      *statp = DKERR(DK_STAT_NORESOURCE);
56
+    }
57
+    return NULL;
58
+  }
59
+  EVP_VerifyInit(dk->mdctx, dklib->md);
60
+#endif
61
 
62
   if (statp)
63
   {
64
@@ -928,14 +961,22 @@ static void dkhash(DK *dk, const unsigned char *ptr)
65
     {
66
 
67
 #ifndef DK_HASH_BUFF
68
+#if OPENSSL_VERSION_NUMBER < 0x1010000fL
69
       EVP_DigestUpdate(&dk->mdctx, "\r\n", 2);
70
 #else
71
+      EVP_DigestUpdate(dk->mdctx, "\r\n", 2);
72
+#endif
73
+#else
74
       /* buffer hack */
75
       dk->hash_buff[dk->hash_buff_len++] = '\r';
76
       dk->hash_buff[dk->hash_buff_len++] = '\n';
77
       if (dk->hash_buff_len >= (DK_BLOCK - 1))
78
       {
79
+#if OPENSSL_VERSION_NUMBER < 0x1010000fL
80
         EVP_DigestUpdate(&dk->mdctx, dk->hash_buff, dk->hash_buff_len);
81
+#else
82
+        EVP_DigestUpdate(dk->mdctx, dk->hash_buff, dk->hash_buff_len);
83
+#endif
84
         dk->hash_buff_len = 0;
85
       }
86
       /* buffer hack */
87
@@ -955,13 +996,21 @@ static void dkhash(DK *dk, const unsigned char *ptr)
88
       if (dk->canon == DK_CANON_SIMPLE)//if nofws we ignore \r
89
       {
90
 #ifndef DK_HASH_BUFF
91
+#if OPENSSL_VERSION_NUMBER < 0x1010000fL
92
         EVP_DigestUpdate(&dk->mdctx, "\r", 1);
93
 #else
94
+        EVP_DigestUpdate(dk->mdctx, "\r", 1);
95
+#endif
96
+#else
97
         /* buffer hack */
98
         dk->hash_buff[dk->hash_buff_len++] = '\r';
99
         if (dk->hash_buff_len >= (DK_BLOCK - 1))
100
         {
101
+#if OPENSSL_VERSION_NUMBER < 0x1010000fL
102
           EVP_DigestUpdate(&dk->mdctx, dk->hash_buff, dk->hash_buff_len);
103
+#else
104
+          EVP_DigestUpdate(dk->mdctx, dk->hash_buff, dk->hash_buff_len);
105
+#endif
106
           dk->hash_buff_len = 0;
107
         }
108
         /* buffer hack */
109
@@ -977,13 +1026,21 @@ static void dkhash(DK *dk, const unsigned char *ptr)
110
       dk->state --;
111
     }
112
 #ifndef DK_HASH_BUFF
113
+#if OPENSSL_VERSION_NUMBER < 0x1010000fL
114
     EVP_DigestUpdate(&dk->mdctx, ptr, 1);
115
 #else
116
+    EVP_DigestUpdate(dk->mdctx, ptr, 1);
117
+#endif
118
+#else
119
     /* buffer hack */
120
     dk->hash_buff[dk->hash_buff_len++] = *ptr;
121
     if (dk->hash_buff_len >= (DK_BLOCK - 1))
122
     {
123
+#if OPENSSL_VERSION_NUMBER < 0x1010000fL
124
       EVP_DigestUpdate(&dk->mdctx, dk->hash_buff, dk->hash_buff_len);
125
+#else
126
+      EVP_DigestUpdate(dk->mdctx, dk->hash_buff, dk->hash_buff_len);
127
+#endif
128
       dk->hash_buff_len = 0;
129
     }
130
     /* buffer hack */
131
@@ -1746,11 +1803,19 @@ DK_STAT dk_end(DK *dk, DK_FLAGS *dkf)
132
     //clean out hash buffer
133
     dk->hash_buff[dk->hash_buff_len++] = '\r';
134
     dk->hash_buff[dk->hash_buff_len++] = '\n';
135
+#if OPENSSL_VERSION_NUMBER < 0x1010000fL
136
     EVP_DigestUpdate(&dk->mdctx, dk->hash_buff, dk->hash_buff_len);
137
+#else
138
+    EVP_DigestUpdate(dk->mdctx, dk->hash_buff, dk->hash_buff_len);
139
+#endif
140
     dk->hash_buff_len = 0;
141
 #else
142
+#if OPENSSL_VERSION_NUMBER < 0x1010000fL
143
     EVP_DigestUpdate(&dk->mdctx, "\r\n", 2);
144
+#else
145
+    EVP_DigestUpdate(dk->mdctx, "\r\n", 2);
146
 #endif
147
+#endif
148
 #ifdef DK_DEBUG
149
     fprintf(stderr,"\r\n");
150
 #endif
151
@@ -1949,7 +2014,11 @@ DK_STAT dk_end(DK *dk, DK_FLAGS *dkf)
152
       }
153
 
154
       /* using that key, verify that the digest is properly signed */
155
+#if OPENSSL_VERSION_NUMBER < 0x1010000fL
156
       i = EVP_VerifyFinal(&dk->mdctx, md_value, md_len, publickey);
157
+#else
158
+      i = EVP_VerifyFinal(dk->mdctx, md_value, md_len, publickey);
159
+#endif
160
 
161
       if (i > 0)
162
       {
163
@@ -2058,7 +2127,11 @@ DK_STAT dk_getsig(DK *dk, void *privatekey, unsigned c
164
 
165
       siglen = EVP_PKEY_size(pkey);
166
       sig = (unsigned char*) OPENSSL_malloc(siglen);
167
+#if OPENSSL_VERSION_NUMBER < 0x1010000fL
168
       EVP_SignFinal(&dk->mdctx, sig, &siglen, pkey);
169
+#else
170
+      EVP_SignFinal(dk->mdctx, sig, &siglen, pkey);
171
+#endif
172
       EVP_PKEY_free(pkey);
173
 
174
       bio = BIO_new(BIO_s_mem());
175
@@ -2152,7 +2225,11 @@ DK_STAT dk_free(DK *dk, int doClearErrState)
176
 #ifdef DK_HASH_BUFF
177
   DK_MFREE(dk->hash_buff);
178
 #endif
179
+#if OPENSSL_VERSION_NUMBER < 0x1010000fL
180
   EVP_MD_CTX_cleanup(&dk->mdctx);
181
+#else
182
+  EVP_MD_CTX_free(dk->mdctx);
183
+#endif
184
   DK_MFREE(dk->header);   /* alloc'ing dk->header is not optional. */
185
   dk->dkmarker = ~DKMARK;
186
   DK_MFREE(dk);

Return to bug 232133