comparison libtomcrypt/src/hashes/rmd128.c @ 511:582cb38e4eb5 insecure-nocrypto

propagate from branch 'au.asn.ucc.matt.dropbear' (head cdcc3c729e29544e8b98a408e2dc60e4483dfd2a) to branch 'au.asn.ucc.matt.dropbear.insecure-nocrypto' (head 0ca38a1cf349f7426ac9de34ebe4c3e3735effab)
author Matt Johnston <matt@ucc.asn.au>
date Thu, 06 Nov 2008 13:16:55 +0000
parents 0cbe8f6dbf9e
children f849a5ca2efc
comparison
equal deleted inserted replaced
361:461c4b1fb35f 511:582cb38e4eb5
4 * algorithms in a highly modular and flexible manner. 4 * algorithms in a highly modular and flexible manner.
5 * 5 *
6 * The library is free for all purposes without any express 6 * The library is free for all purposes without any express
7 * guarantee it works. 7 * guarantee it works.
8 * 8 *
9 * Tom St Denis, [email protected], http://libtomcrypt.org 9 * Tom St Denis, [email protected], http://libtomcrypt.com
10 */ 10 */
11 #include "tomcrypt.h" 11 #include "tomcrypt.h"
12 12
13 /** 13 /**
14 @param rmd128.c 14 @param rmd128.c
35 6, 35 6,
36 36
37 &rmd128_init, 37 &rmd128_init,
38 &rmd128_process, 38 &rmd128_process,
39 &rmd128_done, 39 &rmd128_done,
40 &rmd128_test 40 &rmd128_test,
41 NULL
41 }; 42 };
42 43
43 /* the four basic functions F(), G() and H() */ 44 /* the four basic functions F(), G() and H() */
44 #define F(x, y, z) ((x) ^ (y) ^ (z)) 45 #define F(x, y, z) ((x) ^ (y) ^ (z))
45 #define G(x, y, z) (((x) & (y)) | (~(x) & (z))) 46 #define G(x, y, z) (((x) & (y)) | (~(x) & (z)))
388 389
389 for (x = 0; x < (int)(sizeof(tests)/sizeof(tests[0])); x++) { 390 for (x = 0; x < (int)(sizeof(tests)/sizeof(tests[0])); x++) {
390 rmd128_init(&md); 391 rmd128_init(&md);
391 rmd128_process(&md, (unsigned char *)tests[x].msg, strlen(tests[x].msg)); 392 rmd128_process(&md, (unsigned char *)tests[x].msg, strlen(tests[x].msg));
392 rmd128_done(&md, buf); 393 rmd128_done(&md, buf);
393 if (memcmp(buf, tests[x].md, 16) != 0) { 394 if (XMEMCMP(buf, tests[x].md, 16) != 0) {
394 #if 0 395 #if 0
395 printf("Failed test %d\n", x); 396 printf("Failed test %d\n", x);
396 #endif 397 #endif
397 return CRYPT_FAIL_TESTVECTOR; 398 return CRYPT_FAIL_TESTVECTOR;
398 } 399 }
403 404
404 #endif 405 #endif
405 406
406 407
407 /* $Source: /cvs/libtom/libtomcrypt/src/hashes/rmd128.c,v $ */ 408 /* $Source: /cvs/libtom/libtomcrypt/src/hashes/rmd128.c,v $ */
408 /* $Revision: 1.6 $ */ 409 /* $Revision: 1.9 $ */
409 /* $Date: 2005/05/23 02:42:07 $ */ 410 /* $Date: 2006/11/01 09:28:17 $ */