diff libtomcrypt/src/hashes/sha2/sha384.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/sha384.c	Thu Feb 08 23:11:40 2018 +0800
+++ b/libtomcrypt/src/hashes/sha2/sha384.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 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 @@
 /**
   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 @@
       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 @@
  #endif
 }
 
-
-
-
+#endif /* defined(LTC_SHA384) && defined(LTC_SHA512) */
 
-
-/* $Source$ */
-/* $Revision$ */
-/* $Date$ */
+/* ref:         $Format:%D$ */
+/* git commit:  $Format:%H$ */
+/* commit time: $Format:%ai$ */