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)
downloadgnunet-82dad580ad5ba8d2ec44a3a94f5acff01a70489d.tar.gz
gnunet-82dad580ad5ba8d2ec44a3a94f5acff01a70489d.zip
-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 6c4ee6696..bb3accb82 100644
--- a/src/fs/fs_unindex.c
+++ b/src/fs/fs_unindex.c
@@ -31,6 +31,7 @@
31#include "fs_api.h" 31#include "fs_api.h"
32#include "fs_tree.h" 32#include "fs_tree.h"
33#include "block_fs.h" 33#include "block_fs.h"
34#include "fs_publish_ublock.h"
34 35
35 36
36/** 37/**
@@ -492,17 +493,16 @@ process_kblock_for_unindex (void *cls,
492 } 493 }
493 { 494 {
494 char pt[size - sizeof (struct UBlock)]; 495 char pt[size - sizeof (struct UBlock)];
495 struct GNUNET_CRYPTO_AesSessionKey skey; 496 struct GNUNET_CRYPTO_EccPublicSignKey anon_pub;
496 struct GNUNET_CRYPTO_AesInitializationVector iv; 497 const char *keyword;
497 498
498 GNUNET_CRYPTO_hash_to_aes_key (&uc->ukey, &skey, &iv); 499 GNUNET_CRYPTO_ecc_key_get_public_for_signature (GNUNET_CRYPTO_ecc_key_get_anonymous (),
499 if (-1 == 500 &anon_pub);
500 GNUNET_CRYPTO_aes_decrypt (&ub[1], size - sizeof (struct UBlock), &skey, 501 keyword = &uc->ksk_uri->data.ksk.keywords[uc->ksk_offset][1];
501 &iv, pt)) 502 GNUNET_FS_ublock_decrypt_ (&ub[1], size - sizeof (struct UBlock),
502 { 503 &anon_pub,
503 GNUNET_break (0); 504 keyword,
504 goto get_next; 505 pt);
505 }
506 if (NULL == memchr (&pt[1], 0, sizeof (pt) - 1)) 506 if (NULL == memchr (&pt[1], 0, sizeof (pt) - 1))
507 { 507 {
508 GNUNET_break_op (0); /* malformed UBlock */ 508 GNUNET_break_op (0); /* malformed UBlock */
@@ -689,7 +689,7 @@ GNUNET_FS_unindex_process_hash_ (void *cls, const struct GNUNET_HashCode * file_
689 * Create SUSPEND event for the given unindex operation 689 * Create SUSPEND event for the given unindex operation
690 * and then clean up our state (without stop signal). 690 * and then clean up our state (without stop signal).
691 * 691 *
692 * @param cls the 'struct GNUNET_FS_UnindexContext' to signal for 692 * @param cls the `struct GNUNET_FS_UnindexContext` to signal for
693 */ 693 */
694void 694void
695GNUNET_FS_unindex_signal_suspend_ (void *cls) 695GNUNET_FS_unindex_signal_suspend_ (void *cls)
@@ -760,7 +760,8 @@ GNUNET_FS_unindex_signal_suspend_ (void *cls)
760 * @return NULL on error, otherwise handle 760 * @return NULL on error, otherwise handle
761 */ 761 */
762struct GNUNET_FS_UnindexContext * 762struct GNUNET_FS_UnindexContext *
763GNUNET_FS_unindex_start (struct GNUNET_FS_Handle *h, const char *filename, 763GNUNET_FS_unindex_start (struct GNUNET_FS_Handle *h,
764 const char *filename,
764 void *cctx) 765 void *cctx)
765{ 766{
766 struct GNUNET_FS_UnindexContext *ret; 767 struct GNUNET_FS_UnindexContext *ret;