comparison libtomcrypt/src/hashes/md2.c @ 382:0cbe8f6dbf9e

propagate from branch 'au.asn.ucc.matt.ltc.dropbear' (head 2af22fb4e878750b88f80f90d439b316d229796f) to branch 'au.asn.ucc.matt.dropbear' (head 02c413252c90e9de8e03d91e9939dde3029f5c0a)
author Matt Johnston <matt@ucc.asn.au>
date Thu, 11 Jan 2007 02:41:05 +0000
parents 1b9e69c058d2
children f849a5ca2efc
comparison
equal deleted inserted replaced
379:b66a00272a90 382:0cbe8f6dbf9e
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 md2.c 14 @param md2.c
29 6, 29 6,
30 30
31 &md2_init, 31 &md2_init,
32 &md2_process, 32 &md2_process,
33 &md2_done, 33 &md2_done,
34 &md2_test 34 &md2_test,
35 NULL
35 }; 36 };
36 37
37 static const unsigned char PI_SUBST[256] = { 38 static const unsigned char PI_SUBST[256] = {
38 41, 46, 67, 201, 162, 216, 124, 1, 61, 54, 84, 161, 236, 240, 6, 39 41, 46, 67, 201, 162, 216, 124, 1, 61, 54, 84, 161, 236, 240, 6,
39 19, 98, 167, 5, 243, 192, 199, 115, 140, 152, 147, 43, 217, 188, 40 19, 98, 167, 5, 243, 192, 199, 115, 140, 152, 147, 43, 217, 188,
232 233
233 for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) { 234 for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) {
234 md2_init(&md); 235 md2_init(&md);
235 md2_process(&md, (unsigned char*)tests[i].msg, (unsigned long)strlen(tests[i].msg)); 236 md2_process(&md, (unsigned char*)tests[i].msg, (unsigned long)strlen(tests[i].msg));
236 md2_done(&md, buf); 237 md2_done(&md, buf);
237 if (memcmp(buf, tests[i].md, 16) != 0) { 238 if (XMEMCMP(buf, tests[i].md, 16) != 0) {
238 return CRYPT_FAIL_TESTVECTOR; 239 return CRYPT_FAIL_TESTVECTOR;
239 } 240 }
240 } 241 }
241 return CRYPT_OK; 242 return CRYPT_OK;
242 #endif 243 #endif
244 245
245 #endif 246 #endif
246 247
247 248
248 /* $Source: /cvs/libtom/libtomcrypt/src/hashes/md2.c,v $ */ 249 /* $Source: /cvs/libtom/libtomcrypt/src/hashes/md2.c,v $ */
249 /* $Revision: 1.5 $ */ 250 /* $Revision: 1.8 $ */
250 /* $Date: 2005/05/23 02:42:07 $ */ 251 /* $Date: 2006/11/01 09:28:17 $ */