1 diff -urN util-linux-2.11d.org/mount/Makefile util-linux-2.11d/mount/Makefile
2 --- util-linux-2.11d.org/mount/Makefile Sun Jun 3 22:25:41 2001
3 +++ util-linux-2.11d/mount/Makefile Sun Jun 3 22:26:34 2001
6 MAYBE = pivot_root swapoff
8 -LO_OBJS = lomount.o $(LIB)/xstrncpy.o
9 +LO_OBJS = lomount.o rmd160.o $(LIB)/xstrncpy.o
10 NFS_OBJS = nfsmount.o nfsmount_xdr.o nfsmount_clnt.o
11 GEN_FILES = nfsmount.h nfsmount_xdr.c nfsmount_clnt.c
14 swapon: swapon.o version.o
17 -main_losetup.o: lomount.c
18 +main_losetup.o: lomount.c rmd160.o
19 $(COMPILE) -DMAIN lomount.c -o $@
21 -losetup: main_losetup.o $(LIB)/xstrncpy.o
22 +losetup: main_losetup.o rmd160.o $(LIB)/xstrncpy.o
25 mount.o umount.o nfsmount.o losetup.o fstab.o realpath.o sundries.o: sundries.h
26 diff -urN util-linux-2.11d.org/mount/lomount.c util-linux-2.11d/mount/lomount.c
27 --- util-linux-2.11d.org/mount/lomount.c Sun Jun 3 22:25:41 2001
28 +++ util-linux-2.11d/mount/lomount.c Sun Jun 3 22:26:06 2001
38 struct crypt_type_struct {
42 } crypt_type_tbl[] = {
43 - { LO_CRYPT_NONE, "no" },
44 - { LO_CRYPT_NONE, "none" },
45 - { LO_CRYPT_XOR, "xor" },
46 - { LO_CRYPT_DES, "DES" },
48 + { LO_CRYPT_NONE, "no",0 },
49 + { LO_CRYPT_NONE, "none",0 },
50 + { LO_CRYPT_XOR, "xor",0 },
51 + { LO_CRYPT_DES, "DES",8 },
52 + { LO_CRYPT_FISH2, "twofish",20 },
53 + { LO_CRYPT_BLOW, "blowfish",20 },
54 + { LO_CRYPT_CAST128, "cast128", 16},
55 + { LO_CRYPT_SERPENT, "serpent", 16},
56 + { LO_CRYPT_MARS, "mars",16 },
57 + { LO_CRYPT_RC6, "rc6",16 },
58 + { LO_CRYPT_DES_EDE3, "DES_EDE3",24},
59 + { LO_CRYPT_DFC, "dfc",16 },
60 + { LO_CRYPT_IDEA, "idea",16},
69 +#define HASHLENGTH 20
70 +#define PASSWDBUFFLEN 130 /* getpass returns only max. 128 bytes, see man getpass */
73 set_loop (const char *device, const char *file, int offset,
74 const char *encryption, int *loopro) {
75 struct loop_info loopinfo;
79 + char keybits[2*HASHLENGTH];
80 + char passwdbuff[PASSWDBUFFLEN];
82 mode = (*loopro ? O_RDONLY : O_RDWR);
83 if ((ffd = open (file, mode)) < 0) {
85 loopinfo.lo_encrypt_key_size = strlen(loopinfo.lo_encrypt_key);
88 + printf(_("WARNING: Use of DES is depreciated.\n"));
89 pass = getpass (_("Password: "));
90 strncpy (loopinfo.lo_encrypt_key, pass, 8);
91 loopinfo.lo_encrypt_key[8] = 0;
96 + case LO_CRYPT_FISH2:
99 + case LO_CRYPT_CAST128:
100 + case LO_CRYPT_SERPENT:
101 + case LO_CRYPT_MARS:
103 + case LO_CRYPT_DES_EDE3:
105 + pass = getpass("Password :");
106 + strncpy(passwdbuff+1,pass,PASSWDBUFFLEN-1);
107 + passwdbuff[0] = 'A';
108 + rmd160_hash_buffer(keybits,pass,strlen(pass));
109 + rmd160_hash_buffer(keybits+HASHLENGTH,passwdbuff,strlen(pass)+1);
110 + memcpy((char*)loopinfo.lo_encrypt_key,keybits,2*HASHLENGTH);
112 + for(i=0; crypt_type_tbl[i].id != -1; i++){
113 + if(loopinfo.lo_encrypt_type == crypt_type_tbl[i].id){
114 + keylength = crypt_type_tbl[i].keylength;
118 + loopinfo.lo_encrypt_key_size=keylength;
122 _("Don't know how to get key for encryption system %d\n"),
123 @@ -350,11 +392,18 @@
127 + struct crypt_type_struct *c;
128 fprintf(stderr, _("usage:\n\
129 %s loop_device # give info\n\
130 %s -d loop_device # delete\n\
131 %s [ -e encryption ] [ -o offset ] loop_device file # setup\n"),
132 progname, progname, progname);
133 + fprintf(stderr, " where encryption is one of:\n");
134 + c = &crypt_type_tbl[0];
136 + fprintf(stderr, " %s\n", c->name);
142 diff -urN util-linux-2.11d.org/mount/losetup.8 util-linux-2.11d/mount/losetup.8
143 --- util-linux-2.11d.org/mount/losetup.8 Sun Jun 3 22:25:41 2001
144 +++ util-linux-2.11d/mount/losetup.8 Sun Jun 3 22:26:06 2001
148 use a simple XOR encryption.
150 +use Blowfish encryption. Blowfish encryption is only available if you
151 +are using the international kernel and Blowfish encryption has been
152 +enabled in the Crypto API.
154 +use Twofish encryption. Twofish encryption is only available if you
155 +are using the international kernel and Twofish encryption has been
156 +enabled in the Crypto API.
158 +use CAST encryption. CAST encryption is only available if you
159 +are using the international kernel and CAST encryption has been
160 +enabled in the Crypto API.
162 use DES encryption. DES encryption is only available if the optional
163 DES package has been added to the kernel. DES encryption uses an additional
164 start value that is used to protect passwords against dictionary
166 +attacks. Use of DES is deprecated.
168 +use DFC encryption. DFC encryption is only available if you
169 +are using the international kernel and DFC encryption has been
170 +enabled in the Crypto API.
172 +use IDEA encryption. IDEA encryption is only available if you
173 +are using the international kernel and IDEA encryption has been
174 +enabled in the Crypto API.
176 +use MARS encryption. MARS encryption is only available if you
177 +are using the international kernel and MARS encryption has been
178 +enabled in the Crypto API.
180 +use RC5 encryption. RC5 encryption is only available if you
181 +are using the international kernel and RC5 encryption has been
182 +enabled in the Crypto API.
184 +use RC6 encryption. RC6 encryption is only available if you
185 +are using the international kernel and RC6 encryption has been
186 +enabled in the Crypto API.
188 +use Serpent encryption. Serpent encryption is only available if you
189 +are using the international kernel and Serpent encryption has been
190 +enabled in the Crypto API.
193 .IP "\fB\-o \fIoffset\fP"
197 /dev/loop0,/dev/loop1,... loop devices (major=7)
198 +/proc/cipher/* available ciphers
201 If you are using the loadable module you must have the module loaded
205 dd if=/dev/zero of=/file bs=1k count=100
206 -losetup -e des /dev/loop0 /file
208 -Init (up to 16 hex digits):
209 +losetup -e blowfish /dev/loop0 /file
211 mkfs -t ext2 /dev/loop0 100
212 mount -t ext2 /dev/loop0 /mnt
219 -DES encryption is painfully slow. On the other hand, XOR is terribly weak.
221 +DES encryption is painfully slow. On the other hand, XOR is terribly
222 +weak. Both are insecure nowadays. Some ciphers require a licence for
223 +you to be allowed to use them.
225 +CAST, DES, RC5 and Twofish are currently broken and cannot be used.
228 Original version: Theodore Ts'o <tytso@athena.mit.edu>
229 diff -urN util-linux-2.11d.org/mount/rmd160.c util-linux-2.11d/mount/rmd160.c
230 --- util-linux-2.11d.org/mount/rmd160.c Thu Jan 1 01:00:00 1970
231 +++ util-linux-2.11d/mount/rmd160.c Sun Jun 3 22:26:06 2001
233 +/* rmd160.c - RIPE-MD160
234 + * Copyright (C) 1998 Free Software Foundation, Inc.
237 +/* This file was part of GnuPG. Modified for use within the Linux
238 + * mount utility by Marc Mutz <Marc@Mutz.com>. None of this code is
239 + * by myself. I just removed everything that you don't need when all
240 + * you want to do is to use rmd160_hash_buffer().
241 + * My comments are marked with (mm). */
243 +/* GnuPG is free software; you can redistribute it and/or modify
244 + * it under the terms of the GNU General Public License as published by
245 + * the Free Software Foundation; either version 2 of the License, or
246 + * (at your option) any later version.
248 + * GnuPG is distributed in the hope that it will be useful,
249 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
250 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
251 + * GNU General Public License for more details.
253 + * You should have received a copy of the GNU General Public License
254 + * along with this program; if not, write to the Free Software
255 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */
257 +#include <string.h> /* (mm) for memcpy */
258 +#include <endian.h> /* (mm) for BIG_ENDIAN and BYTE_ORDER */
261 +/* (mm) these are used by the original GnuPG file. In order to modify
262 + * that file not too much, we keep the notations. maybe it would be
263 + * better to include linux/types.h and typedef __u32 to u32 and __u8
265 +typedef unsigned int u32; /* taken from e.g. util-linux's minix.h */
266 +typedef unsigned char byte;
269 + u32 h0,h1,h2,h3,h4;
276 + * Rotate a 32 bit integer by n bytes
278 +#if defined(__GNUC__) && defined(__i386__)
282 + __asm__("roll %%cl,%0"
288 + #define rol(x,n) ( ((x) << (n)) | ((x) >> (32-(n))) )
291 +/*********************************
292 + * RIPEMD-160 is not patented, see (as of 25.10.97)
293 + * http://www.esat.kuleuven.ac.be/~bosselae/ripemd160.html
294 + * Note that the code uses Little Endian byteorder, which is good for
295 + * 386 etc, but we must add some conversion when used on a big endian box.
298 + * Pseudo-code for RIPEMD-160
300 + * RIPEMD-160 is an iterative hash function that operates on 32-bit words.
301 + * The round function takes as input a 5-word chaining variable and a 16-word
302 + * message block and maps this to a new chaining variable. All operations are
303 + * defined on 32-bit words. Padding is identical to that of MD4.
306 + * RIPEMD-160: definitions
309 + * nonlinear functions at bit level: exor, mux, -, mux, -
311 + * f(j, x, y, z) = x XOR y XOR z (0 <= j <= 15)
312 + * f(j, x, y, z) = (x AND y) OR (NOT(x) AND z) (16 <= j <= 31)
313 + * f(j, x, y, z) = (x OR NOT(y)) XOR z (32 <= j <= 47)
314 + * f(j, x, y, z) = (x AND z) OR (y AND NOT(z)) (48 <= j <= 63)
315 + * f(j, x, y, z) = x XOR (y OR NOT(z)) (64 <= j <= 79)
318 + * added constants (hexadecimal)
320 + * K(j) = 0x00000000 (0 <= j <= 15)
321 + * K(j) = 0x5A827999 (16 <= j <= 31) int(2**30 x sqrt(2))
322 + * K(j) = 0x6ED9EBA1 (32 <= j <= 47) int(2**30 x sqrt(3))
323 + * K(j) = 0x8F1BBCDC (48 <= j <= 63) int(2**30 x sqrt(5))
324 + * K(j) = 0xA953FD4E (64 <= j <= 79) int(2**30 x sqrt(7))
325 + * K'(j) = 0x50A28BE6 (0 <= j <= 15) int(2**30 x cbrt(2))
326 + * K'(j) = 0x5C4DD124 (16 <= j <= 31) int(2**30 x cbrt(3))
327 + * K'(j) = 0x6D703EF3 (32 <= j <= 47) int(2**30 x cbrt(5))
328 + * K'(j) = 0x7A6D76E9 (48 <= j <= 63) int(2**30 x cbrt(7))
329 + * K'(j) = 0x00000000 (64 <= j <= 79)
332 + * selection of message word
334 + * r(j) = j (0 <= j <= 15)
335 + * r(16..31) = 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8
336 + * r(32..47) = 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12
337 + * r(48..63) = 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2
338 + * r(64..79) = 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13
339 + * r0(0..15) = 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12
340 + * r0(16..31)= 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2
341 + * r0(32..47)= 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13
342 + * r0(48..63)= 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14
343 + * r0(64..79)= 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11
346 + * amount for rotate left (rol)
348 + * s(0..15) = 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8
349 + * s(16..31) = 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12
350 + * s(32..47) = 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5
351 + * s(48..63) = 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12
352 + * s(64..79) = 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6
353 + * s'(0..15) = 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6
354 + * s'(16..31)= 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11
355 + * s'(32..47)= 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5
356 + * s'(48..63)= 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8
357 + * s'(64..79)= 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11
360 + * initial value (hexadecimal)
362 + * h0 = 0x67452301; h1 = 0xEFCDAB89; h2 = 0x98BADCFE; h3 = 0x10325476;
366 + * RIPEMD-160: pseudo-code
368 + * It is assumed that the message after padding consists of t 16-word blocks
369 + * that will be denoted with X[i][j], with 0 <= i <= t-1 and 0 <= j <= 15.
370 + * The symbol [+] denotes addition modulo 2**32 and rol_s denotes cyclic left
371 + * shift (rotate) over s positions.
374 + * for i := 0 to t-1 {
375 + * A := h0; B := h1; C := h2; D = h3; E = h4;
376 + * A' := h0; B' := h1; C' := h2; D' = h3; E' = h4;
377 + * for j := 0 to 79 {
378 + * T := rol_s(j)(A [+] f(j, B, C, D) [+] X[i][r(j)] [+] K(j)) [+] E;
379 + * A := E; E := D; D := rol_10(C); C := B; B := T;
380 + * T := rol_s'(j)(A' [+] f(79-j, B', C', D') [+] X[i][r'(j)]
382 + * A' := E'; E' := D'; D' := rol_10(C'); C' := B'; B' := T;
384 + * T := h1 [+] C [+] D'; h1 := h2 [+] D [+] E'; h2 := h3 [+] E [+] A';
385 + * h3 := h4 [+] A [+] B'; h4 := h0 [+] B [+] C'; h0 := T;
390 + * "" 9c1185a5c5e9fc54612808977ee8f548b2258d31
391 + * "a" 0bdc9d2d256b3ee9daae347be6f4dc835a467ffe
392 + * "abc" 8eb208f7e05d987a9b044a8e98c6b087f15a0bfc
393 + * "message digest" 5d0689ef49d2fae572b881b123a85ffa21595f36
394 + * "a...z" f71c27109c692c1b56bbdceb5b9d2865b3708dbc
395 + * "abcdbcde...nopq" 12a053384a9c0c88e405a06c27dcf49ada62eb2b
396 + * "A...Za...z0...9" b0e20b6e3116640286ed3a87a5713079b21f5189
397 + * 8 times "1234567890" 9b752e45573d4b39f4dbd3323cab82bf63326bfb
398 + * 1 million times "a" 52783243c1697bdbe16d37f97f68f08325dc1528
403 +rmd160_init( RMD160_CONTEXT *hd )
405 + hd->h0 = 0x67452301;
406 + hd->h1 = 0xEFCDAB89;
407 + hd->h2 = 0x98BADCFE;
408 + hd->h3 = 0x10325476;
409 + hd->h4 = 0xC3D2E1F0;
417 + * Transform the message X which consists of 16 32-bit-words
420 +transform( RMD160_CONTEXT *hd, byte *data )
422 + u32 a,b,c,d,e,aa,bb,cc,dd,ee,t;
423 + #if BYTE_ORDER == BIG_ENDIAN
427 + for(i=0, p1=data, p2=(byte*)x; i < 16; i++, p2 += 4 ) {
436 + u32 *x =(u32*)data;
438 + /* this version is better because it is always aligned;
439 + * The performance penalty on a 586-100 is about 6% which
440 + * is acceptable - because the data is more local it might
441 + * also be possible that this is faster on some machines.
442 + * This function (when compiled with -02 on gcc 2.7.2)
443 + * executes on a 586-100 (39.73 bogomips) at about 1900kb/sec;
444 + * [measured with a 4MB data and "gpgm --print-md rmd160"] */
446 + memcpy( x, data, 64 );
451 +#define K0 0x00000000
452 +#define K1 0x5A827999
453 +#define K2 0x6ED9EBA1
454 +#define K3 0x8F1BBCDC
455 +#define K4 0xA953FD4E
456 +#define KK0 0x50A28BE6
457 +#define KK1 0x5C4DD124
458 +#define KK2 0x6D703EF3
459 +#define KK3 0x7A6D76E9
460 +#define KK4 0x00000000
461 +#define F0(x,y,z) ( (x) ^ (y) ^ (z) )
462 +#define F1(x,y,z) ( ((x) & (y)) | (~(x) & (z)) )
463 +#define F2(x,y,z) ( ((x) | ~(y)) ^ (z) )
464 +#define F3(x,y,z) ( ((x) & (z)) | ((y) & ~(z)) )
465 +#define F4(x,y,z) ( (x) ^ ((y) | ~(z)) )
466 +#define R(a,b,c,d,e,f,k,r,s) do { t = a + f(b,c,d) + k + x[r]; \
467 + a = rol(t,s) + e; \
477 + R( a, b, c, d, e, F0, K0, 0, 11 );
478 + R( e, a, b, c, d, F0, K0, 1, 14 );
479 + R( d, e, a, b, c, F0, K0, 2, 15 );
480 + R( c, d, e, a, b, F0, K0, 3, 12 );
481 + R( b, c, d, e, a, F0, K0, 4, 5 );
482 + R( a, b, c, d, e, F0, K0, 5, 8 );
483 + R( e, a, b, c, d, F0, K0, 6, 7 );
484 + R( d, e, a, b, c, F0, K0, 7, 9 );
485 + R( c, d, e, a, b, F0, K0, 8, 11 );
486 + R( b, c, d, e, a, F0, K0, 9, 13 );
487 + R( a, b, c, d, e, F0, K0, 10, 14 );
488 + R( e, a, b, c, d, F0, K0, 11, 15 );
489 + R( d, e, a, b, c, F0, K0, 12, 6 );
490 + R( c, d, e, a, b, F0, K0, 13, 7 );
491 + R( b, c, d, e, a, F0, K0, 14, 9 );
492 + R( a, b, c, d, e, F0, K0, 15, 8 );
493 + R( e, a, b, c, d, F1, K1, 7, 7 );
494 + R( d, e, a, b, c, F1, K1, 4, 6 );
495 + R( c, d, e, a, b, F1, K1, 13, 8 );
496 + R( b, c, d, e, a, F1, K1, 1, 13 );
497 + R( a, b, c, d, e, F1, K1, 10, 11 );
498 + R( e, a, b, c, d, F1, K1, 6, 9 );
499 + R( d, e, a, b, c, F1, K1, 15, 7 );
500 + R( c, d, e, a, b, F1, K1, 3, 15 );
501 + R( b, c, d, e, a, F1, K1, 12, 7 );
502 + R( a, b, c, d, e, F1, K1, 0, 12 );
503 + R( e, a, b, c, d, F1, K1, 9, 15 );
504 + R( d, e, a, b, c, F1, K1, 5, 9 );
505 + R( c, d, e, a, b, F1, K1, 2, 11 );
506 + R( b, c, d, e, a, F1, K1, 14, 7 );
507 + R( a, b, c, d, e, F1, K1, 11, 13 );
508 + R( e, a, b, c, d, F1, K1, 8, 12 );
509 + R( d, e, a, b, c, F2, K2, 3, 11 );
510 + R( c, d, e, a, b, F2, K2, 10, 13 );
511 + R( b, c, d, e, a, F2, K2, 14, 6 );
512 + R( a, b, c, d, e, F2, K2, 4, 7 );
513 + R( e, a, b, c, d, F2, K2, 9, 14 );
514 + R( d, e, a, b, c, F2, K2, 15, 9 );
515 + R( c, d, e, a, b, F2, K2, 8, 13 );
516 + R( b, c, d, e, a, F2, K2, 1, 15 );
517 + R( a, b, c, d, e, F2, K2, 2, 14 );
518 + R( e, a, b, c, d, F2, K2, 7, 8 );
519 + R( d, e, a, b, c, F2, K2, 0, 13 );
520 + R( c, d, e, a, b, F2, K2, 6, 6 );
521 + R( b, c, d, e, a, F2, K2, 13, 5 );
522 + R( a, b, c, d, e, F2, K2, 11, 12 );
523 + R( e, a, b, c, d, F2, K2, 5, 7 );
524 + R( d, e, a, b, c, F2, K2, 12, 5 );
525 + R( c, d, e, a, b, F3, K3, 1, 11 );
526 + R( b, c, d, e, a, F3, K3, 9, 12 );
527 + R( a, b, c, d, e, F3, K3, 11, 14 );
528 + R( e, a, b, c, d, F3, K3, 10, 15 );
529 + R( d, e, a, b, c, F3, K3, 0, 14 );
530 + R( c, d, e, a, b, F3, K3, 8, 15 );
531 + R( b, c, d, e, a, F3, K3, 12, 9 );
532 + R( a, b, c, d, e, F3, K3, 4, 8 );
533 + R( e, a, b, c, d, F3, K3, 13, 9 );
534 + R( d, e, a, b, c, F3, K3, 3, 14 );
535 + R( c, d, e, a, b, F3, K3, 7, 5 );
536 + R( b, c, d, e, a, F3, K3, 15, 6 );
537 + R( a, b, c, d, e, F3, K3, 14, 8 );
538 + R( e, a, b, c, d, F3, K3, 5, 6 );
539 + R( d, e, a, b, c, F3, K3, 6, 5 );
540 + R( c, d, e, a, b, F3, K3, 2, 12 );
541 + R( b, c, d, e, a, F4, K4, 4, 9 );
542 + R( a, b, c, d, e, F4, K4, 0, 15 );
543 + R( e, a, b, c, d, F4, K4, 5, 5 );
544 + R( d, e, a, b, c, F4, K4, 9, 11 );
545 + R( c, d, e, a, b, F4, K4, 7, 6 );
546 + R( b, c, d, e, a, F4, K4, 12, 8 );
547 + R( a, b, c, d, e, F4, K4, 2, 13 );
548 + R( e, a, b, c, d, F4, K4, 10, 12 );
549 + R( d, e, a, b, c, F4, K4, 14, 5 );
550 + R( c, d, e, a, b, F4, K4, 1, 12 );
551 + R( b, c, d, e, a, F4, K4, 3, 13 );
552 + R( a, b, c, d, e, F4, K4, 8, 14 );
553 + R( e, a, b, c, d, F4, K4, 11, 11 );
554 + R( d, e, a, b, c, F4, K4, 6, 8 );
555 + R( c, d, e, a, b, F4, K4, 15, 5 );
556 + R( b, c, d, e, a, F4, K4, 13, 6 );
558 + aa = a; bb = b; cc = c; dd = d; ee = e;
566 + R( a, b, c, d, e, F4, KK0, 5, 8);
567 + R( e, a, b, c, d, F4, KK0, 14, 9);
568 + R( d, e, a, b, c, F4, KK0, 7, 9);
569 + R( c, d, e, a, b, F4, KK0, 0, 11);
570 + R( b, c, d, e, a, F4, KK0, 9, 13);
571 + R( a, b, c, d, e, F4, KK0, 2, 15);
572 + R( e, a, b, c, d, F4, KK0, 11, 15);
573 + R( d, e, a, b, c, F4, KK0, 4, 5);
574 + R( c, d, e, a, b, F4, KK0, 13, 7);
575 + R( b, c, d, e, a, F4, KK0, 6, 7);
576 + R( a, b, c, d, e, F4, KK0, 15, 8);
577 + R( e, a, b, c, d, F4, KK0, 8, 11);
578 + R( d, e, a, b, c, F4, KK0, 1, 14);
579 + R( c, d, e, a, b, F4, KK0, 10, 14);
580 + R( b, c, d, e, a, F4, KK0, 3, 12);
581 + R( a, b, c, d, e, F4, KK0, 12, 6);
582 + R( e, a, b, c, d, F3, KK1, 6, 9);
583 + R( d, e, a, b, c, F3, KK1, 11, 13);
584 + R( c, d, e, a, b, F3, KK1, 3, 15);
585 + R( b, c, d, e, a, F3, KK1, 7, 7);
586 + R( a, b, c, d, e, F3, KK1, 0, 12);
587 + R( e, a, b, c, d, F3, KK1, 13, 8);
588 + R( d, e, a, b, c, F3, KK1, 5, 9);
589 + R( c, d, e, a, b, F3, KK1, 10, 11);
590 + R( b, c, d, e, a, F3, KK1, 14, 7);
591 + R( a, b, c, d, e, F3, KK1, 15, 7);
592 + R( e, a, b, c, d, F3, KK1, 8, 12);
593 + R( d, e, a, b, c, F3, KK1, 12, 7);
594 + R( c, d, e, a, b, F3, KK1, 4, 6);
595 + R( b, c, d, e, a, F3, KK1, 9, 15);
596 + R( a, b, c, d, e, F3, KK1, 1, 13);
597 + R( e, a, b, c, d, F3, KK1, 2, 11);
598 + R( d, e, a, b, c, F2, KK2, 15, 9);
599 + R( c, d, e, a, b, F2, KK2, 5, 7);
600 + R( b, c, d, e, a, F2, KK2, 1, 15);
601 + R( a, b, c, d, e, F2, KK2, 3, 11);
602 + R( e, a, b, c, d, F2, KK2, 7, 8);
603 + R( d, e, a, b, c, F2, KK2, 14, 6);
604 + R( c, d, e, a, b, F2, KK2, 6, 6);
605 + R( b, c, d, e, a, F2, KK2, 9, 14);
606 + R( a, b, c, d, e, F2, KK2, 11, 12);
607 + R( e, a, b, c, d, F2, KK2, 8, 13);
608 + R( d, e, a, b, c, F2, KK2, 12, 5);
609 + R( c, d, e, a, b, F2, KK2, 2, 14);
610 + R( b, c, d, e, a, F2, KK2, 10, 13);
611 + R( a, b, c, d, e, F2, KK2, 0, 13);
612 + R( e, a, b, c, d, F2, KK2, 4, 7);
613 + R( d, e, a, b, c, F2, KK2, 13, 5);
614 + R( c, d, e, a, b, F1, KK3, 8, 15);
615 + R( b, c, d, e, a, F1, KK3, 6, 5);
616 + R( a, b, c, d, e, F1, KK3, 4, 8);
617 + R( e, a, b, c, d, F1, KK3, 1, 11);
618 + R( d, e, a, b, c, F1, KK3, 3, 14);
619 + R( c, d, e, a, b, F1, KK3, 11, 14);
620 + R( b, c, d, e, a, F1, KK3, 15, 6);
621 + R( a, b, c, d, e, F1, KK3, 0, 14);
622 + R( e, a, b, c, d, F1, KK3, 5, 6);
623 + R( d, e, a, b, c, F1, KK3, 12, 9);
624 + R( c, d, e, a, b, F1, KK3, 2, 12);
625 + R( b, c, d, e, a, F1, KK3, 13, 9);
626 + R( a, b, c, d, e, F1, KK3, 9, 12);
627 + R( e, a, b, c, d, F1, KK3, 7, 5);
628 + R( d, e, a, b, c, F1, KK3, 10, 15);
629 + R( c, d, e, a, b, F1, KK3, 14, 8);
630 + R( b, c, d, e, a, F0, KK4, 12, 8);
631 + R( a, b, c, d, e, F0, KK4, 15, 5);
632 + R( e, a, b, c, d, F0, KK4, 10, 12);
633 + R( d, e, a, b, c, F0, KK4, 4, 9);
634 + R( c, d, e, a, b, F0, KK4, 1, 12);
635 + R( b, c, d, e, a, F0, KK4, 5, 5);
636 + R( a, b, c, d, e, F0, KK4, 8, 14);
637 + R( e, a, b, c, d, F0, KK4, 7, 6);
638 + R( d, e, a, b, c, F0, KK4, 6, 8);
639 + R( c, d, e, a, b, F0, KK4, 2, 13);
640 + R( b, c, d, e, a, F0, KK4, 13, 6);
641 + R( a, b, c, d, e, F0, KK4, 14, 5);
642 + R( e, a, b, c, d, F0, KK4, 0, 15);
643 + R( d, e, a, b, c, F0, KK4, 3, 13);
644 + R( c, d, e, a, b, F0, KK4, 9, 11);
645 + R( b, c, d, e, a, F0, KK4, 11, 11);
648 + t = hd->h1 + d + cc;
649 + hd->h1 = hd->h2 + e + dd;
650 + hd->h2 = hd->h3 + a + ee;
651 + hd->h3 = hd->h4 + b + aa;
652 + hd->h4 = hd->h0 + c + bb;
657 +/* Update the message digest with the contents
658 + * of INBUF with length INLEN.
661 +rmd160_write( RMD160_CONTEXT *hd, byte *inbuf, size_t inlen)
663 + if( hd->count == 64 ) { /* flush the buffer */
664 + transform( hd, hd->buf );
671 + for( ; inlen && hd->count < 64; inlen-- )
672 + hd->buf[hd->count++] = *inbuf++;
673 + rmd160_write( hd, NULL, 0 );
678 + while( inlen >= 64 ) {
679 + transform( hd, inbuf );
685 + for( ; inlen && hd->count < 64; inlen-- )
686 + hd->buf[hd->count++] = *inbuf++;
689 +/* The routine terminates the computation
693 +rmd160_final( RMD160_CONTEXT *hd )
698 + rmd160_write(hd, NULL, 0); /* flush */;
702 + if( (lsb = t << 6) < t ) /* multiply by 64 to make a byte count */
706 + if( (lsb = t + hd->count) < t ) /* add the count */
709 + if( (lsb = t << 3) < t ) /* multiply by 8 to make a bit count */
713 + if( hd->count < 56 ) { /* enough room */
714 + hd->buf[hd->count++] = 0x80; /* pad */
715 + while( hd->count < 56 )
716 + hd->buf[hd->count++] = 0; /* pad */
718 + else { /* need one extra block */
719 + hd->buf[hd->count++] = 0x80; /* pad character */
720 + while( hd->count < 64 )
721 + hd->buf[hd->count++] = 0;
722 + rmd160_write(hd, NULL, 0); /* flush */;
723 + memset(hd->buf, 0, 56 ); /* fill next block with zeroes */
725 + /* append the 64 bit count */
726 + hd->buf[56] = lsb ;
727 + hd->buf[57] = lsb >> 8;
728 + hd->buf[58] = lsb >> 16;
729 + hd->buf[59] = lsb >> 24;
730 + hd->buf[60] = msb ;
731 + hd->buf[61] = msb >> 8;
732 + hd->buf[62] = msb >> 16;
733 + hd->buf[63] = msb >> 24;
734 + transform( hd, hd->buf );
737 + #if BYTE_ORDER == BIG_ENDIAN
738 + #define X(a) do { *p++ = hd->h##a ; *p++ = hd->h##a >> 8; \
739 + *p++ = hd->h##a >> 16; *p++ = hd->h##a >> 24; } while(0)
740 + #else /* little endian */
741 + #define X(a) do { *(u32*)p = hd->h##a ; p += 4; } while(0)
752 + * Shortcut functions which puts the hash value of the supplied buffer
753 + * into outbuf which must have a size of 20 bytes.
756 +rmd160_hash_buffer( char *outbuf, const char *buffer, size_t length )
760 + rmd160_init( &hd );
761 + rmd160_write( &hd, (byte*)buffer, length );
762 + rmd160_final( &hd );
763 + memcpy( outbuf, hd.buf, 20 );
765 diff -urN util-linux-2.11d.org/mount/rmd160.h util-linux-2.11d/mount/rmd160.h
766 --- util-linux-2.11d.org/mount/rmd160.h Thu Jan 1 01:00:00 1970
767 +++ util-linux-2.11d/mount/rmd160.h Sun Jun 3 22:26:06 2001
773 +rmd160_hash_buffer( char *outbuf, const char *buffer, size_t length );