diff options
author | Matt Johnston <matt@ucc.asn.au> | 2018-02-17 19:29:51 +0800 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2018-02-17 19:29:51 +0800 |
commit | 7e8094d53a1c01ac671156ff2e67157b64d01a3a (patch) | |
tree | c88345f5bdd118eb9414dff5ab5c307bb1806c57 /libtomcrypt/src/hashes/sha2/sha384.c | |
parent | f7a664f127d3dfde0e7c7a9ca74b1d14f9a2f983 (diff) | |
parent | f042eb41ab0d31f8ba0c5ccc9c848ad01f08f986 (diff) |
merge from main
--HG--
branch : fuzz
Diffstat (limited to 'libtomcrypt/src/hashes/sha2/sha384.c')
-rw-r--r-- | libtomcrypt/src/hashes/sha2/sha384.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/libtomcrypt/src/hashes/sha2/sha384.c b/libtomcrypt/src/hashes/sha2/sha384.c index cf4d7dc..1623812 100644 --- a/libtomcrypt/src/hashes/sha2/sha384.c +++ b/libtomcrypt/src/hashes/sha2/sha384.c @@ -5,14 +5,16 @@ * * The library is free for all purposes without any express * guarantee it works. - * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ -/** +/** @param sha384.c LTC_SHA384 hash included in sha512.c, Tom St Denis */ +#include "tomcrypt.h" + +#if defined(LTC_SHA384) && defined(LTC_SHA512) + const struct ltc_hash_descriptor sha384_desc = { "sha384", @@ -81,14 +83,14 @@ int sha384_done(hash_state * md, unsigned char *out) /** Self-test the hash @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled -*/ +*/ int sha384_test(void) { #ifndef LTC_TEST return CRYPT_NOP; - #else + #else static const struct { - char *msg; + const char *msg; unsigned char hash[48]; } tests[] = { { "abc", @@ -117,7 +119,7 @@ int sha384_test(void) sha384_init(&md); sha384_process(&md, (unsigned char*)tests[i].msg, (unsigned long)strlen(tests[i].msg)); sha384_done(&md, tmp); - if (XMEMCMP(tmp, tests[i].hash, 48) != 0) { + if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "SHA384", i)) { return CRYPT_FAIL_TESTVECTOR; } } @@ -125,11 +127,8 @@ int sha384_test(void) #endif } +#endif /* defined(LTC_SHA384) && defined(LTC_SHA512) */ - - - - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ |