gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r8947 - in gnunet/src: core include util


From: gnunet
Subject: [GNUnet-SVN] r8947 - in gnunet/src: core include util
Date: Sat, 5 Sep 2009 14:38:22 -0600

Author: grothoff
Date: 2009-09-05 14:38:19 -0600 (Sat, 05 Sep 2009)
New Revision: 8947

Modified:
   gnunet/src/core/gnunet-service-core.c
   gnunet/src/include/gnunet_crypto_lib.h
   gnunet/src/util/crypto_aes.c
   gnunet/src/util/test_crypto_aes.c
   gnunet/src/util/test_crypto_aes_weak.c
Log:
cleaner crypto api

Modified: gnunet/src/core/gnunet-service-core.c
===================================================================
--- gnunet/src/core/gnunet-service-core.c       2009-09-05 13:19:01 UTC (rev 
8946)
+++ gnunet/src/core/gnunet-service-core.c       2009-09-05 20:38:19 UTC (rev 
8947)
@@ -1264,10 +1264,10 @@
       return GNUNET_SYSERR;
     }
   if (size !=
-      GNUNET_CRYPTO_aes_decrypt (&n->decrypt_key,
-                                 in,
+      GNUNET_CRYPTO_aes_decrypt (in,
                                  (uint16_t) size,
-                                 (const struct
+                                 &n->decrypt_key,
+                                (const struct
                                   GNUNET_CRYPTO_AesInitializationVector *) iv,
                                  out))
     {

Modified: gnunet/src/include/gnunet_crypto_lib.h
===================================================================
--- gnunet/src/include/gnunet_crypto_lib.h      2009-09-05 13:19:01 UTC (rev 
8946)
+++ gnunet/src/include/gnunet_crypto_lib.h      2009-09-05 20:38:19 UTC (rev 
8947)
@@ -273,17 +273,16 @@
 /**
  * Decrypt a given block with the sessionkey.
  *
- * @param sessionkey the key used to decrypt
  * @param block the data to decrypt, encoded as returned by encrypt
  * @param size how big is the block?
+ * @param sessionkey the key used to decrypt
  * @param iv the initialization vector to use
  * @param result address to store the result at
  * @return -1 on failure, size of decrypted block on success
  */
-int GNUNET_CRYPTO_aes_decrypt (const struct GNUNET_CRYPTO_AesSessionKey
-                               *sessionkey, const void *block, uint16_t size,
-                               const struct
-                               GNUNET_CRYPTO_AesInitializationVector *iv,
+int GNUNET_CRYPTO_aes_decrypt (const void *block, uint16_t size,
+                               const struct GNUNET_CRYPTO_AesSessionKey 
*sessionkey, 
+                               const struct 
GNUNET_CRYPTO_AesInitializationVector *iv,
                                void *result);
 
 

Modified: gnunet/src/util/crypto_aes.c
===================================================================
--- gnunet/src/util/crypto_aes.c        2009-09-05 13:19:01 UTC (rev 8946)
+++ gnunet/src/util/crypto_aes.c        2009-09-05 20:38:19 UTC (rev 8947)
@@ -106,18 +106,20 @@
 
 /**
  * Decrypt a given block with the sessionkey.
- * @param sessionkey the key used to decrypt
+ *
  * @param block the data to decrypt, encoded as returned by encrypt
  * @param size the size of the block to decrypt
+ * @param sessionkey the key used to decrypt
  * @param iv the initialization vector to use, use INITVALUE
  *        for streams.
  * @param result address to store the result at
  * @return -1 on failure, size of decrypted block on success
  */
 int
-GNUNET_CRYPTO_aes_decrypt (const struct GNUNET_CRYPTO_AesSessionKey
-                           *sessionkey, const void *block, uint16_t size,
-                           const struct GNUNET_CRYPTO_AesInitializationVector
+GNUNET_CRYPTO_aes_decrypt (const void *block, uint16_t size,
+                           const struct GNUNET_CRYPTO_AesSessionKey
+                           *sessionkey, 
+                          const struct GNUNET_CRYPTO_AesInitializationVector
                            *iv, void *result)
 {
   gcry_cipher_hd_t handle;

Modified: gnunet/src/util/test_crypto_aes.c
===================================================================
--- gnunet/src/util/test_crypto_aes.c   2009-09-05 13:19:01 UTC (rev 8946)
+++ gnunet/src/util/test_crypto_aes.c   2009-09-05 20:38:19 UTC (rev 8947)
@@ -50,9 +50,9 @@
       printf ("symciphertest failed: encryptBlock returned %d\n", size);
       return 1;
     }
-  size = GNUNET_CRYPTO_aes_decrypt (&key,
-                                    result, size,
-                                    (const struct
+  size = GNUNET_CRYPTO_aes_decrypt (result, size,
+                                    &key,
+                                   (const struct
                                      GNUNET_CRYPTO_AesInitializationVector *)
                                     INITVALUE, res);
   if (strlen (TESTSTRING) + 1 != size)
@@ -131,10 +131,10 @@
   res = GNUNET_malloc (GNUNET_CRYPTO_AES_KEY_LENGTH);
 
   if (GNUNET_CRYPTO_AES_KEY_LENGTH !=
-      GNUNET_CRYPTO_aes_decrypt (&key,
-                                 result,
+      GNUNET_CRYPTO_aes_decrypt (result,
                                  GNUNET_CRYPTO_AES_KEY_LENGTH,
-                                 (const struct
+                                 &key,
+                                (const struct
                                   GNUNET_CRYPTO_AesInitializationVector *)
                                  "testtesttesttest", res))
     {

Modified: gnunet/src/util/test_crypto_aes_weak.c
===================================================================
--- gnunet/src/util/test_crypto_aes_weak.c      2009-09-05 13:19:01 UTC (rev 
8946)
+++ gnunet/src/util/test_crypto_aes_weak.c      2009-09-05 20:38:19 UTC (rev 
8947)
@@ -103,7 +103,7 @@
       return 1;
     }
 
-  size = GNUNET_CRYPTO_aes_decrypt (&weak_key, result, size, &INITVALUE, res);
+  size = GNUNET_CRYPTO_aes_decrypt (result, size, &weak_key, &INITVALUE, res);
 
   if ((strlen (WEAK_KEY_TESTSTRING) + 1) != size)
     {





reply via email to

[Prev in Thread] Current Thread [Next in Thread]