1 |
darkside 08/12/31 03:42:12 |
2 |
|
3 |
Added: sxid-64bit-clean.patch |
4 |
Log: |
5 |
(non maintainer commit) Remove old, -r1 will not work on amd64, add amd64 patch to -r2, bug #247536 |
6 |
(Portage version: 2.2_rc20/cvs/Linux 2.6.27.10 x86_64) |
7 |
|
8 |
Revision Changes Path |
9 |
1.1 app-admin/sxid/files/sxid-64bit-clean.patch |
10 |
|
11 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-admin/sxid/files/sxid-64bit-clean.patch?rev=1.1&view=markup |
12 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-admin/sxid/files/sxid-64bit-clean.patch?rev=1.1&content-type=text/plain |
13 |
|
14 |
Index: sxid-64bit-clean.patch |
15 |
=================================================================== |
16 |
diff -c1 -r sxid-4.0.5.orig/source/md5.c sxid-4.0.5/source/md5.c |
17 |
*** sxid-4.0.5.orig/source/md5.c 1998-12-30 13:35:04.000000000 -0500 |
18 |
--- sxid-4.0.5/source/md5.c 2007-03-23 11:58:40.000000000 -0400 |
19 |
*************** |
20 |
*** 17,18 **** |
21 |
--- 17,27 ---- |
22 |
|
23 |
+ /* |
24 |
+ * This code contains adaptations of changes made in 1997 by |
25 |
+ * Jim Kingdon of Cyclic Software so as not to require an integer |
26 |
+ * type that is exactly 32 bits wide. Jim Kingdon's changes |
27 |
+ * were explicitly released to the public domain. The adaptations |
28 |
+ * were made by Ari Johnson in 2007 and are also hereby released |
29 |
+ * into the public domain. |
30 |
+ */ |
31 |
+ |
32 |
#include <string.h> /* for memcpy() */ |
33 |
*************** |
34 |
*** 20,44 **** |
35 |
|
36 |
! #ifndef HIGHFIRST |
37 |
! #define byteReverse(buf, len) /* Nothing */ |
38 |
! #else |
39 |
! void byteReverse (unsigned char *buf, unsigned longs); |
40 |
! |
41 |
! #ifndef ASM_MD5 |
42 |
! /* |
43 |
! * Note: this code is harmless on little-endian machines. |
44 |
! */ |
45 |
! void byteReverse (unsigned char *buf, unsigned longs) |
46 |
! { |
47 |
! uint32 t; |
48 |
|
49 |
! do { |
50 |
! t = (uint32) ((unsigned) buf[3] << 8 | buf[2]) << 16 | |
51 |
! ((unsigned) buf[1] << 8 | buf[0]); |
52 |
! *(uint32 *) buf = t; |
53 |
! buf += 4; |
54 |
! } |
55 |
! while (--longs); |
56 |
} |
57 |
- #endif |
58 |
- #endif |
59 |
|
60 |
--- 29,47 ---- |
61 |
|
62 |
! /* Little-endian byte-swapping routines. Note that these do not |
63 |
! depend on the size of datatypes such as uint32, nor do they require |
64 |
! us to detect the endianness of the machine we are running on. */ |
65 |
! |
66 |
! static uint32 |
67 |
! getu32 (const unsigned char *addr) { |
68 |
! return (((((unsigned long)addr[3] << 8) | addr[2]) << 8) |
69 |
! | addr[1]) << 8 | addr[0]; |
70 |
! } |
71 |
|
72 |
! static void |
73 |
! putu32 (uint32 data, unsigned char *addr) { |
74 |
! addr[0] = (unsigned char) data; |
75 |
! addr[1] = (unsigned char) (data >> 8); |
76 |
! addr[2] = (unsigned char) (data >> 16); |
77 |
! addr[3] = (unsigned char) (data >> 24); |
78 |
} |
79 |
|
80 |
*************** |
81 |
*** 70,72 **** |
82 |
t = ctx->bits[0]; |
83 |
! if ((ctx->bits[0] = t + ((uint32) len << 3)) < t) |
84 |
ctx->bits[1]++; /* Carry from low to high */ |
85 |
--- 73,75 ---- |
86 |
t = ctx->bits[0]; |
87 |
! if ((ctx->bits[0] = (t + ((uint32) len << 3)) & 0xffffffff) < t) |
88 |
ctx->bits[1]++; /* Carry from low to high */ |
89 |
*************** |
90 |
*** 79,81 **** |
91 |
if (t) { |
92 |
! unsigned char *p = (unsigned char *) ctx->in + t; |
93 |
|
94 |
--- 82,84 ---- |
95 |
if (t) { |
96 |
! unsigned char *p = ctx->in + t; |
97 |
|
98 |
*************** |
99 |
*** 87,90 **** |
100 |
memcpy (p, buf, t); |
101 |
! byteReverse (ctx->in, 16); |
102 |
! MD5Transform (ctx->buf, (uint32 *) ctx->in); |
103 |
buf += t; |
104 |
--- 90,92 ---- |
105 |
memcpy (p, buf, t); |
106 |
! MD5Transform (ctx->buf, ctx->in); |
107 |
buf += t; |
108 |
*************** |
109 |
*** 96,99 **** |
110 |
memcpy (ctx->in, buf, 64); |
111 |
! byteReverse (ctx->in, 16); |
112 |
! MD5Transform (ctx->buf, (uint32 *) ctx->in); |
113 |
buf += 64; |
114 |
--- 98,100 ---- |
115 |
memcpy (ctx->in, buf, 64); |
116 |
! MD5Transform (ctx->buf, ctx->in); |
117 |
buf += 64; |
118 |
*************** |
119 |
*** 131,134 **** |
120 |
memset (p, 0, count); |
121 |
! byteReverse (ctx->in, 16); |
122 |
! MD5Transform (ctx->buf, (uint32 *) ctx->in); |
123 |
|
124 |
--- 132,134 ---- |
125 |
memset (p, 0, count); |
126 |
! MD5Transform (ctx->buf, ctx->in); |
127 |
|
128 |
*************** |
129 |
*** 140,150 **** |
130 |
} |
131 |
- byteReverse (ctx->in, 14); |
132 |
|
133 |
/* Append length in bits and transform */ |
134 |
! ((uint32 *) ctx->in)[14] = ctx->bits[0]; |
135 |
! ((uint32 *) ctx->in)[15] = ctx->bits[1]; |
136 |
|
137 |
! MD5Transform (ctx->buf, (uint32 *) ctx->in); |
138 |
! byteReverse ((unsigned char *) ctx->buf, 4); |
139 |
! memcpy (digest, ctx->buf, 16); |
140 |
memset ((char *) ctx, 0, sizeof (ctx)); /* In case it's sensitive */ |
141 |
--- 140,151 ---- |
142 |
} |
143 |
|
144 |
/* Append length in bits and transform */ |
145 |
! putu32(ctx->bits[0], ctx->in + 56); |
146 |
! putu32(ctx->bits[1], ctx->in + 60); |
147 |
|
148 |
! MD5Transform (ctx->buf, ctx->in); |
149 |
! putu32(ctx->buf[0], digest); |
150 |
! putu32(ctx->buf[1], digest + 4); |
151 |
! putu32(ctx->buf[2], digest + 8); |
152 |
! putu32(ctx->buf[3], digest + 12); |
153 |
memset ((char *) ctx, 0, sizeof (ctx)); /* In case it's sensitive */ |
154 |
*************** |
155 |
*** 164,166 **** |
156 |
#define MD5STEP(f, w, x, y, z, data, s) \ |
157 |
! ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x ) |
158 |
|
159 |
--- 165,167 ---- |
160 |
#define MD5STEP(f, w, x, y, z, data, s) \ |
161 |
! ( w += f(x, y, z) + data, w &= 0xffffffff, w = w<<s | w>>(32-s), w += x ) |
162 |
|
163 |
*************** |
164 |
*** 171,175 **** |
165 |
*/ |
166 |
! void MD5Transform (uint32 buf[4], uint32 const in[16]) |
167 |
{ |
168 |
register uint32 a, b, c, d; |
169 |
|
170 |
--- 172,181 ---- |
171 |
*/ |
172 |
! void MD5Transform (uint32 buf[4], const unsigned char inraw[64]) |
173 |
{ |
174 |
register uint32 a, b, c, d; |
175 |
+ uint32 in[16]; |
176 |
+ int i; |
177 |
+ |
178 |
+ for (i = 0; i < 16; ++i) |
179 |
+ in[i] = getu32 (inraw + 4 * i); |
180 |
|
181 |
diff -c1 -r sxid-4.0.5.orig/source/md5.h sxid-4.0.5/source/md5.h |
182 |
*** sxid-4.0.5.orig/source/md5.h 1998-12-30 13:35:04.000000000 -0500 |
183 |
--- sxid-4.0.5/source/md5.h 2007-03-23 11:47:25.000000000 -0400 |
184 |
*************** |
185 |
*** 4,13 **** |
186 |
|
187 |
- #ifdef __alpha |
188 |
- typedef unsigned int uint32; |
189 |
- |
190 |
- #else |
191 |
typedef unsigned long uint32; |
192 |
|
193 |
- #endif |
194 |
- |
195 |
struct MD5Context { |
196 |
--- 4,7 ---- |
197 |
*************** |
198 |
*** 22,29 **** |
199 |
void MD5Final (unsigned char digest[16], struct MD5Context *context); |
200 |
! void MD5Transform (uint32 buf[4], uint32 const in[16]); |
201 |
! |
202 |
! /* |
203 |
! * This is needed to make RSAREF happy on some MS-DOS compilers. |
204 |
! */ |
205 |
! typedef struct MD5Context MD5_CTX; |
206 |
|
207 |
--- 16,18 ---- |
208 |
void MD5Final (unsigned char digest[16], struct MD5Context *context); |
209 |
! void MD5Transform (uint32 buf[4], const unsigned char in[64]); |