~ubuntu-branches/ubuntu/vivid/mediatomb/vivid

« back to all changes in this revision

Viewing changes to debian/patches/rsa_md5_replacement.patch

  • Committer: Bazaar Package Importer
  • Author(s): Andres Mejia
  • Date: 2008-03-02 13:09:16 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080302130916-zlljdze3kt7vuq4b
Tags: 0.11.0-1
* New upstream release.
* Include message about which inotify headers will be used when enabling
  inotify runtime support.
* Fixed error with use of INTERFACE in init script. Also removed use of -m
  option.
* Including new config.xml options.
* Added more build dependencies for new upstream release.
* Removed build dependency of libid3-dev, taglib is now preferred.
* mediatomb.xpm and manpage.xml is now included in orig tarball.
* inotify patch is not needed anymore.
* md5 patch has been committed upstream and is no longer needed. Also removed
  README.Debian.
* TwinHelix PNG fix is now used. Removed from TODO.
* Adding dependency of iceweasel for mediatomb package.
* Updated copyright file.
* Updated watch file.
* Updated rules file for proper configure options.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Patch to replace RSA MD5 code with MD5 code found in dpkg.
2
 
The RSA MD5 code is removed from the upstream source and patched in
3
 
during build.
4
 
===================================================================
5
 
diff -urN upstream/mediatomb-0.10.0/tombupnp/upnp/src/inc/upnp_md5.h mediatomb-0.10.0/tombupnp/upnp/src/inc/upnp_md5.h
6
 
--- upstream/mediatomb-0.10.0/tombupnp/upnp/src/inc/upnp_md5.h  1969-12-31 19:00:00.000000000 -0500
7
 
+++ mediatomb-0.10.0/tombupnp/upnp/src/inc/upnp_md5.h   2007-12-28 13:49:59.000000000 -0500
8
 
@@ -0,0 +1,47 @@
9
 
+/*
10
 
+ * This is the header file for the MD5 message-digest algorithm.
11
 
+ * The algorithm is due to Ron Rivest.  This code was
12
 
+ * written by Colin Plumb in 1993, no copyright is claimed.
13
 
+ * This code is in the public domain; do with it what you wish.
14
 
+ *
15
 
+ * Equivalent code is available from RSA Data Security, Inc.
16
 
+ * This code has been tested against that, and is equivalent,
17
 
+ * except that you don't need to include two pages of legalese
18
 
+ * with every copy.
19
 
+ *
20
 
+ * To compute the message digest of a chunk of bytes, declare an
21
 
+ * MD5Context structure, pass it to MD5Init, call MD5Update as
22
 
+ * needed on buffers full of bytes, and then call MD5Final, which
23
 
+ * will fill a supplied 16-byte array with the digest.
24
 
+ *
25
 
+ * Changed so as no longer to depend on Colin Plumb's `usual.h'
26
 
+ * header definitions; now uses stuff from dpkg's config.h
27
 
+ *  - Ian Jackson <ian@chiark.greenend.org.uk>.
28
 
+ * Still in the public domain.
29
 
+ */
30
 
+
31
 
+#ifndef MD5_H
32
 
+#define MD5_H
33
 
+
34
 
+#define md5byte unsigned char
35
 
+
36
 
+#if SIZEOF_UNSIGNED_LONG==4
37
 
+# define UWORD32 unsigned long
38
 
+#elif SIZEOF_UNSIGNED_INT==4
39
 
+# define UWORD32 unsigned int
40
 
+#else
41
 
+# error I do not know what to use for a UWORD32.
42
 
+#endif
43
 
+
44
 
+struct MD5Context {
45
 
+       UWORD32 buf[4];
46
 
+       UWORD32 bytes[2];
47
 
+       UWORD32 in[16];
48
 
+};
49
 
+
50
 
+void MD5Init(struct MD5Context *context);
51
 
+void MD5Update(struct MD5Context *context, md5byte const *buf, unsigned len);
52
 
+void MD5Final(unsigned char digest[16], struct MD5Context *context);
53
 
+void MD5Transform(UWORD32 buf[4], UWORD32 const in[16]);
54
 
+
55
 
+#endif /* !MD5_H */
56
 
diff -urN upstream/mediatomb-0.10.0/tombupnp/upnp/src/uuid/sysdep.c mediatomb-0.10.0/tombupnp/upnp/src/uuid/sysdep.c
57
 
--- upstream/mediatomb-0.10.0/tombupnp/upnp/src/uuid/sysdep.c   2007-07-12 15:13:36.000000000 -0400
58
 
+++ mediatomb-0.10.0/tombupnp/upnp/src/uuid/sysdep.c    2007-12-28 13:49:10.000000000 -0500
59
 
@@ -85,7 +85,7 @@
60
 
 void
61
 
 get_random_info( char seed[16] )
62
 
 {
63
 
-    MD5_CTX c;
64
 
+    struct MD5Context c;
65
 
     typedef struct {
66
 
         MEMORYSTATUS m;
67
 
         SYSTEM_INFO s;
68
 
@@ -147,7 +147,7 @@
69
 
 void
70
 
 get_random_info( char seed[16] )
71
 
 {
72
 
-    MD5_CTX c;
73
 
+    struct MD5Context c;
74
 
     typedef struct {
75
 
 //        struct sysinfo s;
76
 
         struct timeval t;
77
 
diff -urN upstream/mediatomb-0.10.0/tombupnp/upnp/src/uuid/upnp_md5.c mediatomb-0.10.0/tombupnp/upnp/src/uuid/upnp_md5.c
78
 
--- upstream/mediatomb-0.10.0/tombupnp/upnp/src/uuid/upnp_md5.c 1969-12-31 19:00:00.000000000 -0500
79
 
+++ mediatomb-0.10.0/tombupnp/upnp/src/uuid/upnp_md5.c  2007-12-28 13:52:16.000000000 -0500
80
 
@@ -0,0 +1,241 @@
81
 
+/*
82
 
+ * This code implements the MD5 message-digest algorithm.
83
 
+ * The algorithm is due to Ron Rivest.  This code was
84
 
+ * written by Colin Plumb in 1993, no copyright is claimed.
85
 
+ * This code is in the public domain; do with it what you wish.
86
 
+ *
87
 
+ * Equivalent code is available from RSA Data Security, Inc.
88
 
+ * This code has been tested against that, and is equivalent,
89
 
+ * except that you don't need to include two pages of legalese
90
 
+ * with every copy.
91
 
+ *
92
 
+ * To compute the message digest of a chunk of bytes, declare an
93
 
+ * MD5Context structure, pass it to MD5Init, call MD5Update as
94
 
+ * needed on buffers full of bytes, and then call MD5Final, which
95
 
+ * will fill a supplied 16-byte array with the digest.
96
 
+ *
97
 
+ * Changed so as no longer to depend on Colin Plumb's `usual.h' header
98
 
+ * definitions; now uses stuff from dpkg's config.h.
99
 
+ *  - Ian Jackson <ian@chiark.greenend.org.uk>.
100
 
+ * Still in the public domain.
101
 
+ */
102
 
+#include "config.h"
103
 
+
104
 
+#include <string.h>            /* for memcpy() */
105
 
+#include <sys/types.h>         /* for stupid systems */
106
 
+#include <netinet/in.h>                /* for ntohl() */
107
 
+
108
 
+#include "upnp_md5.h"
109
 
+
110
 
+#ifdef WORDS_BIGENDIAN
111
 
+void
112
 
+byteSwap(UWORD32 *buf, unsigned words)
113
 
+{
114
 
+       md5byte *p = (md5byte *)buf;
115
 
+
116
 
+       do {
117
 
+               *buf++ = (UWORD32)((unsigned)p[3] << 8 | p[2]) << 16 |
118
 
+                       ((unsigned)p[1] << 8 | p[0]);
119
 
+               p += 4;
120
 
+       } while (--words);
121
 
+}
122
 
+#else
123
 
+#define byteSwap(buf,words)
124
 
+#endif
125
 
+
126
 
+/*
127
 
+ * Start MD5 accumulation.  Set bit count to 0 and buffer to mysterious
128
 
+ * initialization constants.
129
 
+ */
130
 
+void
131
 
+MD5Init(struct MD5Context *ctx)
132
 
+{
133
 
+       ctx->buf[0] = 0x67452301;
134
 
+       ctx->buf[1] = 0xefcdab89;
135
 
+       ctx->buf[2] = 0x98badcfe;
136
 
+       ctx->buf[3] = 0x10325476;
137
 
+
138
 
+       ctx->bytes[0] = 0;
139
 
+       ctx->bytes[1] = 0;
140
 
+}
141
 
+
142
 
+/*
143
 
+ * Update context to reflect the concatenation of another buffer full
144
 
+ * of bytes.
145
 
+ */
146
 
+void
147
 
+MD5Update(struct MD5Context *ctx, md5byte const *buf, unsigned len)
148
 
+{
149
 
+       UWORD32 t;
150
 
+
151
 
+       /* Update byte count */
152
 
+
153
 
+       t = ctx->bytes[0];
154
 
+       if ((ctx->bytes[0] = t + len) < t)
155
 
+               ctx->bytes[1]++;        /* Carry from low to high */
156
 
+
157
 
+       t = 64 - (t & 0x3f);    /* Space available in ctx->in (at least 1) */
158
 
+       if (t > len) {
159
 
+               memcpy((md5byte *)ctx->in + 64 - t, buf, len);
160
 
+               return;
161
 
+       }
162
 
+       /* First chunk is an odd size */
163
 
+       memcpy((md5byte *)ctx->in + 64 - t, buf, t);
164
 
+       byteSwap(ctx->in, 16);
165
 
+       MD5Transform(ctx->buf, ctx->in);
166
 
+       buf += t;
167
 
+       len -= t;
168
 
+
169
 
+       /* Process data in 64-byte chunks */
170
 
+       while (len >= 64) {
171
 
+               memcpy(ctx->in, buf, 64);
172
 
+               byteSwap(ctx->in, 16);
173
 
+               MD5Transform(ctx->buf, ctx->in);
174
 
+               buf += 64;
175
 
+               len -= 64;
176
 
+       }
177
 
+
178
 
+       /* Handle any remaining bytes of data. */
179
 
+       memcpy(ctx->in, buf, len);
180
 
+}
181
 
+
182
 
+/*
183
 
+ * Final wrapup - pad to 64-byte boundary with the bit pattern
184
 
+ * 1 0* (64-bit count of bits processed, MSB-first)
185
 
+ */
186
 
+void
187
 
+MD5Final(md5byte digest[16], struct MD5Context *ctx)
188
 
+{
189
 
+       int count = ctx->bytes[0] & 0x3f;       /* Number of bytes in ctx->in */
190
 
+       md5byte *p = (md5byte *)ctx->in + count;
191
 
+
192
 
+       /* Set the first char of padding to 0x80.  There is always room. */
193
 
+       *p++ = 0x80;
194
 
+
195
 
+       /* Bytes of padding needed to make 56 bytes (-8..55) */
196
 
+       count = 56 - 1 - count;
197
 
+
198
 
+       if (count < 0) {        /* Padding forces an extra block */
199
 
+               memset(p, 0, count + 8);
200
 
+               byteSwap(ctx->in, 16);
201
 
+               MD5Transform(ctx->buf, ctx->in);
202
 
+               p = (md5byte *)ctx->in;
203
 
+               count = 56;
204
 
+       }
205
 
+       memset(p, 0, count);
206
 
+       byteSwap(ctx->in, 14);
207
 
+
208
 
+       /* Append length in bits and transform */
209
 
+       ctx->in[14] = ctx->bytes[0] << 3;
210
 
+       ctx->in[15] = ctx->bytes[1] << 3 | ctx->bytes[0] >> 29;
211
 
+       MD5Transform(ctx->buf, ctx->in);
212
 
+
213
 
+       byteSwap(ctx->buf, 4);
214
 
+       memcpy(digest, ctx->buf, 16);
215
 
+       memset(ctx, 0, sizeof(ctx));    /* In case it's sensitive */
216
 
+}
217
 
+
218
 
+#ifndef ASM_MD5
219
 
+
220
 
+/* The four core functions - F1 is optimized somewhat */
221
 
+
222
 
+/* #define F1(x, y, z) (x & y | ~x & z) */
223
 
+#define F1(x, y, z) (z ^ (x & (y ^ z)))
224
 
+#define F2(x, y, z) F1(z, x, y)
225
 
+#define F3(x, y, z) (x ^ y ^ z)
226
 
+#define F4(x, y, z) (y ^ (x | ~z))
227
 
+
228
 
+/* This is the central step in the MD5 algorithm. */
229
 
+#define MD5STEP(f,w,x,y,z,in,s) \
230
 
+        (w += f(x,y,z) + in, w = (w<<s | w>>(32-s)) + x)
231
 
+
232
 
+/*
233
 
+ * The core of the MD5 algorithm, this alters an existing MD5 hash to
234
 
+ * reflect the addition of 16 longwords of new data.  MD5Update blocks
235
 
+ * the data and converts bytes into longwords for this routine.
236
 
+ */
237
 
+void
238
 
+MD5Transform(UWORD32 buf[4], UWORD32 const in[16])
239
 
+{
240
 
+       register UWORD32 a, b, c, d;
241
 
+
242
 
+       a = buf[0];
243
 
+       b = buf[1];
244
 
+       c = buf[2];
245
 
+       d = buf[3];
246
 
+
247
 
+       MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
248
 
+       MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
249
 
+       MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
250
 
+       MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
251
 
+       MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
252
 
+       MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
253
 
+       MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
254
 
+       MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
255
 
+       MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
256
 
+       MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
257
 
+       MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
258
 
+       MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
259
 
+       MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
260
 
+       MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
261
 
+       MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
262
 
+       MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
263
 
+
264
 
+       MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
265
 
+       MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
266
 
+       MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
267
 
+       MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
268
 
+       MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
269
 
+       MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
270
 
+       MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
271
 
+       MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
272
 
+       MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
273
 
+       MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
274
 
+       MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
275
 
+       MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
276
 
+       MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
277
 
+       MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
278
 
+       MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
279
 
+       MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
280
 
+
281
 
+       MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
282
 
+       MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
283
 
+       MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
284
 
+       MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
285
 
+       MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
286
 
+       MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
287
 
+       MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
288
 
+       MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
289
 
+       MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
290
 
+       MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
291
 
+       MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
292
 
+       MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
293
 
+       MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
294
 
+       MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
295
 
+       MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
296
 
+       MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
297
 
+
298
 
+       MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
299
 
+       MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
300
 
+       MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
301
 
+       MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
302
 
+       MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
303
 
+       MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
304
 
+       MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
305
 
+       MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
306
 
+       MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
307
 
+       MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
308
 
+       MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
309
 
+       MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
310
 
+       MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
311
 
+       MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
312
 
+       MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
313
 
+       MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
314
 
+
315
 
+       buf[0] += a;
316
 
+       buf[1] += b;
317
 
+       buf[2] += c;
318
 
+       buf[3] += d;
319
 
+}
320
 
+
321
 
+#endif
322
 
diff -urN upstream/mediatomb-0.10.0/tombupnp/upnp/src/uuid/upnp_uuid.c mediatomb-0.10.0/tombupnp/upnp/src/uuid/upnp_uuid.c
323
 
--- upstream/mediatomb-0.10.0/tombupnp/upnp/src/uuid/upnp_uuid.c        2007-07-12 15:13:36.000000000 -0400
324
 
+++ mediatomb-0.10.0/tombupnp/upnp/src/uuid/upnp_uuid.c 2007-12-28 13:49:12.000000000 -0500
325
 
@@ -296,7 +296,7 @@
326
 
                        int namelen  /* the length of the name */
327
 
      )
328
 
 {
329
 
-    MD5_CTX c;
330
 
+    struct MD5Context c;
331
 
     unsigned char hash[16];
332
 
     uuid_upnp net_nsid;         /* context UUID in network byte order */
333