aboutsummaryrefslogtreecommitdiff
path: root/src/fs/fs_pseudonym.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs/fs_pseudonym.c')
-rw-r--r--src/fs/fs_pseudonym.c182
1 files changed, 91 insertions, 91 deletions
diff --git a/src/fs/fs_pseudonym.c b/src/fs/fs_pseudonym.c
index 5e9c9816e..eb8c43ddf 100644
--- a/src/fs/fs_pseudonym.c
+++ b/src/fs/fs_pseudonym.c
@@ -67,22 +67,22 @@
67/** 67/**
68 * Registered callbacks for discovery of pseudonyms. 68 * Registered callbacks for discovery of pseudonyms.
69 */ 69 */
70struct GNUNET_PSEUDONYM_DiscoveryHandle 70struct GNUNET_FS_pseudonym_DiscoveryHandle
71{ 71{
72 /** 72 /**
73 * This is a doubly linked list. 73 * This is a doubly linked list.
74 */ 74 */
75 struct GNUNET_PSEUDONYM_DiscoveryHandle *next; 75 struct GNUNET_FS_pseudonym_DiscoveryHandle *next;
76 76
77 /** 77 /**
78 * This is a doubly linked list. 78 * This is a doubly linked list.
79 */ 79 */
80 struct GNUNET_PSEUDONYM_DiscoveryHandle *prev; 80 struct GNUNET_FS_pseudonym_DiscoveryHandle *prev;
81 81
82 /** 82 /**
83 * Function to call each time a pseudonym is discovered. 83 * Function to call each time a pseudonym is discovered.
84 */ 84 */
85 GNUNET_PSEUDONYM_Iterator callback; 85 GNUNET_FS_PseudonymIterator callback;
86 86
87 /** 87 /**
88 * Closure for callback. 88 * Closure for callback.
@@ -95,13 +95,13 @@ struct GNUNET_PSEUDONYM_DiscoveryHandle
95 * Head of the linked list of functions to call when 95 * Head of the linked list of functions to call when
96 * new pseudonyms are added. 96 * new pseudonyms are added.
97 */ 97 */
98static struct GNUNET_PSEUDONYM_DiscoveryHandle *disco_head; 98static struct GNUNET_FS_pseudonym_DiscoveryHandle *disco_head;
99 99
100/** 100/**
101 * Tail of the linked list of functions to call when 101 * Tail of the linked list of functions to call when
102 * new pseudonyms are added. 102 * new pseudonyms are added.
103 */ 103 */
104static struct GNUNET_PSEUDONYM_DiscoveryHandle *disco_tail; 104static struct GNUNET_FS_pseudonym_DiscoveryHandle *disco_tail;
105 105
106 106
107/** 107/**
@@ -112,10 +112,10 @@ static struct GNUNET_PSEUDONYM_DiscoveryHandle *disco_tail;
112 * @param rating rating of pseudonym 112 * @param rating rating of pseudonym
113 */ 113 */
114static void 114static void
115internal_notify (const struct GNUNET_PseudonymIdentifier *pseudonym, 115internal_notify (const struct GNUNET_FS_PseudonymIdentifier *pseudonym,
116 const struct GNUNET_CONTAINER_MetaData *md, int rating) 116 const struct GNUNET_CONTAINER_MetaData *md, int rating)
117{ 117{
118 struct GNUNET_PSEUDONYM_DiscoveryHandle *pos; 118 struct GNUNET_FS_pseudonym_DiscoveryHandle *pos;
119 119
120 for (pos = disco_head; NULL != pos; pos = pos->next) 120 for (pos = disco_head; NULL != pos; pos = pos->next)
121 pos->callback (pos->callback_cls, pseudonym, NULL, NULL, md, rating); 121 pos->callback (pos->callback_cls, pseudonym, NULL, NULL, md, rating);
@@ -133,19 +133,19 @@ internal_notify (const struct GNUNET_PseudonymIdentifier *pseudonym,
133 * @param iterator_cls point to a closure 133 * @param iterator_cls point to a closure
134 * @return registration handle 134 * @return registration handle
135 */ 135 */
136struct GNUNET_PSEUDONYM_DiscoveryHandle * 136struct GNUNET_FS_pseudonym_DiscoveryHandle *
137GNUNET_PSEUDONYM_discovery_callback_register (const struct 137GNUNET_FS_pseudonym_discovery_callback_register (const struct
138 GNUNET_CONFIGURATION_Handle *cfg, 138 GNUNET_CONFIGURATION_Handle *cfg,
139 GNUNET_PSEUDONYM_Iterator iterator, 139 GNUNET_FS_PseudonymIterator iterator,
140 void *iterator_cls) 140 void *iterator_cls)
141{ 141{
142 struct GNUNET_PSEUDONYM_DiscoveryHandle *dh; 142 struct GNUNET_FS_pseudonym_DiscoveryHandle *dh;
143 143
144 dh = GNUNET_malloc (sizeof (struct GNUNET_PSEUDONYM_DiscoveryHandle)); 144 dh = GNUNET_malloc (sizeof (struct GNUNET_FS_pseudonym_DiscoveryHandle));
145 dh->callback = iterator; 145 dh->callback = iterator;
146 dh->callback_cls = iterator_cls; 146 dh->callback_cls = iterator_cls;
147 GNUNET_CONTAINER_DLL_insert (disco_head, disco_tail, dh); 147 GNUNET_CONTAINER_DLL_insert (disco_head, disco_tail, dh);
148 GNUNET_PSEUDONYM_list_all (cfg, iterator, iterator_cls); 148 GNUNET_FS_pseudonym_list_all (cfg, iterator, iterator_cls);
149 return dh; 149 return dh;
150} 150}
151 151
@@ -156,7 +156,7 @@ GNUNET_PSEUDONYM_discovery_callback_register (const struct
156 * @param dh registration to unregister 156 * @param dh registration to unregister
157 */ 157 */
158void 158void
159GNUNET_PSEUDONYM_discovery_callback_unregister (struct GNUNET_PSEUDONYM_DiscoveryHandle *dh) 159GNUNET_FS_pseudonym_discovery_callback_unregister (struct GNUNET_FS_pseudonym_DiscoveryHandle *dh)
160{ 160{
161 GNUNET_CONTAINER_DLL_remove (disco_head, disco_tail, dh); 161 GNUNET_CONTAINER_DLL_remove (disco_head, disco_tail, dh);
162 GNUNET_free (dh); 162 GNUNET_free (dh);
@@ -175,7 +175,7 @@ GNUNET_PSEUDONYM_discovery_callback_unregister (struct GNUNET_PSEUDONYM_Discover
175static char * 175static char *
176get_data_filename (const struct GNUNET_CONFIGURATION_Handle *cfg, 176get_data_filename (const struct GNUNET_CONFIGURATION_Handle *cfg,
177 const char *prefix, 177 const char *prefix,
178 const struct GNUNET_PseudonymIdentifier *pseudonym) 178 const struct GNUNET_FS_PseudonymIdentifier *pseudonym)
179{ 179{
180 struct GNUNET_CRYPTO_HashAsciiEncoded enc; 180 struct GNUNET_CRYPTO_HashAsciiEncoded enc;
181 struct GNUNET_HashCode psid; 181 struct GNUNET_HashCode psid;
@@ -183,7 +183,7 @@ get_data_filename (const struct GNUNET_CONFIGURATION_Handle *cfg,
183 if (NULL != pseudonym) 183 if (NULL != pseudonym)
184 { 184 {
185 GNUNET_CRYPTO_hash (pseudonym, 185 GNUNET_CRYPTO_hash (pseudonym,
186 sizeof (struct GNUNET_PseudonymIdentifier), 186 sizeof (struct GNUNET_FS_PseudonymIdentifier),
187 &psid); 187 &psid);
188 GNUNET_CRYPTO_hash_to_enc (&psid, &enc); 188 GNUNET_CRYPTO_hash_to_enc (&psid, &enc);
189 } 189 }
@@ -237,8 +237,8 @@ get_data_filename_hash (const struct GNUNET_CONFIGURATION_Handle *cfg,
237 * @return GNUNET_OK on success, GNUNET_SYSERR on failure 237 * @return GNUNET_OK on success, GNUNET_SYSERR on failure
238 */ 238 */
239int 239int
240GNUNET_PSEUDONYM_set_info (const struct GNUNET_CONFIGURATION_Handle *cfg, 240GNUNET_FS_pseudonym_set_info (const struct GNUNET_CONFIGURATION_Handle *cfg,
241 const struct GNUNET_PseudonymIdentifier *pseudonym, 241 const struct GNUNET_FS_PseudonymIdentifier *pseudonym,
242 const char *name, 242 const char *name,
243 const struct GNUNET_CONTAINER_MetaData *md, 243 const struct GNUNET_CONTAINER_MetaData *md,
244 int32_t rank) 244 int32_t rank)
@@ -253,7 +253,7 @@ GNUNET_PSEUDONYM_set_info (const struct GNUNET_CONFIGURATION_Handle *cfg,
253 return GNUNET_SYSERR; 253 return GNUNET_SYSERR;
254 } 254 }
255 if ((GNUNET_OK != GNUNET_BIO_write (fileW, pseudonym, 255 if ((GNUNET_OK != GNUNET_BIO_write (fileW, pseudonym,
256 sizeof (struct GNUNET_PseudonymIdentifier))) || 256 sizeof (struct GNUNET_FS_PseudonymIdentifier))) ||
257 (GNUNET_OK != GNUNET_BIO_write_int32 (fileW, rank)) || 257 (GNUNET_OK != GNUNET_BIO_write_int32 (fileW, rank)) ||
258 (GNUNET_OK != GNUNET_BIO_write_string (fileW, name)) || 258 (GNUNET_OK != GNUNET_BIO_write_string (fileW, name)) ||
259 (GNUNET_OK != GNUNET_BIO_write_meta_data (fileW, md))) 259 (GNUNET_OK != GNUNET_BIO_write_meta_data (fileW, md)))
@@ -272,7 +272,7 @@ GNUNET_PSEUDONYM_set_info (const struct GNUNET_CONFIGURATION_Handle *cfg,
272 GNUNET_free (fn); 272 GNUNET_free (fn);
273 /* create entry for pseudonym name in names */ 273 /* create entry for pseudonym name in names */
274 if (NULL != name) 274 if (NULL != name)
275 GNUNET_free_non_null (GNUNET_PSEUDONYM_name_uniquify (cfg, pseudonym, 275 GNUNET_free_non_null (GNUNET_FS_pseudonym_name_uniquify (cfg, pseudonym,
276 name, NULL)); 276 name, NULL));
277 return GNUNET_OK; 277 return GNUNET_OK;
278} 278}
@@ -290,12 +290,12 @@ GNUNET_PSEUDONYM_set_info (const struct GNUNET_CONFIGURATION_Handle *cfg,
290 */ 290 */
291static int 291static int
292read_info (const struct GNUNET_CONFIGURATION_Handle *cfg, 292read_info (const struct GNUNET_CONFIGURATION_Handle *cfg,
293 const struct GNUNET_PseudonymIdentifier *pseudonym, 293 const struct GNUNET_FS_PseudonymIdentifier *pseudonym,
294 struct GNUNET_CONTAINER_MetaData **meta, 294 struct GNUNET_CONTAINER_MetaData **meta,
295 int32_t *rank, 295 int32_t *rank,
296 char **ns_name) 296 char **ns_name)
297{ 297{
298 struct GNUNET_PseudonymIdentifier pd; 298 struct GNUNET_FS_PseudonymIdentifier pd;
299 char *fn; 299 char *fn;
300 char *emsg; 300 char *emsg;
301 struct GNUNET_BIO_ReadHandle *fileR; 301 struct GNUNET_BIO_ReadHandle *fileR;
@@ -351,7 +351,7 @@ read_info (const struct GNUNET_CONFIGURATION_Handle *cfg,
351 351
352/** 352/**
353 * Return unique variant of the namespace name. Use it after 353 * Return unique variant of the namespace name. Use it after
354 * GNUNET_PSEUDONYM_get_info() to make sure that name is unique. 354 * GNUNET_FS_pseudonym_get_info() to make sure that name is unique.
355 * 355 *
356 * @param cfg configuration 356 * @param cfg configuration
357 * @param pseudonym public key of the pseudonym 357 * @param pseudonym public key of the pseudonym
@@ -361,13 +361,13 @@ read_info (const struct GNUNET_CONFIGURATION_Handle *cfg,
361 * Free the name with GNUNET_free(). 361 * Free the name with GNUNET_free().
362 */ 362 */
363char * 363char *
364GNUNET_PSEUDONYM_name_uniquify (const struct GNUNET_CONFIGURATION_Handle *cfg, 364GNUNET_FS_pseudonym_name_uniquify (const struct GNUNET_CONFIGURATION_Handle *cfg,
365 const struct GNUNET_PseudonymIdentifier *pseudonym, 365 const struct GNUNET_FS_PseudonymIdentifier *pseudonym,
366 const char *name, 366 const char *name,
367 unsigned int *suffix) 367 unsigned int *suffix)
368{ 368{
369 struct GNUNET_HashCode nh; 369 struct GNUNET_HashCode nh;
370 struct GNUNET_PseudonymIdentifier pi; 370 struct GNUNET_FS_PseudonymIdentifier pi;
371 uint64_t len; 371 uint64_t len;
372 char *fn; 372 char *fn;
373 struct GNUNET_DISK_FileHandle *fh; 373 struct GNUNET_DISK_FileHandle *fh;
@@ -388,11 +388,11 @@ GNUNET_PSEUDONYM_name_uniquify (const struct GNUNET_CONFIGURATION_Handle *cfg,
388 GNUNET_DISK_PERM_USER_WRITE); 388 GNUNET_DISK_PERM_USER_WRITE);
389 i = 0; 389 i = 0;
390 idx = -1; 390 idx = -1;
391 while ((len >= sizeof (struct GNUNET_PseudonymIdentifier)) && 391 while ((len >= sizeof (struct GNUNET_FS_PseudonymIdentifier)) &&
392 (sizeof (struct GNUNET_PseudonymIdentifier) == 392 (sizeof (struct GNUNET_FS_PseudonymIdentifier) ==
393 GNUNET_DISK_file_read (fh, &pi, sizeof (struct GNUNET_PseudonymIdentifier)))) 393 GNUNET_DISK_file_read (fh, &pi, sizeof (struct GNUNET_FS_PseudonymIdentifier))))
394 { 394 {
395 if (0 == memcmp (&pi, pseudonym, sizeof (struct GNUNET_PseudonymIdentifier))) 395 if (0 == memcmp (&pi, pseudonym, sizeof (struct GNUNET_FS_PseudonymIdentifier)))
396 { 396 {
397 idx = i; 397 idx = i;
398 break; 398 break;
@@ -403,8 +403,8 @@ GNUNET_PSEUDONYM_name_uniquify (const struct GNUNET_CONFIGURATION_Handle *cfg,
403 if (-1 == idx) 403 if (-1 == idx)
404 { 404 {
405 idx = i; 405 idx = i;
406 if (sizeof (struct GNUNET_PseudonymIdentifier) != 406 if (sizeof (struct GNUNET_FS_PseudonymIdentifier) !=
407 GNUNET_DISK_file_write (fh, pseudonym, sizeof (struct GNUNET_PseudonymIdentifier))) 407 GNUNET_DISK_file_write (fh, pseudonym, sizeof (struct GNUNET_FS_PseudonymIdentifier)))
408 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "write", fn); 408 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "write", fn);
409 } 409 }
410 GNUNET_DISK_file_close (fh); 410 GNUNET_DISK_file_close (fh);
@@ -436,8 +436,8 @@ GNUNET_PSEUDONYM_name_uniquify (const struct GNUNET_CONFIGURATION_Handle *cfg,
436 * empty metadata container, rank -1 and a "no-name" name). 436 * empty metadata container, rank -1 and a "no-name" name).
437 */ 437 */
438int 438int
439GNUNET_PSEUDONYM_get_info (const struct GNUNET_CONFIGURATION_Handle *cfg, 439GNUNET_FS_pseudonym_get_info (const struct GNUNET_CONFIGURATION_Handle *cfg,
440 const struct GNUNET_PseudonymIdentifier *pseudonym, 440 const struct GNUNET_FS_PseudonymIdentifier *pseudonym,
441 struct GNUNET_CONTAINER_MetaData **ret_meta, 441 struct GNUNET_CONTAINER_MetaData **ret_meta,
442 int32_t *ret_rank, 442 int32_t *ret_rank,
443 char **ret_name, 443 char **ret_name,
@@ -514,9 +514,9 @@ GNUNET_PSEUDONYM_get_info (const struct GNUNET_CONFIGURATION_Handle *cfg,
514 * @return GNUNET_OK on success, GNUNET_SYSERR on failure 514 * @return GNUNET_OK on success, GNUNET_SYSERR on failure
515 */ 515 */
516int 516int
517GNUNET_PSEUDONYM_name_to_id (const struct GNUNET_CONFIGURATION_Handle *cfg, 517GNUNET_FS_pseudonym_name_to_id (const struct GNUNET_CONFIGURATION_Handle *cfg,
518 const char *ns_uname, 518 const char *ns_uname,
519 struct GNUNET_PseudonymIdentifier *pseudonym) 519 struct GNUNET_FS_PseudonymIdentifier *pseudonym)
520{ 520{
521 size_t slen; 521 size_t slen;
522 uint64_t len; 522 uint64_t len;
@@ -541,7 +541,7 @@ GNUNET_PSEUDONYM_name_to_id (const struct GNUNET_CONFIGURATION_Handle *cfg,
541 541
542 if ((GNUNET_OK != GNUNET_DISK_file_test (fn) || 542 if ((GNUNET_OK != GNUNET_DISK_file_test (fn) ||
543 (GNUNET_OK != GNUNET_DISK_file_size (fn, &len, GNUNET_YES, GNUNET_YES))) || 543 (GNUNET_OK != GNUNET_DISK_file_size (fn, &len, GNUNET_YES, GNUNET_YES))) ||
544 ((idx + 1) * sizeof (struct GNUNET_PseudonymIdentifier) > len)) 544 ((idx + 1) * sizeof (struct GNUNET_FS_PseudonymIdentifier) > len))
545 { 545 {
546 GNUNET_free (fn); 546 GNUNET_free (fn);
547 return GNUNET_SYSERR; 547 return GNUNET_SYSERR;
@@ -553,14 +553,14 @@ GNUNET_PSEUDONYM_name_to_id (const struct GNUNET_CONFIGURATION_Handle *cfg,
553 GNUNET_DISK_PERM_USER_WRITE); 553 GNUNET_DISK_PERM_USER_WRITE);
554 GNUNET_free (fn); 554 GNUNET_free (fn);
555 if (GNUNET_SYSERR == 555 if (GNUNET_SYSERR ==
556 GNUNET_DISK_file_seek (fh, idx * sizeof (struct GNUNET_PseudonymIdentifier), 556 GNUNET_DISK_file_seek (fh, idx * sizeof (struct GNUNET_FS_PseudonymIdentifier),
557 GNUNET_DISK_SEEK_SET)) 557 GNUNET_DISK_SEEK_SET))
558 { 558 {
559 GNUNET_DISK_file_close (fh); 559 GNUNET_DISK_file_close (fh);
560 return GNUNET_SYSERR; 560 return GNUNET_SYSERR;
561 } 561 }
562 if (sizeof (struct GNUNET_PseudonymIdentifier) != 562 if (sizeof (struct GNUNET_FS_PseudonymIdentifier) !=
563 GNUNET_DISK_file_read (fh, pseudonym, sizeof (struct GNUNET_PseudonymIdentifier))) 563 GNUNET_DISK_file_read (fh, pseudonym, sizeof (struct GNUNET_FS_PseudonymIdentifier)))
564 { 564 {
565 GNUNET_DISK_file_close (fh); 565 GNUNET_DISK_file_close (fh);
566 return GNUNET_SYSERR; 566 return GNUNET_SYSERR;
@@ -580,7 +580,7 @@ struct ListPseudonymClosure
580 /** 580 /**
581 * iterator over pseudonym 581 * iterator over pseudonym
582 */ 582 */
583 GNUNET_PSEUDONYM_Iterator iterator; 583 GNUNET_FS_PseudonymIterator iterator;
584 584
585 /** 585 /**
586 * Closure for iterator. 586 * Closure for iterator.
@@ -605,7 +605,7 @@ static int
605list_pseudonym_helper (void *cls, const char *fullname) 605list_pseudonym_helper (void *cls, const char *fullname)
606{ 606{
607 struct ListPseudonymClosure *lpc = cls; 607 struct ListPseudonymClosure *lpc = cls;
608 struct GNUNET_PseudonymIdentifier pd; 608 struct GNUNET_FS_PseudonymIdentifier pd;
609 char *emsg; 609 char *emsg;
610 struct GNUNET_BIO_ReadHandle *fileR; 610 struct GNUNET_BIO_ReadHandle *fileR;
611 int32_t rank; 611 int32_t rank;
@@ -645,7 +645,7 @@ list_pseudonym_helper (void *cls, const char *fullname)
645 return GNUNET_SYSERR; 645 return GNUNET_SYSERR;
646 } 646 }
647 ret = GNUNET_OK; 647 ret = GNUNET_OK;
648 name_unique = GNUNET_PSEUDONYM_name_uniquify (lpc->cfg, &pd, ns_name, NULL); 648 name_unique = GNUNET_FS_pseudonym_name_uniquify (lpc->cfg, &pd, ns_name, NULL);
649 if (NULL != lpc->iterator) 649 if (NULL != lpc->iterator)
650 ret = lpc->iterator (lpc->iterator_cls, &pd, ns_name, name_unique, meta, rank); 650 ret = lpc->iterator (lpc->iterator_cls, &pd, ns_name, name_unique, meta, rank);
651 GNUNET_free (ns_name); 651 GNUNET_free (ns_name);
@@ -664,8 +664,8 @@ list_pseudonym_helper (void *cls, const char *fullname)
664 * @return number of pseudonyms found 664 * @return number of pseudonyms found
665 */ 665 */
666int 666int
667GNUNET_PSEUDONYM_list_all (const struct GNUNET_CONFIGURATION_Handle *cfg, 667GNUNET_FS_pseudonym_list_all (const struct GNUNET_CONFIGURATION_Handle *cfg,
668 GNUNET_PSEUDONYM_Iterator iterator, 668 GNUNET_FS_PseudonymIterator iterator,
669 void *iterator_cls) 669 void *iterator_cls)
670{ 670{
671 struct ListPseudonymClosure cls; 671 struct ListPseudonymClosure cls;
@@ -693,8 +693,8 @@ GNUNET_PSEUDONYM_list_all (const struct GNUNET_CONFIGURATION_Handle *cfg,
693 * @return new rating of the pseudonym 693 * @return new rating of the pseudonym
694 */ 694 */
695int 695int
696GNUNET_PSEUDONYM_rank (const struct GNUNET_CONFIGURATION_Handle *cfg, 696GNUNET_FS_pseudonym_rank (const struct GNUNET_CONFIGURATION_Handle *cfg,
697 const struct GNUNET_PseudonymIdentifier *pseudonym, 697 const struct GNUNET_FS_PseudonymIdentifier *pseudonym,
698 int32_t delta) 698 int32_t delta)
699{ 699{
700 struct GNUNET_CONTAINER_MetaData *meta; 700 struct GNUNET_CONTAINER_MetaData *meta;
@@ -710,7 +710,7 @@ GNUNET_PSEUDONYM_rank (const struct GNUNET_CONFIGURATION_Handle *cfg,
710 meta = GNUNET_CONTAINER_meta_data_create (); 710 meta = GNUNET_CONTAINER_meta_data_create ();
711 } 711 }
712 rank += delta; 712 rank += delta;
713 GNUNET_PSEUDONYM_set_info (cfg, pseudonym, name, meta, rank); 713 GNUNET_FS_pseudonym_set_info (cfg, pseudonym, name, meta, rank);
714 GNUNET_CONTAINER_meta_data_destroy (meta); 714 GNUNET_CONTAINER_meta_data_destroy (meta);
715 GNUNET_free_non_null (name); 715 GNUNET_free_non_null (name);
716 return rank; 716 return rank;
@@ -728,8 +728,8 @@ GNUNET_PSEUDONYM_rank (const struct GNUNET_CONFIGURATION_Handle *cfg,
728 * @return GNUNET_OK on success, GNUNET_SYSERR on failure 728 * @return GNUNET_OK on success, GNUNET_SYSERR on failure
729 */ 729 */
730int 730int
731GNUNET_PSEUDONYM_add (const struct GNUNET_CONFIGURATION_Handle *cfg, 731GNUNET_FS_pseudonym_add (const struct GNUNET_CONFIGURATION_Handle *cfg,
732 const struct GNUNET_PseudonymIdentifier *pseudonym, 732 const struct GNUNET_FS_PseudonymIdentifier *pseudonym,
733 const struct GNUNET_CONTAINER_MetaData *meta) 733 const struct GNUNET_CONTAINER_MetaData *meta)
734{ 734{
735 char *name; 735 char *name;
@@ -747,13 +747,13 @@ GNUNET_PSEUDONYM_add (const struct GNUNET_CONFIGURATION_Handle *cfg,
747 (GNUNET_OK == read_info (cfg, pseudonym, &old, &rank, &name))) 747 (GNUNET_OK == read_info (cfg, pseudonym, &old, &rank, &name)))
748 { 748 {
749 GNUNET_CONTAINER_meta_data_merge (old, meta); 749 GNUNET_CONTAINER_meta_data_merge (old, meta);
750 ret = GNUNET_PSEUDONYM_set_info (cfg, pseudonym, name, old, rank); 750 ret = GNUNET_FS_pseudonym_set_info (cfg, pseudonym, name, old, rank);
751 GNUNET_CONTAINER_meta_data_destroy (old); 751 GNUNET_CONTAINER_meta_data_destroy (old);
752 GNUNET_free_non_null (name); 752 GNUNET_free_non_null (name);
753 } 753 }
754 else 754 else
755 { 755 {
756 ret = GNUNET_PSEUDONYM_set_info (cfg, pseudonym, NULL, meta, rank); 756 ret = GNUNET_FS_pseudonym_set_info (cfg, pseudonym, NULL, meta, rank);
757 } 757 }
758 GNUNET_free (fn); 758 GNUNET_free (fn);
759 internal_notify (pseudonym, meta, rank); 759 internal_notify (pseudonym, meta, rank);
@@ -766,7 +766,7 @@ GNUNET_PSEUDONYM_add (const struct GNUNET_CONFIGURATION_Handle *cfg,
766/** 766/**
767 * Handle for a pseudonym (private key). 767 * Handle for a pseudonym (private key).
768 */ 768 */
769struct GNUNET_PseudonymHandle 769struct GNUNET_FS_PseudonymHandle
770{ 770{
771 /** 771 /**
772 * 256-bit 'd' secret value (mod 'n', where n is 256-bit for NIST P-256). 772 * 256-bit 'd' secret value (mod 'n', where n is 256-bit for NIST P-256).
@@ -776,7 +776,7 @@ struct GNUNET_PseudonymHandle
776 /** 776 /**
777 * Public key corresponding to the private key. 777 * Public key corresponding to the private key.
778 */ 778 */
779 struct GNUNET_PseudonymIdentifier public_key; 779 struct GNUNET_FS_PseudonymIdentifier public_key;
780}; 780};
781 781
782 782
@@ -862,10 +862,10 @@ key_from_sexp (gcry_mpi_t * array, gcry_sexp_t sexp, const char *topname,
862 * @param filename name of the file to use for storage, NULL for in-memory only 862 * @param filename name of the file to use for storage, NULL for in-memory only
863 * @return handle to the private key of the pseudonym 863 * @return handle to the private key of the pseudonym
864 */ 864 */
865struct GNUNET_PseudonymHandle * 865struct GNUNET_FS_PseudonymHandle *
866GNUNET_PSEUDONYM_create (const char *filename) 866GNUNET_FS_pseudonym_create (const char *filename)
867{ 867{
868 struct GNUNET_PseudonymHandle *ph; 868 struct GNUNET_FS_PseudonymHandle *ph;
869 ssize_t ret; 869 ssize_t ret;
870 gcry_sexp_t r_key; 870 gcry_sexp_t r_key;
871 gcry_sexp_t params; 871 gcry_sexp_t params;
@@ -877,14 +877,14 @@ GNUNET_PSEUDONYM_create (const char *filename)
877 gcry_mpi_t d; 877 gcry_mpi_t d;
878 size_t size; 878 size_t size;
879 879
880 ph = GNUNET_malloc (sizeof (struct GNUNET_PseudonymHandle)); 880 ph = GNUNET_malloc (sizeof (struct GNUNET_FS_PseudonymHandle));
881 if ( (NULL != filename) && 881 if ( (NULL != filename) &&
882 (GNUNET_YES == GNUNET_DISK_file_test (filename)) ) 882 (GNUNET_YES == GNUNET_DISK_file_test (filename)) )
883 { 883 {
884 ret = GNUNET_DISK_fn_read (filename, ph, 884 ret = GNUNET_DISK_fn_read (filename, ph,
885 sizeof (struct GNUNET_PseudonymHandle)); 885 sizeof (struct GNUNET_FS_PseudonymHandle));
886 /* Note: we don't do any validation here, maybe we should? */ 886 /* Note: we don't do any validation here, maybe we should? */
887 if (sizeof (struct GNUNET_PseudonymHandle) == ret) 887 if (sizeof (struct GNUNET_FS_PseudonymHandle) == ret)
888 return ph; 888 return ph;
889 } 889 }
890 if (0 != (rc = gcry_sexp_build (&params, NULL, 890 if (0 != (rc = gcry_sexp_build (&params, NULL,
@@ -962,9 +962,9 @@ GNUNET_PSEUDONYM_create (const char *filename)
962 /* write to disk */ 962 /* write to disk */
963 if (NULL != filename) 963 if (NULL != filename)
964 { 964 {
965 ret = GNUNET_DISK_fn_write (filename, ph, sizeof (struct GNUNET_PseudonymHandle), 965 ret = GNUNET_DISK_fn_write (filename, ph, sizeof (struct GNUNET_FS_PseudonymHandle),
966 GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE); 966 GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE);
967 if (sizeof (struct GNUNET_PseudonymHandle) != ret) 967 if (sizeof (struct GNUNET_FS_PseudonymHandle) != ret)
968 { 968 {
969 GNUNET_free (ph); 969 GNUNET_free (ph);
970 return NULL; 970 return NULL;
@@ -980,16 +980,16 @@ GNUNET_PSEUDONYM_create (const char *filename)
980 * @param filename name of the file to use for storage, NULL for in-memory only 980 * @param filename name of the file to use for storage, NULL for in-memory only
981 * @return handle to the private key of the pseudonym 981 * @return handle to the private key of the pseudonym
982 */ 982 */
983struct GNUNET_PseudonymHandle * 983struct GNUNET_FS_PseudonymHandle *
984GNUNET_PSEUDONYM_create_from_existing_file (const char *filename) 984GNUNET_FS_pseudonym_create_from_existing_file (const char *filename)
985{ 985{
986 struct GNUNET_PseudonymHandle *ph; 986 struct GNUNET_FS_PseudonymHandle *ph;
987 ssize_t ret; 987 ssize_t ret;
988 988
989 ph = GNUNET_malloc (sizeof (struct GNUNET_PseudonymHandle)); 989 ph = GNUNET_malloc (sizeof (struct GNUNET_FS_PseudonymHandle));
990 ret = GNUNET_DISK_fn_read (filename, ph, 990 ret = GNUNET_DISK_fn_read (filename, ph,
991 sizeof (struct GNUNET_PseudonymHandle)); 991 sizeof (struct GNUNET_FS_PseudonymHandle));
992 if (sizeof (struct GNUNET_PseudonymHandle) != ret) 992 if (sizeof (struct GNUNET_FS_PseudonymHandle) != ret)
993 { 993 {
994 GNUNET_free (ph); 994 GNUNET_free (ph);
995 return NULL; 995 return NULL;
@@ -1007,12 +1007,12 @@ GNUNET_PSEUDONYM_create_from_existing_file (const char *filename)
1007 * 1007 *
1008 * @return handle to the (non-secret) private key of the 'anonymous' pseudonym 1008 * @return handle to the (non-secret) private key of the 'anonymous' pseudonym
1009 */ 1009 */
1010struct GNUNET_PseudonymHandle * 1010struct GNUNET_FS_PseudonymHandle *
1011GNUNET_PSEUDONYM_get_anonymous_pseudonym_handle () 1011GNUNET_FS_pseudonym_get_anonymous_pseudonym_handle ()
1012{ 1012{
1013 struct GNUNET_PseudonymHandle *ph; 1013 struct GNUNET_FS_PseudonymHandle *ph;
1014 1014
1015 ph = GNUNET_malloc (sizeof (struct GNUNET_PseudonymHandle)); 1015 ph = GNUNET_malloc (sizeof (struct GNUNET_FS_PseudonymHandle));
1016 /* Note if we use 'd=0' for the anonymous handle (as per#2564), 1016 /* Note if we use 'd=0' for the anonymous handle (as per#2564),
1017 then I believe the public key should be also zero, as Q=0P=0; 1017 then I believe the public key should be also zero, as Q=0P=0;
1018 so setting everything to all-zeros (as per GNUNET_malloc) 1018 so setting everything to all-zeros (as per GNUNET_malloc)
@@ -1029,7 +1029,7 @@ GNUNET_PSEUDONYM_get_anonymous_pseudonym_handle ()
1029 * @param ph pseudonym handle to destroy 1029 * @param ph pseudonym handle to destroy
1030 */ 1030 */
1031void 1031void
1032GNUNET_PSEUDONYM_destroy (struct GNUNET_PseudonymHandle *ph) 1032GNUNET_FS_pseudonym_destroy (struct GNUNET_FS_PseudonymHandle *ph)
1033{ 1033{
1034 GNUNET_free (ph); 1034 GNUNET_free (ph);
1035} 1035}
@@ -1043,7 +1043,7 @@ GNUNET_PSEUDONYM_destroy (struct GNUNET_PseudonymHandle *ph)
1043 * @return converted s-expression 1043 * @return converted s-expression
1044 */ 1044 */
1045static gcry_sexp_t 1045static gcry_sexp_t
1046data_to_pkcs1 (const struct GNUNET_PseudonymSignaturePurpose *purpose) 1046data_to_pkcs1 (const struct GNUNET_FS_PseudonymSignaturePurpose *purpose)
1047{ 1047{
1048 struct GNUNET_CRYPTO_ShortHashCode hc; 1048 struct GNUNET_CRYPTO_ShortHashCode hc;
1049 size_t bufSize; 1049 size_t bufSize;
@@ -1084,11 +1084,11 @@ gcry_ctx_t xctx;
1084 * @return GNUNET_SYSERR on failure 1084 * @return GNUNET_SYSERR on failure
1085 */ 1085 */
1086int 1086int
1087GNUNET_PSEUDONYM_sign (struct GNUNET_PseudonymHandle *ph, 1087GNUNET_FS_pseudonym_sign (struct GNUNET_FS_PseudonymHandle *ph,
1088 const struct GNUNET_PseudonymSignaturePurpose *purpose, 1088 const struct GNUNET_FS_PseudonymSignaturePurpose *purpose,
1089 const struct GNUNET_HashCode *seed, 1089 const struct GNUNET_HashCode *seed,
1090 const struct GNUNET_HashCode *signing_key, 1090 const struct GNUNET_HashCode *signing_key,
1091 struct GNUNET_PseudonymSignature *signature) 1091 struct GNUNET_FS_PseudonymSignature *signature)
1092{ 1092{
1093 size_t size; 1093 size_t size;
1094 size_t erroff; 1094 size_t erroff;
@@ -1215,7 +1215,7 @@ GNUNET_PSEUDONYM_sign (struct GNUNET_PseudonymHandle *ph,
1215 gcry_sexp_release (spriv); 1215 gcry_sexp_release (spriv);
1216 if (NULL != seed) 1216 if (NULL != seed)
1217 gcry_mpi_release (k); 1217 gcry_mpi_release (k);
1218 memset (signature, 0, sizeof (struct GNUNET_PseudonymSignature)); 1218 memset (signature, 0, sizeof (struct GNUNET_FS_PseudonymSignature));
1219 return GNUNET_SYSERR; 1219 return GNUNET_SYSERR;
1220 } 1220 }
1221 if (NULL != seed) 1221 if (NULL != seed)
@@ -1263,7 +1263,7 @@ GNUNET_PSEUDONYM_sign (struct GNUNET_PseudonymHandle *ph,
1263 * @return curve context 1263 * @return curve context
1264 */ 1264 */
1265static gcry_ctx_t 1265static gcry_ctx_t
1266get_context_from_pseudonym (struct GNUNET_PseudonymIdentifier *pseudonym) 1266get_context_from_pseudonym (struct GNUNET_FS_PseudonymIdentifier *pseudonym)
1267{ 1267{
1268 gcry_ctx_t ctx; 1268 gcry_ctx_t ctx;
1269 gcry_mpi_t ONE; 1269 gcry_mpi_t ONE;
@@ -1317,13 +1317,13 @@ get_context_from_pseudonym (struct GNUNET_PseudonymIdentifier *pseudonym)
1317 * @param signing_key input to derive 'h' (see section 2.4 of #2564) 1317 * @param signing_key input to derive 'h' (see section 2.4 of #2564)
1318 * @param verification_key resulting public key to verify the signature 1318 * @param verification_key resulting public key to verify the signature
1319 * created from the '(d+h)' of 'pseudonym' and the 'signing_key'; 1319 * created from the '(d+h)' of 'pseudonym' and the 'signing_key';
1320 * the value stored here can then be given to GNUNET_PSEUDONYM_verify. 1320 * the value stored here can then be given to GNUNET_FS_pseudonym_verify.
1321 * @return GNUNET_OK on success, GNUNET_SYSERR on error 1321 * @return GNUNET_OK on success, GNUNET_SYSERR on error
1322 */ 1322 */
1323int 1323int
1324GNUNET_PSEUDONYM_derive_verification_key (struct GNUNET_PseudonymIdentifier *pseudonym, 1324GNUNET_FS_pseudonym_derive_verification_key (struct GNUNET_FS_PseudonymIdentifier *pseudonym,
1325 const struct GNUNET_HashCode *signing_key, 1325 const struct GNUNET_HashCode *signing_key,
1326 struct GNUNET_PseudonymIdentifier *verification_key) 1326 struct GNUNET_FS_PseudonymIdentifier *verification_key)
1327{ 1327{
1328 gcry_mpi_t h; 1328 gcry_mpi_t h;
1329 size_t size; 1329 size_t size;
@@ -1433,9 +1433,9 @@ GNUNET_PSEUDONYM_derive_verification_key (struct GNUNET_PseudonymIdentifier *pse
1433 * GNUNET_SYSERR if the signature is invalid 1433 * GNUNET_SYSERR if the signature is invalid
1434 */ 1434 */
1435int 1435int
1436GNUNET_PSEUDONYM_verify (const struct GNUNET_PseudonymSignaturePurpose *purpose, 1436GNUNET_FS_pseudonym_verify (const struct GNUNET_FS_PseudonymSignaturePurpose *purpose,
1437 const struct GNUNET_PseudonymSignature *signature, 1437 const struct GNUNET_FS_PseudonymSignature *signature,
1438 const struct GNUNET_PseudonymIdentifier *verification_key) 1438 const struct GNUNET_FS_PseudonymIdentifier *verification_key)
1439{ 1439{
1440 gcry_sexp_t data; 1440 gcry_sexp_t data;
1441 gcry_sexp_t sig_sexpr; 1441 gcry_sexp_t sig_sexpr;
@@ -1557,11 +1557,11 @@ exit (1);
1557 * @param pseudonym pseudonym identifier (set based on 'ph') 1557 * @param pseudonym pseudonym identifier (set based on 'ph')
1558 */ 1558 */
1559void 1559void
1560GNUNET_PSEUDONYM_get_identifier (struct GNUNET_PseudonymHandle *ph, 1560GNUNET_FS_pseudonym_get_identifier (struct GNUNET_FS_PseudonymHandle *ph,
1561 struct GNUNET_PseudonymIdentifier *pseudonym) 1561 struct GNUNET_FS_PseudonymIdentifier *pseudonym)
1562{ 1562{
1563 memcpy (pseudonym, &ph->public_key, 1563 memcpy (pseudonym, &ph->public_key,
1564 sizeof (struct GNUNET_PseudonymIdentifier)); 1564 sizeof (struct GNUNET_FS_PseudonymIdentifier));
1565} 1565}
1566 1566
1567 1567
@@ -1573,8 +1573,8 @@ GNUNET_PSEUDONYM_get_identifier (struct GNUNET_PseudonymHandle *ph,
1573 * @return GNUNET_OK on success, GNUNET_SYSERR on failure 1573 * @return GNUNET_OK on success, GNUNET_SYSERR on failure
1574 */ 1574 */
1575int 1575int
1576GNUNET_PSEUDONYM_remove (const struct GNUNET_CONFIGURATION_Handle *cfg, 1576GNUNET_FS_pseudonym_remove (const struct GNUNET_CONFIGURATION_Handle *cfg,
1577 const struct GNUNET_PseudonymIdentifier *id) 1577 const struct GNUNET_FS_PseudonymIdentifier *id)
1578{ 1578{
1579 char *fn; 1579 char *fn;
1580 int result; 1580 int result;