Mercurial > dropbear
diff libtomcrypt/src/hashes/sha2/sha224.c @ 1471:6dba84798cd5
Update to libtomcrypt 1.18.1, merged with Dropbear changes
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Fri, 09 Feb 2018 21:44:05 +0800 |
parents | f849a5ca2efc |
children |
line wrap: on
line diff
--- a/libtomcrypt/src/hashes/sha2/sha224.c Thu Feb 08 23:11:40 2018 +0800 +++ b/libtomcrypt/src/hashes/sha2/sha224.c Fri Feb 09 21:44:05 2018 +0800 @@ -5,14 +5,16 @@ * * The library is free for all purposes without any express * guarantee it works. - * - * Tom St Denis, [email protected], http://libtom.org */ /** @param sha224.c LTC_SHA-224 new NIST standard based off of LTC_SHA-256 truncated to 224 bits (Tom St Denis) */ +#include "tomcrypt.h" + +#if defined(LTC_SHA224) && defined(LTC_SHA256) + const struct ltc_hash_descriptor sha224_desc = { "sha224", @@ -72,21 +74,21 @@ XMEMCPY(out, buf, 28); #ifdef LTC_CLEAN_STACK zeromem(buf, sizeof(buf)); -#endif +#endif return err; } /** Self-test the hash @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled -*/ +*/ int sha224_test(void) { #ifndef LTC_TEST return CRYPT_NOP; - #else + #else static const struct { - char *msg; + const char *msg; unsigned char hash[28]; } tests[] = { { "abc", @@ -111,7 +113,7 @@ sha224_init(&md); sha224_process(&md, (unsigned char*)tests[i].msg, (unsigned long)strlen(tests[i].msg)); sha224_done(&md, tmp); - if (XMEMCMP(tmp, tests[i].hash, 28) != 0) { + if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "SHA224", i)) { return CRYPT_FAIL_TESTVECTOR; } } @@ -119,7 +121,9 @@ #endif } +#endif /* defined(LTC_SHA224) && defined(LTC_SHA256) */ -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ + +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */