1 diff -urN util-linux-2.9w/mount/Makefile util-linux-2.9w.int/mount/Makefile
2 --- util-linux-2.9w/mount/Makefile Fri Jul 9 04:56:39 1999
3 +++ util-linux-2.9w.int/mount/Makefile Mon Sep 6 14:05:07 1999
5 GEN_FILES = nfsmount.x nfsmount.h nfsmount_xdr.c nfsmount_clnt.c
7 # comment these out if you are not compiling in loop support
9 +LO_OBJS=lomount.o rmd160.o
14 swapon: swapon.o version.o
18 +losetup: losetup.o rmd160.o
21 mount.o umount.o nfsmount.o losetup.o fstab.o sundries.o: sundries.h
22 diff -urN util-linux-2.9w/mount/lomount.c util-linux-2.9w.int/mount/lomount.c
23 --- util-linux-2.9w/mount/lomount.c Fri Jul 9 04:56:39 1999
24 +++ util-linux-2.9w.int/mount/lomount.c Mon Sep 6 14:05:07 1999
32 char *xstrdup (const char *s); /* not: #include "sundries.h" */
34 { LO_CRYPT_NONE, "none" },
35 { LO_CRYPT_XOR, "xor" },
36 { LO_CRYPT_DES, "DES" },
37 + { LO_CRYPT_FISH2, "twofish" },
38 + { LO_CRYPT_BLOW, "blowfish"},
39 + { LO_CRYPT_CAST128, "cast128"},
40 + { LO_CRYPT_SERPENT, "serpent"},
41 + { LO_CRYPT_MARS, "mars" },
42 + { LO_CRYPT_RC6, "rc6" },
43 + { LO_CRYPT_DFC, "dfc" },
44 + { LO_CRYPT_IDEA, "idea"},
52 + case LO_CRYPT_FISH2:
54 + pass = getpass("Password :");
55 + MDcalc((byte *)loopinfo.lo_encrypt_key,pass,strlen(pass));
56 + loopinfo.lo_encrypt_key_size=20; /* 160 Bit key */
60 + case LO_CRYPT_CAST128:
61 + case LO_CRYPT_SERPENT:
65 + pass = getpass("Password :");
66 + MDcalc((byte *)loopinfo.lo_encrypt_key,pass,strlen(pass));
67 + loopinfo.lo_encrypt_key_size=16; /* 128 Bit key */
72 _("Don't know how to get key for encryption system %d\n"),
73 diff -urN util-linux-2.9w/mount/losetup.8 util-linux-2.9w.int/mount/losetup.8
74 --- util-linux-2.9w/mount/losetup.8 Fri Jul 9 04:56:39 1999
75 +++ util-linux-2.9w.int/mount/losetup.8 Mon Sep 6 14:05:24 1999
79 use a simple XOR encryption.
81 +use Blowfish encryption. Blowfish encryption is only available if you
82 +are using the international kernel and Blowfish encryption has been
83 +enabled in the Crypto API.
85 +use Twofish encryption. Twofish encryption is only available if you
86 +are using the international kernel and Twofish encryption has been
87 +enabled in the Crypto API.
89 +use CAST encryption. CAST encryption is only available if you
90 +are using the international kernel and CAST encryption has been
91 +enabled in the Crypto API.
93 use DES encryption. DES encryption is only available if the optional
94 DES package has been added to the kernel. DES encryption uses an additional
95 start value that is used to protect passwords against dictionary
97 +attacks. Use of DES is deprecated.
99 +use DFC encryption. DFC encryption is only available if you
100 +are using the international kernel and DFC encryption has been
101 +enabled in the Crypto API.
103 +use IDEA encryption. IDEA encryption is only available if you
104 +are using the international kernel and IDEA encryption has been
105 +enabled in the Crypto API.
107 +use MARS encryption. MARS encryption is only available if you
108 +are using the international kernel and MARS encryption has been
109 +enabled in the Crypto API.
111 +use RC5 encryption. RC5 encryption is only available if you
112 +are using the international kernel and RC5 encryption has been
113 +enabled in the Crypto API.
115 +use RC6 encryption. RC6 encryption is only available if you
116 +are using the international kernel and RC6 encryption has been
117 +enabled in the Crypto API.
119 +use Serpent encryption. Serpent encryption is only available if you
120 +are using the international kernel and Serpent encryption has been
121 +enabled in the Crypto API.
124 .IP "\fB\-o \fIoffset\fP"
128 /dev/loop0,/dev/loop1,... loop devices (major=7)
129 +/proc/cipher/* available ciphers
132 If you are using the loadable module you must have the module loaded
136 dd if=/dev/zero of=/file bs=1k count=100
137 -losetup -e des /dev/loop0 /file
139 -Init (up to 16 hex digits):
140 +losetup -e blowfish /dev/loop0 /file
142 mkfs -t ext2 /dev/loop0 100
143 mount -t ext2 /dev/loop0 /mnt
150 -DES encryption is painfully slow. On the other hand, XOR is terribly weak.
152 +DES encryption is painfully slow. On the other hand, XOR is terribly
153 +weak. Both are insecure nowadays. Some ciphers require a licence for
154 +you to be allowed to use them.
156 +CAST, DES, RC5 and Twofish are currently broken and cannot be used.
159 Original version: Theodore Ts'o <tytso@athena.mit.edu>
160 diff -urN util-linux-2.9w/mount/losetup.c util-linux-2.9w.int/mount/losetup.c
161 --- util-linux-2.9w/mount/losetup.c Fri Jul 9 04:56:39 1999
162 +++ util-linux-2.9w.int/mount/losetup.c Mon Sep 6 14:19:53 1999
172 { LO_CRYPT_NONE,"none" },
173 { LO_CRYPT_XOR, "xor" },
174 { LO_CRYPT_DES, "DES" },
175 + { LO_CRYPT_FISH2, "twofish" },
176 + { LO_CRYPT_BLOW, "blowfish" },
177 + { LO_CRYPT_CAST128, "cast128" },
178 + { LO_CRYPT_SERPENT, "serpent" },
179 + { LO_CRYPT_MARS, "mars" },
180 + { LO_CRYPT_RC6, "rc6" },
181 + { LO_CRYPT_DFC, "dfc" },
182 + { LO_CRYPT_IDEA, "idea" },
187 struct loop_info loopinfo;
188 int fd, ffd, mode, i;
192 mode = *loopro ? O_RDONLY : O_RDWR;
193 if ((ffd = open (file, mode)) < 0 && !*loopro
194 && (errno != EROFS || (ffd = open (file, mode = O_RDONLY)) < 0)) {
196 loopinfo.lo_encrypt_key_size = strlen(loopinfo.lo_encrypt_key);
199 + printf(_("WARNING: Use of DES is depreciated.\n"));
200 pass = getpass(_("Password: "));
201 strncpy(loopinfo.lo_encrypt_key, pass, 8);
202 loopinfo.lo_encrypt_key[8] = 0;
207 + case LO_CRYPT_FISH2:
208 + case LO_CRYPT_BLOW:
209 + pass = getpass("Password :");
210 + MDcalc((byte *)loopinfo.lo_encrypt_key,pass,strlen(pass));
211 + loopinfo.lo_encrypt_key_size=20; /* 160 Bit key */
213 + case LO_CRYPT_CAST128:
214 + case LO_CRYPT_SERPENT:
215 + case LO_CRYPT_MARS:
218 + case LO_CRYPT_IDEA:
219 + pass = getpass("Passphrase :");
220 + MDcalc((byte *)loopinfo.lo_encrypt_key,pass,strlen(pass));
221 + loopinfo.lo_encrypt_key_size=16; /* 128 Bit key */
225 _("Don't know how to get key for encryption system %d\n"),
226 @@ -171,11 +197,18 @@
228 static int usage(void)
230 + struct crypt_type_struct *c;
231 fprintf(stderr, _("usage:\n\
232 %s loop_device # give info\n\
233 %s -d loop_device # delete\n\
234 %s [ -e encryption ] [ -o offset ] loop_device file # setup\n"),
235 progname, progname, progname);
236 + fprintf(stderr, " where encryption is one of:\n");
237 + c = &crypt_type_tbl[0];
239 + fprintf(stderr, " %s\n", c->name);
245 diff -urN util-linux-2.9w/mount/rmd160.c util-linux-2.9w.int/mount/rmd160.c
246 --- util-linux-2.9w/mount/rmd160.c Thu Jan 1 01:00:00 1970
247 +++ util-linux-2.9w.int/mount/rmd160.c Mon Sep 6 14:05:07 1999
249 +/********************************************************************\
253 + * CONTENTS: A sample C-implementation of the RIPEMD-160
255 + * TARGET: any computer with an ANSI C compiler
257 + * AUTHOR: Antoon Bosselaers, ESAT-COSIC
258 + * DATE: 1 March 1996
261 + * Copyright (c) Katholieke Universiteit Leuven
262 + * 1996, All Rights Reserved
264 +\********************************************************************/
272 +/********************************************************************/
274 +/* macro definitions */
276 +/* collect four bytes into one word: */
277 +#define BYTES_TO_DWORD(strptr) \
278 + (((dword) *((strptr)+3) << 24) | \
279 + ((dword) *((strptr)+2) << 16) | \
280 + ((dword) *((strptr)+1) << 8) | \
281 + ((dword) *(strptr)))
283 +/* ROL(x, n) cyclically rotates x over n bits to the left */
284 +/* x must be of an unsigned 32 bits type and 0 <= n < 32. */
285 +#define ROL(x, n) (((x) << (n)) | ((x) >> (32-(n))))
287 +/* the five basic functions F(), G() and H() */
288 +#define F(x, y, z) ((x) ^ (y) ^ (z))
289 +#define G(x, y, z) (((x) & (y)) | (~(x) & (z)))
290 +#define H(x, y, z) (((x) | ~(y)) ^ (z))
291 +#define I(x, y, z) (((x) & (z)) | ((y) & ~(z)))
292 +#define J(x, y, z) ((x) ^ ((y) | ~(z)))
294 +/* the ten basic operations FF() through III() */
295 +#define FF(a, b, c, d, e, x, s) {\
296 + (a) += F((b), (c), (d)) + (x);\
297 + (a) = ROL((a), (s)) + (e);\
298 + (c) = ROL((c), 10);\
300 +#define GG(a, b, c, d, e, x, s) {\
301 + (a) += G((b), (c), (d)) + (x) + 0x5a827999UL;\
302 + (a) = ROL((a), (s)) + (e);\
303 + (c) = ROL((c), 10);\
305 +#define HH(a, b, c, d, e, x, s) {\
306 + (a) += H((b), (c), (d)) + (x) + 0x6ed9eba1UL;\
307 + (a) = ROL((a), (s)) + (e);\
308 + (c) = ROL((c), 10);\
310 +#define II(a, b, c, d, e, x, s) {\
311 + (a) += I((b), (c), (d)) + (x) + 0x8f1bbcdcUL;\
312 + (a) = ROL((a), (s)) + (e);\
313 + (c) = ROL((c), 10);\
315 +#define JJ(a, b, c, d, e, x, s) {\
316 + (a) += J((b), (c), (d)) + (x) + 0xa953fd4eUL;\
317 + (a) = ROL((a), (s)) + (e);\
318 + (c) = ROL((c), 10);\
320 +#define FFF(a, b, c, d, e, x, s) {\
321 + (a) += F((b), (c), (d)) + (x);\
322 + (a) = ROL((a), (s)) + (e);\
323 + (c) = ROL((c), 10);\
325 +#define GGG(a, b, c, d, e, x, s) {\
326 + (a) += G((b), (c), (d)) + (x) + 0x7a6d76e9UL;\
327 + (a) = ROL((a), (s)) + (e);\
328 + (c) = ROL((c), 10);\
330 +#define HHH(a, b, c, d, e, x, s) {\
331 + (a) += H((b), (c), (d)) + (x) + 0x6d703ef3UL;\
332 + (a) = ROL((a), (s)) + (e);\
333 + (c) = ROL((c), 10);\
335 +#define III(a, b, c, d, e, x, s) {\
336 + (a) += I((b), (c), (d)) + (x) + 0x5c4dd124UL;\
337 + (a) = ROL((a), (s)) + (e);\
338 + (c) = ROL((c), 10);\
340 +#define JJJ(a, b, c, d, e, x, s) {\
341 + (a) += J((b), (c), (d)) + (x) + 0x50a28be6UL;\
342 + (a) = ROL((a), (s)) + (e);\
343 + (c) = ROL((c), 10);\
347 +/********************************************************************/
349 +void MDinit(dword *MDbuf)
351 + MDbuf[0] = 0x67452301UL;
352 + MDbuf[1] = 0xefcdab89UL;
353 + MDbuf[2] = 0x98badcfeUL;
354 + MDbuf[3] = 0x10325476UL;
355 + MDbuf[4] = 0xc3d2e1f0UL;
360 +/********************************************************************/
362 +void compress(dword *MDbuf, dword *X)
364 + dword aa = MDbuf[0], bb = MDbuf[1], cc = MDbuf[2],
365 + dd = MDbuf[3], ee = MDbuf[4];
366 + dword aaa = MDbuf[0], bbb = MDbuf[1], ccc = MDbuf[2],
367 + ddd = MDbuf[3], eee = MDbuf[4];
370 + FF(aa, bb, cc, dd, ee, X[ 0], 11);
371 + FF(ee, aa, bb, cc, dd, X[ 1], 14);
372 + FF(dd, ee, aa, bb, cc, X[ 2], 15);
373 + FF(cc, dd, ee, aa, bb, X[ 3], 12);
374 + FF(bb, cc, dd, ee, aa, X[ 4], 5);
375 + FF(aa, bb, cc, dd, ee, X[ 5], 8);
376 + FF(ee, aa, bb, cc, dd, X[ 6], 7);
377 + FF(dd, ee, aa, bb, cc, X[ 7], 9);
378 + FF(cc, dd, ee, aa, bb, X[ 8], 11);
379 + FF(bb, cc, dd, ee, aa, X[ 9], 13);
380 + FF(aa, bb, cc, dd, ee, X[10], 14);
381 + FF(ee, aa, bb, cc, dd, X[11], 15);
382 + FF(dd, ee, aa, bb, cc, X[12], 6);
383 + FF(cc, dd, ee, aa, bb, X[13], 7);
384 + FF(bb, cc, dd, ee, aa, X[14], 9);
385 + FF(aa, bb, cc, dd, ee, X[15], 8);
388 + GG(ee, aa, bb, cc, dd, X[ 7], 7);
389 + GG(dd, ee, aa, bb, cc, X[ 4], 6);
390 + GG(cc, dd, ee, aa, bb, X[13], 8);
391 + GG(bb, cc, dd, ee, aa, X[ 1], 13);
392 + GG(aa, bb, cc, dd, ee, X[10], 11);
393 + GG(ee, aa, bb, cc, dd, X[ 6], 9);
394 + GG(dd, ee, aa, bb, cc, X[15], 7);
395 + GG(cc, dd, ee, aa, bb, X[ 3], 15);
396 + GG(bb, cc, dd, ee, aa, X[12], 7);
397 + GG(aa, bb, cc, dd, ee, X[ 0], 12);
398 + GG(ee, aa, bb, cc, dd, X[ 9], 15);
399 + GG(dd, ee, aa, bb, cc, X[ 5], 9);
400 + GG(cc, dd, ee, aa, bb, X[ 2], 11);
401 + GG(bb, cc, dd, ee, aa, X[14], 7);
402 + GG(aa, bb, cc, dd, ee, X[11], 13);
403 + GG(ee, aa, bb, cc, dd, X[ 8], 12);
406 + HH(dd, ee, aa, bb, cc, X[ 3], 11);
407 + HH(cc, dd, ee, aa, bb, X[10], 13);
408 + HH(bb, cc, dd, ee, aa, X[14], 6);
409 + HH(aa, bb, cc, dd, ee, X[ 4], 7);
410 + HH(ee, aa, bb, cc, dd, X[ 9], 14);
411 + HH(dd, ee, aa, bb, cc, X[15], 9);
412 + HH(cc, dd, ee, aa, bb, X[ 8], 13);
413 + HH(bb, cc, dd, ee, aa, X[ 1], 15);
414 + HH(aa, bb, cc, dd, ee, X[ 2], 14);
415 + HH(ee, aa, bb, cc, dd, X[ 7], 8);
416 + HH(dd, ee, aa, bb, cc, X[ 0], 13);
417 + HH(cc, dd, ee, aa, bb, X[ 6], 6);
418 + HH(bb, cc, dd, ee, aa, X[13], 5);
419 + HH(aa, bb, cc, dd, ee, X[11], 12);
420 + HH(ee, aa, bb, cc, dd, X[ 5], 7);
421 + HH(dd, ee, aa, bb, cc, X[12], 5);
424 + II(cc, dd, ee, aa, bb, X[ 1], 11);
425 + II(bb, cc, dd, ee, aa, X[ 9], 12);
426 + II(aa, bb, cc, dd, ee, X[11], 14);
427 + II(ee, aa, bb, cc, dd, X[10], 15);
428 + II(dd, ee, aa, bb, cc, X[ 0], 14);
429 + II(cc, dd, ee, aa, bb, X[ 8], 15);
430 + II(bb, cc, dd, ee, aa, X[12], 9);
431 + II(aa, bb, cc, dd, ee, X[ 4], 8);
432 + II(ee, aa, bb, cc, dd, X[13], 9);
433 + II(dd, ee, aa, bb, cc, X[ 3], 14);
434 + II(cc, dd, ee, aa, bb, X[ 7], 5);
435 + II(bb, cc, dd, ee, aa, X[15], 6);
436 + II(aa, bb, cc, dd, ee, X[14], 8);
437 + II(ee, aa, bb, cc, dd, X[ 5], 6);
438 + II(dd, ee, aa, bb, cc, X[ 6], 5);
439 + II(cc, dd, ee, aa, bb, X[ 2], 12);
442 + JJ(bb, cc, dd, ee, aa, X[ 4], 9);
443 + JJ(aa, bb, cc, dd, ee, X[ 0], 15);
444 + JJ(ee, aa, bb, cc, dd, X[ 5], 5);
445 + JJ(dd, ee, aa, bb, cc, X[ 9], 11);
446 + JJ(cc, dd, ee, aa, bb, X[ 7], 6);
447 + JJ(bb, cc, dd, ee, aa, X[12], 8);
448 + JJ(aa, bb, cc, dd, ee, X[ 2], 13);
449 + JJ(ee, aa, bb, cc, dd, X[10], 12);
450 + JJ(dd, ee, aa, bb, cc, X[14], 5);
451 + JJ(cc, dd, ee, aa, bb, X[ 1], 12);
452 + JJ(bb, cc, dd, ee, aa, X[ 3], 13);
453 + JJ(aa, bb, cc, dd, ee, X[ 8], 14);
454 + JJ(ee, aa, bb, cc, dd, X[11], 11);
455 + JJ(dd, ee, aa, bb, cc, X[ 6], 8);
456 + JJ(cc, dd, ee, aa, bb, X[15], 5);
457 + JJ(bb, cc, dd, ee, aa, X[13], 6);
459 + /* parallel round 1 */
460 + JJJ(aaa, bbb, ccc, ddd, eee, X[ 5], 8);
461 + JJJ(eee, aaa, bbb, ccc, ddd, X[14], 9);
462 + JJJ(ddd, eee, aaa, bbb, ccc, X[ 7], 9);
463 + JJJ(ccc, ddd, eee, aaa, bbb, X[ 0], 11);
464 + JJJ(bbb, ccc, ddd, eee, aaa, X[ 9], 13);
465 + JJJ(aaa, bbb, ccc, ddd, eee, X[ 2], 15);
466 + JJJ(eee, aaa, bbb, ccc, ddd, X[11], 15);
467 + JJJ(ddd, eee, aaa, bbb, ccc, X[ 4], 5);
468 + JJJ(ccc, ddd, eee, aaa, bbb, X[13], 7);
469 + JJJ(bbb, ccc, ddd, eee, aaa, X[ 6], 7);
470 + JJJ(aaa, bbb, ccc, ddd, eee, X[15], 8);
471 + JJJ(eee, aaa, bbb, ccc, ddd, X[ 8], 11);
472 + JJJ(ddd, eee, aaa, bbb, ccc, X[ 1], 14);
473 + JJJ(ccc, ddd, eee, aaa, bbb, X[10], 14);
474 + JJJ(bbb, ccc, ddd, eee, aaa, X[ 3], 12);
475 + JJJ(aaa, bbb, ccc, ddd, eee, X[12], 6);
477 + /* parallel round 2 */
478 + III(eee, aaa, bbb, ccc, ddd, X[ 6], 9);
479 + III(ddd, eee, aaa, bbb, ccc, X[11], 13);
480 + III(ccc, ddd, eee, aaa, bbb, X[ 3], 15);
481 + III(bbb, ccc, ddd, eee, aaa, X[ 7], 7);
482 + III(aaa, bbb, ccc, ddd, eee, X[ 0], 12);
483 + III(eee, aaa, bbb, ccc, ddd, X[13], 8);
484 + III(ddd, eee, aaa, bbb, ccc, X[ 5], 9);
485 + III(ccc, ddd, eee, aaa, bbb, X[10], 11);
486 + III(bbb, ccc, ddd, eee, aaa, X[14], 7);
487 + III(aaa, bbb, ccc, ddd, eee, X[15], 7);
488 + III(eee, aaa, bbb, ccc, ddd, X[ 8], 12);
489 + III(ddd, eee, aaa, bbb, ccc, X[12], 7);
490 + III(ccc, ddd, eee, aaa, bbb, X[ 4], 6);
491 + III(bbb, ccc, ddd, eee, aaa, X[ 9], 15);
492 + III(aaa, bbb, ccc, ddd, eee, X[ 1], 13);
493 + III(eee, aaa, bbb, ccc, ddd, X[ 2], 11);
495 + /* parallel round 3 */
496 + HHH(ddd, eee, aaa, bbb, ccc, X[15], 9);
497 + HHH(ccc, ddd, eee, aaa, bbb, X[ 5], 7);
498 + HHH(bbb, ccc, ddd, eee, aaa, X[ 1], 15);
499 + HHH(aaa, bbb, ccc, ddd, eee, X[ 3], 11);
500 + HHH(eee, aaa, bbb, ccc, ddd, X[ 7], 8);
501 + HHH(ddd, eee, aaa, bbb, ccc, X[14], 6);
502 + HHH(ccc, ddd, eee, aaa, bbb, X[ 6], 6);
503 + HHH(bbb, ccc, ddd, eee, aaa, X[ 9], 14);
504 + HHH(aaa, bbb, ccc, ddd, eee, X[11], 12);
505 + HHH(eee, aaa, bbb, ccc, ddd, X[ 8], 13);
506 + HHH(ddd, eee, aaa, bbb, ccc, X[12], 5);
507 + HHH(ccc, ddd, eee, aaa, bbb, X[ 2], 14);
508 + HHH(bbb, ccc, ddd, eee, aaa, X[10], 13);
509 + HHH(aaa, bbb, ccc, ddd, eee, X[ 0], 13);
510 + HHH(eee, aaa, bbb, ccc, ddd, X[ 4], 7);
511 + HHH(ddd, eee, aaa, bbb, ccc, X[13], 5);
513 + /* parallel round 4 */
514 + GGG(ccc, ddd, eee, aaa, bbb, X[ 8], 15);
515 + GGG(bbb, ccc, ddd, eee, aaa, X[ 6], 5);
516 + GGG(aaa, bbb, ccc, ddd, eee, X[ 4], 8);
517 + GGG(eee, aaa, bbb, ccc, ddd, X[ 1], 11);
518 + GGG(ddd, eee, aaa, bbb, ccc, X[ 3], 14);
519 + GGG(ccc, ddd, eee, aaa, bbb, X[11], 14);
520 + GGG(bbb, ccc, ddd, eee, aaa, X[15], 6);
521 + GGG(aaa, bbb, ccc, ddd, eee, X[ 0], 14);
522 + GGG(eee, aaa, bbb, ccc, ddd, X[ 5], 6);
523 + GGG(ddd, eee, aaa, bbb, ccc, X[12], 9);
524 + GGG(ccc, ddd, eee, aaa, bbb, X[ 2], 12);
525 + GGG(bbb, ccc, ddd, eee, aaa, X[13], 9);
526 + GGG(aaa, bbb, ccc, ddd, eee, X[ 9], 12);
527 + GGG(eee, aaa, bbb, ccc, ddd, X[ 7], 5);
528 + GGG(ddd, eee, aaa, bbb, ccc, X[10], 15);
529 + GGG(ccc, ddd, eee, aaa, bbb, X[14], 8);
531 + /* parallel round 5 */
532 + FFF(bbb, ccc, ddd, eee, aaa, X[12] , 8);
533 + FFF(aaa, bbb, ccc, ddd, eee, X[15] , 5);
534 + FFF(eee, aaa, bbb, ccc, ddd, X[10] , 12);
535 + FFF(ddd, eee, aaa, bbb, ccc, X[ 4] , 9);
536 + FFF(ccc, ddd, eee, aaa, bbb, X[ 1] , 12);
537 + FFF(bbb, ccc, ddd, eee, aaa, X[ 5] , 5);
538 + FFF(aaa, bbb, ccc, ddd, eee, X[ 8] , 14);
539 + FFF(eee, aaa, bbb, ccc, ddd, X[ 7] , 6);
540 + FFF(ddd, eee, aaa, bbb, ccc, X[ 6] , 8);
541 + FFF(ccc, ddd, eee, aaa, bbb, X[ 2] , 13);
542 + FFF(bbb, ccc, ddd, eee, aaa, X[13] , 6);
543 + FFF(aaa, bbb, ccc, ddd, eee, X[14] , 5);
544 + FFF(eee, aaa, bbb, ccc, ddd, X[ 0] , 15);
545 + FFF(ddd, eee, aaa, bbb, ccc, X[ 3] , 13);
546 + FFF(ccc, ddd, eee, aaa, bbb, X[ 9] , 11);
547 + FFF(bbb, ccc, ddd, eee, aaa, X[11] , 11);
549 + /* combine results */
550 + ddd += cc + MDbuf[1]; /* final result for MDbuf[0] */
551 + MDbuf[1] = MDbuf[2] + dd + eee;
552 + MDbuf[2] = MDbuf[3] + ee + aaa;
553 + MDbuf[3] = MDbuf[4] + aa + bbb;
554 + MDbuf[4] = MDbuf[0] + bb + ccc;
560 +/********************************************************************/
562 +void MDfinish(dword *MDbuf, byte *strptr, dword lswlen, dword mswlen)
564 + unsigned int i; /* counter */
565 + dword X[16]; /* message words */
567 + memset(X, 0, 16*sizeof(dword));
569 + /* put bytes from strptr into X */
570 + for (i=0; i<(lswlen&63); i++) {
571 + /* byte i goes into word X[i div 4] at pos. 8*(i mod 4) */
572 + X[i>>2] ^= (dword) *strptr++ << (8 * (i&3));
575 + /* append "1" bit to the message. Be careful :
576 + message = "" -> "10000000" = 128 */
577 + X[(lswlen>>2)&15] ^= (dword)1 << (8*(lswlen&3)+7);
579 + if ((lswlen & 63) > 55) {
580 + /* length goes to next block */
581 + compress(MDbuf, X);
582 + memset(X, 0, 16*sizeof(dword));
585 + /* append length in bits*/
586 + X[14] = lswlen << 3;
587 + X[15] = (lswlen >> 29) | (mswlen << 3);
588 + compress(MDbuf, X);
593 +void MDcalc(byte *MD,byte *sp,dword sl)
602 + memset(X,0,16*sizeof(dword));
604 + for (i=0; i<64; i++)
605 + X[i>>2] |= ((dword)(*sp++)) << (8 * (i&3));
611 + MDfinish(MDbuf,sp,sl,0);
615 + *MD++=(byte)((MDbuf[i]>>(j*8))&0xFF);
618 +/************************ end of file rmd160.c **********************/
620 diff -urN util-linux-2.9w/mount/rmd160.h util-linux-2.9w.int/mount/rmd160.h
621 --- util-linux-2.9w/mount/rmd160.h Thu Jan 1 01:00:00 1970
622 +++ util-linux-2.9w.int/mount/rmd160.h Mon Sep 6 14:05:07 1999
624 +/********************************************************************\
628 + * CONTENTS: Header file for a sample C-implementation of the
629 + * RIPEMD-160 hash-function.
630 + * TARGET: any computer with an ANSI C compiler
632 + * AUTHOR: Antoon Bosselaers, ESAT-COSIC
633 + * DATE: 1 March 1996
636 + * Copyright (c) Katholieke Universiteit Leuven
637 + * 1996, All Rights Reserved
639 +\********************************************************************/
641 +#ifndef RMD160H /* make sure this file is read only once */
644 +/********************************************************************/
646 +/* typedef 8 and 32 bit types, resp. */
647 +/* adapt these, if necessary,
648 + for your operating system and compiler */
650 +typedef unsigned char byte;
651 +typedef unsigned long dword;
653 +/********************************************************************/
655 +/* function prototypes */
657 +void MDinit(dword *MDbuf);
659 + * initializes MDbuffer to "magic constants"
662 +void compress(dword *MDbuf, dword *X);
664 + * the compression function.
665 + * transforms MDbuf using message bytes X[0] through X[15]
668 +void MDfinish(dword *MDbuf, byte *strptr, dword lswlen, dword mswlen);
670 + * puts bytes from strptr into X and pad out; appends length
671 + * and finally, compresses the last block(s)
672 + * note: length in bits == 8 * (lswlen + 2^32 mswlen).
673 + * note: there are (lswlen mod 64) bytes left in strptr.
676 +void MDcalc(byte *MDbuf,byte *sp,dword sl);
678 +#endif /* RMD160H */
680 +/*********************** end of file rmd160.h ***********************/