Mercurial > dropbear
comparison libtomcrypt/src/hashes/sha2/sha256.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 @file sha256.c | 14 @file sha256.c |
29 9, | 29 9, |
30 | 30 |
31 &sha256_init, | 31 &sha256_init, |
32 &sha256_process, | 32 &sha256_process, |
33 &sha256_done, | 33 &sha256_done, |
34 &sha256_test | 34 &sha256_test, |
35 NULL | |
35 }; | 36 }; |
36 | 37 |
37 #ifdef LTC_SMALL_CODE | 38 #ifdef LTC_SMALL_CODE |
38 /* the K array */ | 39 /* the K array */ |
39 static const unsigned long K[64] = { | 40 static const ulong32 K[64] = { |
40 0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL, 0x3956c25bUL, | 41 0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL, 0x3956c25bUL, |
41 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL, 0xd807aa98UL, 0x12835b01UL, | 42 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL, 0xd807aa98UL, 0x12835b01UL, |
42 0x243185beUL, 0x550c7dc3UL, 0x72be5d74UL, 0x80deb1feUL, 0x9bdc06a7UL, | 43 0x243185beUL, 0x550c7dc3UL, 0x72be5d74UL, 0x80deb1feUL, 0x9bdc06a7UL, |
43 0xc19bf174UL, 0xe49b69c1UL, 0xefbe4786UL, 0x0fc19dc6UL, 0x240ca1ccUL, | 44 0xc19bf174UL, 0xe49b69c1UL, 0xefbe4786UL, 0x0fc19dc6UL, 0x240ca1ccUL, |
44 0x2de92c6fUL, 0x4a7484aaUL, 0x5cb0a9dcUL, 0x76f988daUL, 0x983e5152UL, | 45 0x2de92c6fUL, 0x4a7484aaUL, 0x5cb0a9dcUL, 0x76f988daUL, 0x983e5152UL, |
316 | 317 |
317 for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) { | 318 for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) { |
318 sha256_init(&md); | 319 sha256_init(&md); |
319 sha256_process(&md, (unsigned char*)tests[i].msg, (unsigned long)strlen(tests[i].msg)); | 320 sha256_process(&md, (unsigned char*)tests[i].msg, (unsigned long)strlen(tests[i].msg)); |
320 sha256_done(&md, tmp); | 321 sha256_done(&md, tmp); |
321 if (memcmp(tmp, tests[i].hash, 32) != 0) { | 322 if (XMEMCMP(tmp, tests[i].hash, 32) != 0) { |
322 return CRYPT_FAIL_TESTVECTOR; | 323 return CRYPT_FAIL_TESTVECTOR; |
323 } | 324 } |
324 } | 325 } |
325 return CRYPT_OK; | 326 return CRYPT_OK; |
326 #endif | 327 #endif |
333 #endif | 334 #endif |
334 | 335 |
335 | 336 |
336 | 337 |
337 /* $Source: /cvs/libtom/libtomcrypt/src/hashes/sha2/sha256.c,v $ */ | 338 /* $Source: /cvs/libtom/libtomcrypt/src/hashes/sha2/sha256.c,v $ */ |
338 /* $Revision: 1.5 $ */ | 339 /* $Revision: 1.9 $ */ |
339 /* $Date: 2005/05/23 02:42:07 $ */ | 340 /* $Date: 2006/11/01 09:28:17 $ */ |