Mercurial > dropbear
comparison libtomcrypt/src/hashes/sha2/sha224.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 /** | 11 /** |
12 @param sha224.c | 12 @param sha224.c |
13 SHA-224 new NIST standard based off of SHA-256 truncated to 224 bits (Tom St Denis) | 13 SHA-224 new NIST standard based off of SHA-256 truncated to 224 bits (Tom St Denis) |
14 */ | 14 */ |
25 9, | 25 9, |
26 | 26 |
27 &sha224_init, | 27 &sha224_init, |
28 &sha256_process, | 28 &sha256_process, |
29 &sha224_done, | 29 &sha224_done, |
30 &sha224_test | 30 &sha224_test, |
31 NULL | |
31 }; | 32 }; |
32 | 33 |
33 /* init the sha256 er... sha224 state ;-) */ | 34 /* init the sha256 er... sha224 state ;-) */ |
34 /** | 35 /** |
35 Initialize the hash state | 36 Initialize the hash state |
108 | 109 |
109 for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) { | 110 for (i = 0; i < (int)(sizeof(tests) / sizeof(tests[0])); i++) { |
110 sha224_init(&md); | 111 sha224_init(&md); |
111 sha224_process(&md, (unsigned char*)tests[i].msg, (unsigned long)strlen(tests[i].msg)); | 112 sha224_process(&md, (unsigned char*)tests[i].msg, (unsigned long)strlen(tests[i].msg)); |
112 sha224_done(&md, tmp); | 113 sha224_done(&md, tmp); |
113 if (memcmp(tmp, tests[i].hash, 28) != 0) { | 114 if (XMEMCMP(tmp, tests[i].hash, 28) != 0) { |
114 return CRYPT_FAIL_TESTVECTOR; | 115 return CRYPT_FAIL_TESTVECTOR; |
115 } | 116 } |
116 } | 117 } |
117 return CRYPT_OK; | 118 return CRYPT_OK; |
118 #endif | 119 #endif |
119 } | 120 } |
120 | 121 |
121 | 122 |
122 /* $Source: /cvs/libtom/libtomcrypt/src/hashes/sha2/sha224.c,v $ */ | 123 /* $Source: /cvs/libtom/libtomcrypt/src/hashes/sha2/sha224.c,v $ */ |
123 /* $Revision: 1.5 $ */ | 124 /* $Revision: 1.8 $ */ |
124 /* $Date: 2005/05/23 02:42:07 $ */ | 125 /* $Date: 2006/11/01 09:28:17 $ */ |