Mercurial > dropbear
comparison libtomcrypt/src/hashes/sha2/sha512.c @ 415:8b9aba1d5fa4 channel-fix
merge of '73fe066c5d9e2395354ba74756124d45c978a04d'
and 'f5014cc84558f1e8eba42dbecf9f72f94bfe6134'
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 06 Feb 2007 16:00:18 +0000 |
parents | 0cbe8f6dbf9e |
children | f849a5ca2efc |
comparison
equal
deleted
inserted
replaced
414:c53a26c430e5 | 415:8b9aba1d5fa4 |
---|---|
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 sha512.c | 14 @param sha512.c |
29 9, | 29 9, |
30 | 30 |
31 &sha512_init, | 31 &sha512_init, |
32 &sha512_process, | 32 &sha512_process, |
33 &sha512_done, | 33 &sha512_done, |
34 &sha512_test | 34 &sha512_test, |
35 NULL | |
35 }; | 36 }; |
36 | 37 |
37 /* the K array */ | 38 /* the K array */ |
38 static const ulong64 K[80] = { | 39 static const ulong64 K[80] = { |
39 CONST64(0x428a2f98d728ae22), CONST64(0x7137449123ef65cd), | 40 CONST64(0x428a2f98d728ae22), CONST64(0x7137449123ef65cd), |
294 | 295 |
295 for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) { | 296 for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) { |
296 sha512_init(&md); | 297 sha512_init(&md); |
297 sha512_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg)); | 298 sha512_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg)); |
298 sha512_done(&md, tmp); | 299 sha512_done(&md, tmp); |
299 if (memcmp(tmp, tests[i].hash, 64) != 0) { | 300 if (XMEMCMP(tmp, tests[i].hash, 64) != 0) { |
300 return CRYPT_FAIL_TESTVECTOR; | 301 return CRYPT_FAIL_TESTVECTOR; |
301 } | 302 } |
302 } | 303 } |
303 return CRYPT_OK; | 304 return CRYPT_OK; |
304 #endif | 305 #endif |
312 | 313 |
313 | 314 |
314 | 315 |
315 | 316 |
316 /* $Source: /cvs/libtom/libtomcrypt/src/hashes/sha2/sha512.c,v $ */ | 317 /* $Source: /cvs/libtom/libtomcrypt/src/hashes/sha2/sha512.c,v $ */ |
317 /* $Revision: 1.5 $ */ | 318 /* $Revision: 1.8 $ */ |
318 /* $Date: 2005/05/23 02:42:07 $ */ | 319 /* $Date: 2006/11/01 09:28:17 $ */ |