-fixes
[oweals/gnunet.git] / src / util / crypto_hash.c
index 47baf660fe4f83c368d7234afec13984eee58855..cd2ea75bffe0314a7032b0ad361e5ff6952d4033 100644 (file)
  */
 
 #include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_crypto_lib.h"
-#include "gnunet_disk_lib.h"
-#include "gnunet_strings_lib.h"
+#include "gnunet_util_lib.h"
 #include <gcrypt.h>
 
 #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
@@ -292,7 +289,7 @@ GNUNET_CRYPTO_hash_from_string2 (const char *enc,
 
 /**
  * @ingroup hash
- * 
+ *
  * Compute the distance between 2 hashcodes.  The computation must be
  * fast, not involve bits[0] or bits[4] (they're used elsewhere), and be
  * somewhat consistent. And of course, the result should be a positive
@@ -395,16 +392,16 @@ GNUNET_CRYPTO_hash_xor (const struct GNUNET_HashCode * a, const struct GNUNET_Ha
  */
 void
 GNUNET_CRYPTO_hash_to_aes_key (const struct GNUNET_HashCode *hc,
-                               struct GNUNET_CRYPTO_AesSessionKey *skey,
-                               struct GNUNET_CRYPTO_AesInitializationVector *iv)
+                               struct GNUNET_CRYPTO_SymmetricSessionKey *skey,
+                               struct GNUNET_CRYPTO_SymmetricInitializationVector *iv)
 {
   GNUNET_assert (GNUNET_YES ==
-                 GNUNET_CRYPTO_kdf (skey, sizeof (struct GNUNET_CRYPTO_AesSessionKey),
+                 GNUNET_CRYPTO_kdf (skey, sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey),
                                     "Hash key derivation", strlen ("Hash key derivation"),
                                     hc, sizeof (struct GNUNET_HashCode),
                                     NULL, 0));
   GNUNET_assert (GNUNET_YES ==
-                 GNUNET_CRYPTO_kdf (iv, sizeof (struct GNUNET_CRYPTO_AesInitializationVector),
+                 GNUNET_CRYPTO_kdf (iv, sizeof (struct GNUNET_CRYPTO_SymmetricInitializationVector),
                                     "Initialization vector derivation", strlen ("Initialization vector derivation"),
                                     hc, sizeof (struct GNUNET_HashCode),
                                     NULL, 0));
@@ -460,7 +457,7 @@ GNUNET_CRYPTO_hash_matching_bits (const struct GNUNET_HashCode * first,
  * @return 1 if h1 > h2, -1 if h1 < h2 and 0 if h1 == h2.
  */
 int
-GNUNET_CRYPTO_hash_cmp (const struct GNUNET_HashCode *h1, 
+GNUNET_CRYPTO_hash_cmp (const struct GNUNET_HashCode *h1,
                         const struct GNUNET_HashCode *h2)
 {
   unsigned int *i1;
@@ -521,7 +518,7 @@ GNUNET_CRYPTO_hash_xorcmp (const struct GNUNET_HashCode *h1,
  */
 void
 GNUNET_CRYPTO_hmac_derive_key (struct GNUNET_CRYPTO_AuthKey *key,
-                               const struct GNUNET_CRYPTO_AesSessionKey *rkey,
+                               const struct GNUNET_CRYPTO_SymmetricSessionKey *rkey,
                                const void *salt, size_t salt_len, ...)
 {
   va_list argp;
@@ -542,13 +539,13 @@ GNUNET_CRYPTO_hmac_derive_key (struct GNUNET_CRYPTO_AuthKey *key,
  */
 void
 GNUNET_CRYPTO_hmac_derive_key_v (struct GNUNET_CRYPTO_AuthKey *key,
-                                 const struct GNUNET_CRYPTO_AesSessionKey *rkey,
+                                 const struct GNUNET_CRYPTO_SymmetricSessionKey *rkey,
                                  const void *salt, size_t salt_len,
                                  va_list argp)
 {
-  GNUNET_CRYPTO_kdf_v (key->key, sizeof (key->key), 
-                       salt, salt_len, 
-                       rkey, sizeof (struct GNUNET_CRYPTO_AesSessionKey),
+  GNUNET_CRYPTO_kdf_v (key->key, sizeof (key->key),
+                       salt, salt_len,
+                       rkey, sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey),
                        argp);
 }