aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HACKING7
-rw-r--r--src/fs/fs.c1
-rw-r--r--src/fs/fs.h15
-rw-r--r--src/fs/fs_directory.c28
-rw-r--r--src/fs/fs_publish.c70
5 files changed, 67 insertions, 54 deletions
diff --git a/HACKING b/HACKING
index 142f83315..5008b49ce 100644
--- a/HACKING
+++ b/HACKING
@@ -27,6 +27,13 @@ exported symbols:
27- must start with "GNUNET_modulename_" and be defined in "modulename.c" 27- must start with "GNUNET_modulename_" and be defined in "modulename.c"
28- exceptions: those defined in gnunet_common.h 28- exceptions: those defined in gnunet_common.h
29 29
30private (library-internal) symbols (including structs & macros):
31- must NOT start with any prefix
32- must not be exported in a way that linkers could use them or
33 other libraries might see them via headers; they must be either
34 declared/defined in C source files or in headers that are in
35 the respective directory under src/modulename/ and NEVER be
36 declared in src/include/.
30 37
31testcases: 38testcases:
32- must be called "test_module-under-test_case-description.c" 39- must be called "test_module-under-test_case-description.c"
diff --git a/src/fs/fs.c b/src/fs/fs.c
index 157f4ef22..66699507b 100644
--- a/src/fs/fs.c
+++ b/src/fs/fs.c
@@ -61,6 +61,7 @@ GNUNET_FS_start (struct GNUNET_SCHEDULER_Handle *sched,
61 ret->upcb_cls = upcb_cls; 61 ret->upcb_cls = upcb_cls;
62 ret->client = client; 62 ret->client = client;
63 // FIXME: setup receive-loop with client 63 // FIXME: setup receive-loop with client
64
64 // FIXME: deserialize state; use client-name to find master-directory! 65 // FIXME: deserialize state; use client-name to find master-directory!
65 // Deserialize-Upload: 66 // Deserialize-Upload:
66 // * read FNs for upload FIs, deserialize each 67 // * read FNs for upload FIs, deserialize each
diff --git a/src/fs/fs.h b/src/fs/fs.h
index f13619041..288903418 100644
--- a/src/fs/fs.h
+++ b/src/fs/fs.h
@@ -32,7 +32,7 @@
32/** 32/**
33 * Size of the individual blocks used for file-sharing. 33 * Size of the individual blocks used for file-sharing.
34 */ 34 */
35#define GNUNET_FS_DBLOCK_SIZE (32*1024) 35#define DBLOCK_SIZE (32*1024)
36 36
37 37
38/** 38/**
@@ -42,14 +42,14 @@
42 * value is 32768 byte / 128 byte = 256 42 * value is 32768 byte / 128 byte = 256
43 * (128 byte = 2 * 512 bits). DO NOT CHANGE! 43 * (128 byte = 2 * 512 bits). DO NOT CHANGE!
44 */ 44 */
45#define GNUNET_FS_CHK_PER_INODE 256 45#define CHK_PER_INODE 256
46 46
47 47
48/** 48/**
49 * Maximum size for a file to be considered for 49 * Maximum size for a file to be considered for
50 * inlining in a directory. 50 * inlining in a directory.
51 */ 51 */
52#define GNUNET_FS_MAX_INLINE_SIZE 65536 52#define MAX_INLINE_SIZE 65536
53 53
54 54
55 55
@@ -509,7 +509,7 @@ struct GNUNET_FS_Namespace
509/** 509/**
510 * @brief keyword block (advertising data under a keyword) 510 * @brief keyword block (advertising data under a keyword)
511 */ 511 */
512struct GNUNET_FS_KBlock 512struct KBlock
513{ 513{
514 514
515 /** 515 /**
@@ -536,7 +536,7 @@ struct GNUNET_FS_KBlock
536/** 536/**
537 * @brief namespace content block (advertising data under an identifier in a namespace) 537 * @brief namespace content block (advertising data under an identifier in a namespace)
538 */ 538 */
539struct GNUNET_FS_SBlock 539struct SBlock
540{ 540{
541 541
542 /** 542 /**
@@ -571,6 +571,11 @@ struct GNUNET_FS_SBlock
571}; 571};
572 572
573 573
574struct IndexStartMessage
575{
576
577};
578
574 579
575 580
576#endif 581#endif
diff --git a/src/fs/fs_directory.c b/src/fs/fs_directory.c
index be7c0d3e5..d67c6e8ef 100644
--- a/src/fs/fs_directory.c
+++ b/src/fs/fs_directory.c
@@ -173,11 +173,11 @@ GNUNET_FS_directory_list_contents (size_t size,
173 /* URI is never empty, must be end of block, 173 /* URI is never empty, must be end of block,
174 skip to next alignment */ 174 skip to next alignment */
175 align = 175 align =
176 ((pos / GNUNET_FS_DBLOCK_SIZE) + 1) * GNUNET_FS_DBLOCK_SIZE; 176 ((pos / DBLOCK_SIZE) + 1) * DBLOCK_SIZE;
177 if (align == pos) 177 if (align == pos)
178 { 178 {
179 /* if we were already aligned, still skip a block! */ 179 /* if we were already aligned, still skip a block! */
180 align += GNUNET_FS_DBLOCK_SIZE; 180 align += DBLOCK_SIZE;
181 } 181 }
182 pos = align; 182 pos = align;
183 if (pos >= size) 183 if (pos >= size)
@@ -333,7 +333,7 @@ GNUNET_FS_directory_builder_add (struct GNUNET_FS_DirectoryBuilder *bld,
333 fsize = GNUNET_FS_uri_chk_get_file_size (GNUNET_FS_uri_loc_get_uri (uri)); 333 fsize = GNUNET_FS_uri_chk_get_file_size (GNUNET_FS_uri_loc_get_uri (uri));
334 else 334 else
335 fsize = 0; /* not given */ 335 fsize = 0; /* not given */
336 if (fsize > GNUNET_FS_MAX_INLINE_SIZE) 336 if (fsize > MAX_INLINE_SIZE)
337 fsize = 0; /* too large */ 337 fsize = 0; /* too large */
338 if (NULL != memchr (data, 0, fsize)) 338 if (NULL != memchr (data, 0, fsize))
339 fsize = 0; /* must not have 0's in data! */ 339 fsize = 0; /* must not have 0's in data! */
@@ -353,8 +353,8 @@ GNUNET_FS_directory_builder_add (struct GNUNET_FS_DirectoryBuilder *bld,
353 mdxs = 353 mdxs =
354 GNUNET_CONTAINER_meta_data_get_serialized_size (meta, 354 GNUNET_CONTAINER_meta_data_get_serialized_size (meta,
355 GNUNET_CONTAINER_META_DATA_SERIALIZE_FULL); 355 GNUNET_CONTAINER_META_DATA_SERIALIZE_FULL);
356 if ( (slen + sizeof (uint32_t) + mdxs - 1) / GNUNET_FS_DBLOCK_SIZE == 356 if ( (slen + sizeof (uint32_t) + mdxs - 1) / DBLOCK_SIZE ==
357 (slen + sizeof (uint32_t) + mds - 1) / GNUNET_FS_DBLOCK_SIZE) 357 (slen + sizeof (uint32_t) + mds - 1) / DBLOCK_SIZE)
358 { 358 {
359 /* adding full data would not cause us to cross 359 /* adding full data would not cause us to cross
360 additional blocks, so add it! */ 360 additional blocks, so add it! */
@@ -392,7 +392,7 @@ GNUNET_FS_directory_builder_add (struct GNUNET_FS_DirectoryBuilder *bld,
392/** 392/**
393 * Given the start and end position of a block of 393 * Given the start and end position of a block of
394 * data, return the end position of that data 394 * data, return the end position of that data
395 * after alignment to the GNUNET_FS_DBLOCK_SIZE. 395 * after alignment to the DBLOCK_SIZE.
396 */ 396 */
397static size_t 397static size_t
398do_align (size_t start_position, 398do_align (size_t start_position,
@@ -400,7 +400,7 @@ do_align (size_t start_position,
400{ 400{
401 size_t align; 401 size_t align;
402 402
403 align = (end_position / GNUNET_FS_DBLOCK_SIZE) * GNUNET_FS_DBLOCK_SIZE; 403 align = (end_position / DBLOCK_SIZE) * DBLOCK_SIZE;
404 if ((start_position < align) && (end_position > align)) 404 if ((start_position < align) && (end_position > align))
405 return align + end_position - start_position; 405 return align + end_position - start_position;
406 return end_position; 406 return end_position;
@@ -442,28 +442,28 @@ block_align (size_t start,
442 { 442 {
443 cval = perm[j]; 443 cval = perm[j];
444 cend = cpos + sizes[cval]; 444 cend = cpos + sizes[cval];
445 if (cpos % GNUNET_FS_DBLOCK_SIZE == 0) 445 if (cpos % DBLOCK_SIZE == 0)
446 { 446 {
447 /* prefer placing the largest blocks first */ 447 /* prefer placing the largest blocks first */
448 cbad = -(cend % GNUNET_FS_DBLOCK_SIZE); 448 cbad = -(cend % DBLOCK_SIZE);
449 } 449 }
450 else 450 else
451 { 451 {
452 if (cpos / GNUNET_FS_DBLOCK_SIZE == 452 if (cpos / DBLOCK_SIZE ==
453 cend / GNUNET_FS_DBLOCK_SIZE) 453 cend / DBLOCK_SIZE)
454 { 454 {
455 /* Data fits into the same block! Prefer small left-overs! */ 455 /* Data fits into the same block! Prefer small left-overs! */
456 cbad = 456 cbad =
457 GNUNET_FS_DBLOCK_SIZE - cend % GNUNET_FS_DBLOCK_SIZE; 457 DBLOCK_SIZE - cend % DBLOCK_SIZE;
458 } 458 }
459 else 459 else
460 { 460 {
461 /* Would have to waste space to re-align, add big factor, this 461 /* Would have to waste space to re-align, add big factor, this
462 case is a real loss (proportional to space wasted)! */ 462 case is a real loss (proportional to space wasted)! */
463 cbad = 463 cbad =
464 GNUNET_FS_DBLOCK_SIZE * (GNUNET_FS_DBLOCK_SIZE - 464 DBLOCK_SIZE * (DBLOCK_SIZE -
465 cpos % 465 cpos %
466 GNUNET_FS_DBLOCK_SIZE); 466 DBLOCK_SIZE);
467 } 467 }
468 } 468 }
469 if (cbad < badness) 469 if (cbad < badness)
diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c
index 1445c98d5..91ca3240a 100644
--- a/src/fs/fs_publish.c
+++ b/src/fs/fs_publish.c
@@ -360,16 +360,16 @@ compute_depth (uint64_t flen)
360 uint64_t fl; 360 uint64_t fl;
361 361
362 treeDepth = 1; 362 treeDepth = 1;
363 fl = GNUNET_FS_DBLOCK_SIZE; 363 fl = DBLOCK_SIZE;
364 while (fl < flen) 364 while (fl < flen)
365 { 365 {
366 treeDepth++; 366 treeDepth++;
367 if (fl * GNUNET_FS_CHK_PER_INODE < fl) 367 if (fl * CHK_PER_INODE < fl)
368 { 368 {
369 /* integer overflow, this is a HUGE file... */ 369 /* integer overflow, this is a HUGE file... */
370 return treeDepth; 370 return treeDepth;
371 } 371 }
372 fl = fl * GNUNET_FS_CHK_PER_INODE; 372 fl = fl * CHK_PER_INODE;
373 } 373 }
374 return treeDepth; 374 return treeDepth;
375} 375}
@@ -393,20 +393,20 @@ compute_iblock_size (unsigned int height,
393 uint64_t bds; 393 uint64_t bds;
394 394
395 GNUNET_assert (height > 0); 395 GNUNET_assert (height > 0);
396 bds = GNUNET_FS_DBLOCK_SIZE; /* number of bytes each CHK at level "i" 396 bds = DBLOCK_SIZE; /* number of bytes each CHK at level "i"
397 corresponds to */ 397 corresponds to */
398 for (i=0;i<height;i++) 398 for (i=0;i<height;i++)
399 bds *= GNUNET_FS_CHK_PER_INODE; 399 bds *= CHK_PER_INODE;
400 mod = offset % bds; 400 mod = offset % bds;
401 if (0 == mod) 401 if (0 == mod)
402 { 402 {
403 /* we were triggered at the end of a full block */ 403 /* we were triggered at the end of a full block */
404 ret = GNUNET_FS_CHK_PER_INODE; 404 ret = CHK_PER_INODE;
405 } 405 }
406 else 406 else
407 { 407 {
408 /* we were triggered at the end of the file */ 408 /* we were triggered at the end of the file */
409 bds /= GNUNET_FS_CHK_PER_INODE; 409 bds /= CHK_PER_INODE;
410 ret = mod / bds; 410 ret = mod / bds;
411 if (0 != mod % bds) 411 if (0 != mod % bds)
412 ret++; 412 ret++;
@@ -432,13 +432,13 @@ compute_chk_offset (unsigned int height,
432 unsigned int ret; 432 unsigned int ret;
433 unsigned int i; 433 unsigned int i;
434 434
435 bds = GNUNET_FS_DBLOCK_SIZE; /* number of bytes each CHK at level "i" 435 bds = DBLOCK_SIZE; /* number of bytes each CHK at level "i"
436 corresponds to */ 436 corresponds to */
437 for (i=0;i<height;i++) 437 for (i=0;i<height;i++)
438 bds *= GNUNET_FS_CHK_PER_INODE; 438 bds *= CHK_PER_INODE;
439 GNUNET_assert (0 == (offset % bds)); 439 GNUNET_assert (0 == (offset % bds));
440 ret = offset / bds; 440 ret = offset / bds;
441 return ret % GNUNET_FS_CHK_PER_INODE; 441 return ret % CHK_PER_INODE;
442} 442}
443 443
444 444
@@ -460,8 +460,8 @@ publish_content (struct GNUNET_FS_PublishContext *sc,
460 const void *pt_block; 460 const void *pt_block;
461 uint16_t pt_size; 461 uint16_t pt_size;
462 char *emsg; 462 char *emsg;
463 char iob[GNUNET_FS_DBLOCK_SIZE]; 463 char iob[DBLOCK_SIZE];
464 char enc[GNUNET_FS_DBLOCK_SIZE]; 464 char enc[DBLOCK_SIZE];
465 struct GNUNET_CRYPTO_AesSessionKey sk; 465 struct GNUNET_CRYPTO_AesSessionKey sk;
466 struct GNUNET_CRYPTO_AesInitializationVector iv; 466 struct GNUNET_CRYPTO_AesInitializationVector iv;
467 uint64_t size; 467 uint64_t size;
@@ -491,7 +491,7 @@ publish_content (struct GNUNET_FS_PublishContext *sc,
491 else 491 else
492 { 492 {
493 raw_data = NULL; 493 raw_data = NULL;
494 if ( (dirpos->data.file.file_size < GNUNET_FS_MAX_INLINE_SIZE) && 494 if ( (dirpos->data.file.file_size < MAX_INLINE_SIZE) &&
495 (dirpos->data.file.file_size > 0) ) 495 (dirpos->data.file.file_size > 0) )
496 { 496 {
497 raw_data = GNUNET_malloc (dirpos->data.file.file_size); 497 raw_data = GNUNET_malloc (dirpos->data.file.file_size);
@@ -524,21 +524,21 @@ publish_content (struct GNUNET_FS_PublishContext *sc,
524 p->chk_tree_depth = compute_depth (size); 524 p->chk_tree_depth = compute_depth (size);
525 p->chk_tree = GNUNET_malloc (p->chk_tree_depth * 525 p->chk_tree = GNUNET_malloc (p->chk_tree_depth *
526 sizeof (struct ContentHashKey) * 526 sizeof (struct ContentHashKey) *
527 GNUNET_FS_CHK_PER_INODE); 527 CHK_PER_INODE);
528 p->current_depth = p->chk_tree_depth; 528 p->current_depth = p->chk_tree_depth;
529 } 529 }
530 if (p->current_depth == p->chk_tree_depth) 530 if (p->current_depth == p->chk_tree_depth)
531 { 531 {
532 if (p->is_directory) 532 if (p->is_directory)
533 { 533 {
534 pt_size = GNUNET_MIN(GNUNET_FS_DBLOCK_SIZE, 534 pt_size = GNUNET_MIN(DBLOCK_SIZE,
535 p->data.dir.dir_size - p->publish_offset); 535 p->data.dir.dir_size - p->publish_offset);
536 dd = p->data.dir.dir_data; 536 dd = p->data.dir.dir_data;
537 pt_block = &dd[p->publish_offset]; 537 pt_block = &dd[p->publish_offset];
538 } 538 }
539 else 539 else
540 { 540 {
541 pt_size = GNUNET_MIN(GNUNET_FS_DBLOCK_SIZE, 541 pt_size = GNUNET_MIN(DBLOCK_SIZE,
542 p->data.file.file_size - p->publish_offset); 542 p->data.file.file_size - p->publish_offset);
543 emsg = NULL; 543 emsg = NULL;
544 if (pt_size != 544 if (pt_size !=
@@ -579,11 +579,11 @@ publish_content (struct GNUNET_FS_PublishContext *sc,
579 pt_size = compute_iblock_size (p->chk_tree_depth - p->current_depth, 579 pt_size = compute_iblock_size (p->chk_tree_depth - p->current_depth,
580 p->publish_offset); 580 p->publish_offset);
581 pt_block = &p->chk_tree[p->current_depth * 581 pt_block = &p->chk_tree[p->current_depth *
582 GNUNET_FS_CHK_PER_INODE]; 582 CHK_PER_INODE];
583 } 583 }
584 off = compute_chk_offset (p->chk_tree_depth - p->current_depth, 584 off = compute_chk_offset (p->chk_tree_depth - p->current_depth,
585 p->publish_offset); 585 p->publish_offset);
586 mychk = &p->chk_tree[(p->current_depth-1)*GNUNET_FS_CHK_PER_INODE+off]; 586 mychk = &p->chk_tree[(p->current_depth-1)*CHK_PER_INODE+off];
587 GNUNET_CRYPTO_hash (pt_block, pt_size, &mychk->key); 587 GNUNET_CRYPTO_hash (pt_block, pt_size, &mychk->key);
588 GNUNET_CRYPTO_hash_to_aes_key (&mychk->key, &sk, &iv); 588 GNUNET_CRYPTO_hash_to_aes_key (&mychk->key, &sk, &iv);
589 GNUNET_CRYPTO_aes_encrypt (pt_block, 589 GNUNET_CRYPTO_aes_encrypt (pt_block,
@@ -645,12 +645,12 @@ publish_content (struct GNUNET_FS_PublishContext *sc,
645 { 645 {
646 p->publish_offset += pt_size; 646 p->publish_offset += pt_size;
647 if ( (p->publish_offset == size) || 647 if ( (p->publish_offset == size) ||
648 (0 == p->publish_offset % (GNUNET_FS_CHK_PER_INODE * GNUNET_FS_DBLOCK_SIZE) ) ) 648 (0 == p->publish_offset % (CHK_PER_INODE * DBLOCK_SIZE) ) )
649 p->current_depth--; 649 p->current_depth--;
650 } 650 }
651 else 651 else
652 { 652 {
653 if ( (off == GNUNET_FS_CHK_PER_INODE) || 653 if ( (off == CHK_PER_INODE) ||
654 (p->publish_offset == size) ) 654 (p->publish_offset == size) )
655 p->current_depth--; 655 p->current_depth--;
656 else 656 else
@@ -951,13 +951,13 @@ struct PublishKskContext
951 * (in plaintext), has "mdsize+slen" more 951 * (in plaintext), has "mdsize+slen" more
952 * bytes than the struct would suggest. 952 * bytes than the struct would suggest.
953 */ 953 */
954 struct GNUNET_FS_KBlock *kb; 954 struct KBlock *kb;
955 955
956 /** 956 /**
957 * Buffer of the same size as "kb" for 957 * Buffer of the same size as "kb" for
958 * the encrypted version. 958 * the encrypted version.
959 */ 959 */
960 struct GNUNET_FS_KBlock *cpy; 960 struct KBlock *cpy;
961 961
962 /** 962 /**
963 * Handle to the datastore, NULL if we are just 963 * Handle to the datastore, NULL if we are just
@@ -1114,7 +1114,7 @@ publish_ksk_cont (void *cls,
1114 0, 1114 0,
1115 &query, 1115 &query,
1116 pkc->mdsize + 1116 pkc->mdsize +
1117 sizeof (struct GNUNET_FS_KBlock) + 1117 sizeof (struct KBlock) +
1118 pkc->slen, 1118 pkc->slen,
1119 pkc->cpy, 1119 pkc->cpy,
1120 GNUNET_DATASTORE_BLOCKTYPE_KBLOCK, 1120 GNUNET_DATASTORE_BLOCKTYPE_KBLOCK,
@@ -1181,11 +1181,11 @@ GNUNET_FS_publish_ksk (struct GNUNET_FS_Handle *h,
1181 GNUNET_assert (pkc->mdsize >= 0); 1181 GNUNET_assert (pkc->mdsize >= 0);
1182 uris = GNUNET_FS_uri_to_string (uri); 1182 uris = GNUNET_FS_uri_to_string (uri);
1183 pkc->slen = strlen (uris) + 1; 1183 pkc->slen = strlen (uris) + 1;
1184 size = pkc->mdsize + sizeof (struct GNUNET_FS_KBlock) + pkc->slen; 1184 size = pkc->mdsize + sizeof (struct KBlock) + pkc->slen;
1185 if (size > MAX_KBLOCK_SIZE) 1185 if (size > MAX_KBLOCK_SIZE)
1186 { 1186 {
1187 size = MAX_KBLOCK_SIZE; 1187 size = MAX_KBLOCK_SIZE;
1188 pkc->mdsize = size - sizeof (struct GNUNET_FS_KBlock) - pkc->slen; 1188 pkc->mdsize = size - sizeof (struct KBlock) - pkc->slen;
1189 } 1189 }
1190 pkc->kb = GNUNET_malloc (size); 1190 pkc->kb = GNUNET_malloc (size);
1191 kbe = (char *) &pkc->kb[1]; 1191 kbe = (char *) &pkc->kb[1];
@@ -1206,7 +1206,7 @@ GNUNET_FS_publish_ksk (struct GNUNET_FS_Handle *h,
1206 GNUNET_free (pkc); 1206 GNUNET_free (pkc);
1207 return; 1207 return;
1208 } 1208 }
1209 size = sizeof (struct GNUNET_FS_KBlock) + pkc->slen + pkc->mdsize; 1209 size = sizeof (struct KBlock) + pkc->slen + pkc->mdsize;
1210 1210
1211 pkc->cpy = GNUNET_malloc (size); 1211 pkc->cpy = GNUNET_malloc (size);
1212 pkc->cpy->purpose.size = htonl (sizeof (struct GNUNET_CRYPTO_RsaSignaturePurpose) + 1212 pkc->cpy->purpose.size = htonl (sizeof (struct GNUNET_CRYPTO_RsaSignaturePurpose) +
@@ -1322,8 +1322,8 @@ GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h,
1322 size_t nidlen; 1322 size_t nidlen;
1323 size_t idlen; 1323 size_t idlen;
1324 ssize_t mdsize; 1324 ssize_t mdsize;
1325 struct GNUNET_FS_SBlock *sb; 1325 struct SBlock *sb;
1326 struct GNUNET_FS_SBlock *sb_enc; 1326 struct SBlock *sb_enc;
1327 char *dest; 1327 char *dest;
1328 GNUNET_HashCode key; /* hash of thisId = key */ 1328 GNUNET_HashCode key; /* hash of thisId = key */
1329 GNUNET_HashCode id; /* hash of hc = identifier */ 1329 GNUNET_HashCode id; /* hash of hc = identifier */
@@ -1337,13 +1337,13 @@ GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h,
1337 mdsize = GNUNET_CONTAINER_meta_data_get_serialized_size (meta, 1337 mdsize = GNUNET_CONTAINER_meta_data_get_serialized_size (meta,
1338 GNUNET_CONTAINER_META_DATA_SERIALIZE_PART); 1338 GNUNET_CONTAINER_META_DATA_SERIALIZE_PART);
1339 1339
1340 size = sizeof (struct GNUNET_FS_SBlock) + slen + nidlen + mdsize; 1340 size = sizeof (struct SBlock) + slen + nidlen + mdsize;
1341 if (size > MAX_SBLOCK_SIZE) 1341 if (size > MAX_SBLOCK_SIZE)
1342 { 1342 {
1343 size = MAX_SBLOCK_SIZE; 1343 size = MAX_SBLOCK_SIZE;
1344 mdsize = size - (sizeof (struct GNUNET_FS_SBlock) + slen + nidlen); 1344 mdsize = size - (sizeof (struct SBlock) + slen + nidlen);
1345 } 1345 }
1346 sb = GNUNET_malloc (sizeof (struct GNUNET_FS_SBlock) + size); 1346 sb = GNUNET_malloc (sizeof (struct SBlock) + size);
1347 dest = (char *) &sb[1]; 1347 dest = (char *) &sb[1];
1348 memcpy (dest, update, nidlen); 1348 memcpy (dest, update, nidlen);
1349 dest += nidlen; 1349 dest += nidlen;
@@ -1363,8 +1363,8 @@ GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h,
1363 _("Internal error.")); 1363 _("Internal error."));
1364 return; 1364 return;
1365 } 1365 }
1366 size = sizeof (struct GNUNET_FS_SBlock) + mdsize + slen + nidlen; 1366 size = sizeof (struct SBlock) + mdsize + slen + nidlen;
1367 sb_enc = GNUNET_malloc (sizeof (struct GNUNET_FS_SBlock) + size); 1367 sb_enc = GNUNET_malloc (sizeof (struct SBlock) + size);
1368 GNUNET_CRYPTO_hash (identifier, idlen, &key); 1368 GNUNET_CRYPTO_hash (identifier, idlen, &key);
1369 GNUNET_CRYPTO_hash (&key, sizeof (GNUNET_HashCode), &id); 1369 GNUNET_CRYPTO_hash (&key, sizeof (GNUNET_HashCode), &id);
1370 sks_uri = GNUNET_malloc (sizeof (struct GNUNET_FS_Uri)); 1370 sks_uri = GNUNET_malloc (sizeof (struct GNUNET_FS_Uri));
@@ -1379,14 +1379,14 @@ GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h,
1379 &sb_enc->identifier); 1379 &sb_enc->identifier);
1380 GNUNET_CRYPTO_hash_to_aes_key (&key, &sk, &iv); 1380 GNUNET_CRYPTO_hash_to_aes_key (&key, &sk, &iv);
1381 GNUNET_CRYPTO_aes_encrypt (&sb[1], 1381 GNUNET_CRYPTO_aes_encrypt (&sb[1],
1382 size - sizeof (struct GNUNET_FS_SBlock), 1382 size - sizeof (struct SBlock),
1383 &sk, 1383 &sk,
1384 &iv, 1384 &iv,
1385 &sb_enc[1]); 1385 &sb_enc[1]);
1386 GNUNET_free (sb); 1386 GNUNET_free (sb);
1387 sb_enc->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_FS_SBLOCK); 1387 sb_enc->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_FS_SBLOCK);
1388 sb_enc->purpose.size = htonl(slen + mdsize + nidlen 1388 sb_enc->purpose.size = htonl(slen + mdsize + nidlen
1389 + sizeof(struct GNUNET_FS_SBlock) 1389 + sizeof(struct SBlock)
1390 - sizeof(struct GNUNET_CRYPTO_RsaSignature)); 1390 - sizeof(struct GNUNET_CRYPTO_RsaSignature));
1391 GNUNET_assert (GNUNET_OK == 1391 GNUNET_assert (GNUNET_OK ==
1392 GNUNET_CRYPTO_rsa_sign (namespace->key, 1392 GNUNET_CRYPTO_rsa_sign (namespace->key,