aboutsummaryrefslogtreecommitdiff
path: root/src/fs/fs_unindex.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-09-15 15:35:30 +0000
committerChristian Grothoff <christian@grothoff.org>2013-09-15 15:35:30 +0000
commit82dad580ad5ba8d2ec44a3a94f5acff01a70489d (patch)
tree05560e05ff545261e740703fa5ae330d0e0fdb38 /src/fs/fs_unindex.c
parentd4d2c0f533618b7c3a8e7200e6d080c4ff69f6d1 (diff)
-fix unindexing of KBlocks, make use of standard UBlock decryption routines to avoid decoding failures
Diffstat (limited to 'src/fs/fs_unindex.c')
-rw-r--r--src/fs/fs_unindex.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/fs/fs_unindex.c b/src/fs/fs_unindex.c
index 6c4ee66963..bb3accb823 100644
--- a/src/fs/fs_unindex.c
+++ b/src/fs/fs_unindex.c
@@ -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 @@ process_kblock_for_unindex (void *cls,
}
{
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 @@ GNUNET_FS_unindex_process_hash_ (void *cls, const struct GNUNET_HashCode * file_
* 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 @@ GNUNET_FS_unindex_signal_suspend_ (void *cls)
* @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;