glitch in the license text detected by hyazinthe, thank you!
[oweals/gnunet.git] / src / util / crypto_hash.c
index e9f25bf842e0ad711a8b7c8238b939e586f7237e..dbc4c07a3e690c233aaf3921bb1d3b8ddbb06078 100644 (file)
@@ -1,21 +1,16 @@
 /*
      This file is part of GNUnet.
-     Copyright (C) 2001-2013 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2001-2013 GNUnet e.V.
 
-     GNUnet is free software; you can redistribute it and/or modify
-     it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 3, or (at your
-     option) any later version.
+     GNUnet is free software: you can redistribute it and/or modify it
+     under the terms of the GNU Affero General Public License as published
+     by the Free Software Foundation, either version 3 of the License,
+     or (at your option) any later version.
 
      GNUnet is distributed in the hope that it will be useful, but
      WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     General Public License for more details.
-
-     You should have received a copy of the GNU General Public License
-     along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-     Boston, MA 02111-1307, USA.
+     Affero General Public License for more details.
 
 */
 /**
  * @author Christian Grothoff
  */
 #include "platform.h"
-#include "gnunet_util_lib.h"
+#include "gnunet_crypto_lib.h"
+#include "gnunet_strings_lib.h"
 #include <gcrypt.h>
 
-#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
+#define LOG(kind,...) GNUNET_log_from (kind, "util-crypto-hash", __VA_ARGS__)
 
-#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename)
+#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util-crypto-hash", syscall, filename)
 
 /**
  * Hash block of given size.
@@ -68,9 +64,9 @@ GNUNET_CRYPTO_hash_to_enc (const struct GNUNET_HashCode *block,
   char *np;
 
   np = GNUNET_STRINGS_data_to_string ((const unsigned char *) block,
-                                     sizeof (struct GNUNET_HashCode),
-                                     (char*) result,
-                                     sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded) - 1);
+                                      sizeof (struct GNUNET_HashCode),
+                                      (char *) result,
+                                      sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded) - 1);
   GNUNET_assert (NULL != np);
   *np = '\0';
 }
@@ -395,7 +391,7 @@ GNUNET_CRYPTO_hmac (const struct GNUNET_CRYPTO_AuthKey *key,
   gcry_md_write (md, plaintext, plaintext_len);
   mc = gcry_md_read (md, GCRY_MD_SHA512);
   GNUNET_assert (NULL != mc);
-  memcpy (hmac->bits, mc, sizeof (hmac->bits));
+  GNUNET_memcpy (hmac->bits, mc, sizeof (hmac->bits));
 }
 
 
@@ -439,8 +435,8 @@ GNUNET_CRYPTO_hash_context_start ()
  */
 void
 GNUNET_CRYPTO_hash_context_read (struct GNUNET_HashContext *hc,
-                         const void *buf,
-                         size_t size)
+                                const void *buf,
+                                size_t size)
 {
   gcry_md_write (hc->hd, buf, size);
 }
@@ -460,7 +456,7 @@ GNUNET_CRYPTO_hash_context_finish (struct GNUNET_HashContext *hc,
 
   GNUNET_assert (NULL != res);
   if (NULL != r_hash)
-    memcpy (r_hash,
+    GNUNET_memcpy (r_hash,
             res,
             sizeof (struct GNUNET_HashCode));
   GNUNET_CRYPTO_hash_context_abort (hc);