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

Collapse All | Expand All

(-)b/Makefile (-3 / +2 lines)
Lines 58-66 Link Here
58
58
59
.include <bsd.port.pre.mk>
59
.include <bsd.port.pre.mk>
60
60
61
.if ${SSL_DEFAULT} == base
61
.if ${OPSYS} == FreeBSD && ${OSVERSION} >= 1200030
62
BROKEN_FreeBSD_12=	error: variable has incomplete type 'HMAC_CTX' (aka 'struct hmac_ctx_st')
62
EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-spamd_sync.c
63
BROKEN_FreeBSD_13=	error: variable has incomplete type 'HMAC_CTX' (aka 'struct hmac_ctx_st')
64
.endif
63
.endif
65
64
66
do-install:
65
do-install:
(-)b/files/extra-patch-spamd_sync.c (+136 lines)
Line 0 Link Here
1
--- spamd/sync.c.orig	2019-05-05 15:29:42 UTC
2
+++ spamd/sync.c
3
@@ -439,7 +439,7 @@ sync_update(time_t now, char *helo, char *ip, char *fr
4
 	u_int16_t sglen, fromlen, tolen, helolen, padlen;
5
 	char pad[SPAM_ALIGNBYTES];
6
 	int i = 0;
7
-	HMAC_CTX ctx;
8
+	HMAC_CTX *ctx = HMAC_CTX_new();
9
 	u_int hmac_len;
10
 
11
 	if (debug)
12
@@ -455,8 +455,7 @@ sync_update(time_t now, char *helo, char *ip, char *fr
13
 	tolen = strlen(to) + 1;
14
 	helolen = strlen(helo) + 1;
15
 
16
-	HMAC_CTX_init(&ctx);
17
-	HMAC_Init(&ctx, sync_key, strlen(sync_key), EVP_sha1());
18
+	HMAC_Init_ex(ctx, sync_key, strlen(sync_key), EVP_sha1(), NULL);
19
 
20
 	sglen = sizeof(sg) + fromlen + tolen + helolen;
21
 	padlen = SPAM_ALIGN(sglen) - sglen;
22
@@ -468,7 +467,7 @@ sync_update(time_t now, char *helo, char *ip, char *fr
23
 	hdr.sh_length = htons(sizeof(hdr) + sglen + padlen + sizeof(end));
24
 	iov[i].iov_base = &hdr;
25
 	iov[i].iov_len = sizeof(hdr);
26
-	HMAC_Update(&ctx, iov[i].iov_base, iov[i].iov_len);
27
+	HMAC_Update(ctx, iov[i].iov_base, iov[i].iov_len);
28
 	i++;
29
 
30
 	/* Add single SPAM sync greylisting entry */
31
@@ -481,27 +480,27 @@ sync_update(time_t now, char *helo, char *ip, char *fr
32
 	sg.sg_helo_length = htons(helolen);
33
 	iov[i].iov_base = &sg;
34
 	iov[i].iov_len = sizeof(sg);
35
-	HMAC_Update(&ctx, iov[i].iov_base, iov[i].iov_len);
36
+	HMAC_Update(ctx, iov[i].iov_base, iov[i].iov_len);
37
 	i++;
38
 
39
 	iov[i].iov_base = from;
40
 	iov[i].iov_len = fromlen;
41
-	HMAC_Update(&ctx, iov[i].iov_base, iov[i].iov_len);
42
+	HMAC_Update(ctx, iov[i].iov_base, iov[i].iov_len);
43
 	i++;
44
 
45
 	iov[i].iov_base = to;
46
 	iov[i].iov_len = tolen;
47
-	HMAC_Update(&ctx, iov[i].iov_base, iov[i].iov_len);
48
+	HMAC_Update(ctx, iov[i].iov_base, iov[i].iov_len);
49
 	i++;
50
 
51
 	iov[i].iov_base = helo;
52
 	iov[i].iov_len = helolen;
53
-	HMAC_Update(&ctx, iov[i].iov_base, iov[i].iov_len);
54
+	HMAC_Update(ctx, iov[i].iov_base, iov[i].iov_len);
55
 	i++;
56
 
57
 	iov[i].iov_base = pad;
58
 	iov[i].iov_len = padlen;
59
-	HMAC_Update(&ctx, iov[i].iov_base, iov[i].iov_len);
60
+	HMAC_Update(ctx, iov[i].iov_base, iov[i].iov_len);
61
 	i++;
62
 
63
 	/* Add end marker */
64
@@ -509,14 +508,14 @@ sync_update(time_t now, char *helo, char *ip, char *fr
65
 	end.st_length = htons(sizeof(end));
66
 	iov[i].iov_base = &end;
67
 	iov[i].iov_len = sizeof(end);
68
-	HMAC_Update(&ctx, iov[i].iov_base, iov[i].iov_len);
69
+	HMAC_Update(ctx, iov[i].iov_base, iov[i].iov_len);
70
 	i++;
71
 
72
-	HMAC_Final(&ctx, hdr.sh_hmac, &hmac_len);
73
+	HMAC_Final(ctx, hdr.sh_hmac, &hmac_len);
74
 
75
 	/* Send message to the target hosts */
76
 	sync_send(iov, i);
77
-	HMAC_CTX_cleanup(&ctx);
78
+	HMAC_CTX_free(ctx);
79
 }
80
 
81
 void
82
@@ -527,7 +526,7 @@ sync_addr(time_t now, time_t expire, char *ip, u_int16
83
 	struct spam_synctlv_addr sd;
84
 	struct spam_synctlv_hdr end;
85
 	int i = 0;
86
-	HMAC_CTX ctx;
87
+	HMAC_CTX *ctx = HMAC_CTX_new();
88
 	u_int hmac_len;
89
 
90
 	if (debug)
91
@@ -537,8 +536,7 @@ sync_addr(time_t now, time_t expire, char *ip, u_int16
92
 	bzero(&hdr, sizeof(hdr));
93
 	bzero(&sd, sizeof(sd));
94
 
95
-	HMAC_CTX_init(&ctx);
96
-	HMAC_Init(&ctx, sync_key, strlen(sync_key), EVP_sha1());
97
+	HMAC_Init_ex(ctx, sync_key, strlen(sync_key), EVP_sha1(), NULL);
98
 
99
 	/* Add SPAM sync packet header */
100
 	hdr.sh_version = SPAM_SYNC_VERSION;
101
@@ -547,7 +545,7 @@ sync_addr(time_t now, time_t expire, char *ip, u_int16
102
 	hdr.sh_length = htons(sizeof(hdr) + sizeof(sd) + sizeof(end));
103
 	iov[i].iov_base = &hdr;
104
 	iov[i].iov_len = sizeof(hdr);
105
-	HMAC_Update(&ctx, iov[i].iov_base, iov[i].iov_len);
106
+	HMAC_Update(ctx, iov[i].iov_base, iov[i].iov_len);
107
 	i++;
108
 
109
 	/* Add single SPAM sync address entry */
110
@@ -558,7 +556,7 @@ sync_addr(time_t now, time_t expire, char *ip, u_int16
111
 	sd.sd_ip = inet_addr(ip);
112
 	iov[i].iov_base = &sd;
113
 	iov[i].iov_len = sizeof(sd);
114
-	HMAC_Update(&ctx, iov[i].iov_base, iov[i].iov_len);
115
+	HMAC_Update(ctx, iov[i].iov_base, iov[i].iov_len);
116
 	i++;
117
 
118
 	/* Add end marker */
119
@@ -566,14 +564,14 @@ sync_addr(time_t now, time_t expire, char *ip, u_int16
120
 	end.st_length = htons(sizeof(end));
121
 	iov[i].iov_base = &end;
122
 	iov[i].iov_len = sizeof(end);
123
-	HMAC_Update(&ctx, iov[i].iov_base, iov[i].iov_len);
124
+	HMAC_Update(ctx, iov[i].iov_base, iov[i].iov_len);
125
 	i++;
126
 
127
-	HMAC_Final(&ctx, hdr.sh_hmac, &hmac_len);
128
+	HMAC_Final(ctx, hdr.sh_hmac, &hmac_len);
129
 
130
 	/* Send message to the target hosts */
131
 	sync_send(iov, i);
132
-	HMAC_CTX_cleanup(&ctx);
133
+	HMAC_CTX_free(ctx);
134
 }
135
 
136
 void
(-)b/files/pkg-message.in (-1 / +1 lines)
Lines 33-38 Link Here
33
33
34
FreeBSD only features (not in OpenBSD):
34
FreeBSD only features (not in OpenBSD):
35
  - sync for spamdb (parameter -Y)
35
  - sync for spamdb (parameter -Y)
36
    See %%PREFIX%%/%%DOCSDIR%%/ for usage.
36
    See %%DOCSDIR%%/ for usage.
37
37
38
**********************************************************************
38
**********************************************************************

Return to bug 235496