gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r29261 - gnunet/src/fs


From: gnunet
Subject: [GNUnet-SVN] r29261 - gnunet/src/fs
Date: Sun, 15 Sep 2013 17:35:30 +0200

Author: grothoff
Date: 2013-09-15 17:35:30 +0200 (Sun, 15 Sep 2013)
New Revision: 29261

Modified:
   gnunet/src/fs/fs_publish_ublock.c
   gnunet/src/fs/fs_search.c
   gnunet/src/fs/fs_unindex.c
Log:
-fix unindexing of KBlocks, make use of standard UBlock decryption routines to 
avoid decoding failures

Modified: gnunet/src/fs/fs_publish_ublock.c
===================================================================
--- gnunet/src/fs/fs_publish_ublock.c   2013-09-15 14:31:05 UTC (rev 29260)
+++ gnunet/src/fs/fs_publish_ublock.c   2013-09-15 15:35:30 UTC (rev 29261)
@@ -65,7 +65,7 @@
  * Decrypt the given UBlock, storing the result in output.
  *
  * @param input input data
- * @param input_len number of bytes in input
+ * @param input_len number of bytes in @a input
  * @param ns public key under which the UBlock was stored
  * @param label label under which the UBlock was stored
  * @param output where to write the result, has input_len bytes

Modified: gnunet/src/fs/fs_search.c
===================================================================
--- gnunet/src/fs/fs_search.c   2013-09-15 14:31:05 UTC (rev 29260)
+++ gnunet/src/fs/fs_search.c   2013-09-15 15:35:30 UTC (rev 29261)
@@ -672,9 +672,9 @@
  * @param sc search context with the keywords
  * @param dpub derived public key used for the search
  * @param edata encrypted data
- * @param edata_size number of bytes in 'edata' (and 'data')
+ * @param edata_size number of bytes in @a edata (and @a data)
  * @param data where to store the plaintext
- * @return keyword index on success, GNUNET_SYSERR on error (no such 
+ * @return keyword index on success, #GNUNET_SYSERR on error (no such 
  *         keyword, internal error)
  */
 static int

Modified: gnunet/src/fs/fs_unindex.c
===================================================================
--- gnunet/src/fs/fs_unindex.c  2013-09-15 14:31:05 UTC (rev 29260)
+++ gnunet/src/fs/fs_unindex.c  2013-09-15 15:35:30 UTC (rev 29261)
@@ -31,6 +31,7 @@
 #include "fs_api.h"
 #include "fs_tree.h"
 #include "block_fs.h"
+#include "fs_publish_ublock.h"
 
 
 /**
@@ -492,17 +493,16 @@
   }
   {
     char pt[size - sizeof (struct UBlock)];  
-    struct GNUNET_CRYPTO_AesSessionKey skey;
-    struct GNUNET_CRYPTO_AesInitializationVector iv;
+    struct GNUNET_CRYPTO_EccPublicSignKey anon_pub;
+    const char *keyword;
      
-    GNUNET_CRYPTO_hash_to_aes_key (&uc->ukey, &skey, &iv);
-    if (-1 ==
-       GNUNET_CRYPTO_aes_decrypt (&ub[1], size - sizeof (struct UBlock), &skey,
-                                  &iv, pt))
-    {
-      GNUNET_break (0);
-      goto get_next;
-    }       
+    GNUNET_CRYPTO_ecc_key_get_public_for_signature 
(GNUNET_CRYPTO_ecc_key_get_anonymous (),
+                                                   &anon_pub);
+    keyword = &uc->ksk_uri->data.ksk.keywords[uc->ksk_offset][1];
+    GNUNET_FS_ublock_decrypt_ (&ub[1], size - sizeof (struct UBlock),
+                              &anon_pub,
+                              keyword,
+                              pt);
     if (NULL == memchr (&pt[1], 0, sizeof (pt) - 1))
     {
       GNUNET_break_op (0); /* malformed UBlock */
@@ -689,7 +689,7 @@
  * Create SUSPEND event for the given unindex operation
  * and then clean up our state (without stop signal).
  *
- * @param cls the 'struct GNUNET_FS_UnindexContext' to signal for
+ * @param cls the `struct GNUNET_FS_UnindexContext` to signal for
  */
 void
 GNUNET_FS_unindex_signal_suspend_ (void *cls)
@@ -760,7 +760,8 @@
  * @return NULL on error, otherwise handle
  */
 struct GNUNET_FS_UnindexContext *
-GNUNET_FS_unindex_start (struct GNUNET_FS_Handle *h, const char *filename,
+GNUNET_FS_unindex_start (struct GNUNET_FS_Handle *h, 
+                        const char *filename,
                          void *cctx)
 {
   struct GNUNET_FS_UnindexContext *ret;




reply via email to

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