From ce52e258a28a17f5c319549fda1b5fbb8f6169a7 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 14 Apr 2013 20:21:41 +0000 Subject: renaming GNUNET_PSEUDONYM_-API to GNUNET_FS_pseudonym-API --- src/Makefile.am | 6 +- src/chat/chat.c | 4 +- src/chat/gnunet-chat.c | 24 +++--- src/fs/fs_api.h | 4 +- src/fs/fs_namespace.c | 26 +++--- src/fs/fs_pseudonym.c | 182 ++++++++++++++++++++-------------------- src/fs/fs_publish_ksk.c | 18 ++-- src/fs/fs_search.c | 24 +++--- src/fs/fs_unindex.c | 16 ++-- src/fs/fs_uri.c | 14 ++-- src/fs/gnunet-pseudonym.c | 20 ++--- src/fs/plugin_block_fs.c | 4 +- src/fs/test_fs_namespace.c | 4 +- src/fs/test_fs_uri.c | 8 +- src/fs/test_pseudonym.c | 156 +++++++++++++++++----------------- src/include/block_fs.h | 6 +- src/include/gnunet_fs_service.h | 146 ++++++++++++++++---------------- 17 files changed, 331 insertions(+), 331 deletions(-) (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index 11e260e5a..b620c0335 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,15 +3,15 @@ #endif if HAVE_EXPERIMENTAL - EXP_DIR = fs chat consensus dv + EXP_DIR = fs gns chat consensus dv endif if LINUX # All of these currently only work on GNU/Linux - LINUX_DIR = dns exit vpn gns pt + LINUX_DIR = dns exit vpn pt endif if MINGW - MINGW_DIR = dns gns vpn exit + MINGW_DIR = dns vpn exit endif if HAVE_MYSQL diff --git a/src/chat/chat.c b/src/chat/chat.c index cdcf282e2..19f5d0a96 100644 --- a/src/chat/chat.c +++ b/src/chat/chat.c @@ -264,7 +264,7 @@ process_result (struct GNUNET_CHAT_Room *room, GNUNET_CRYPTO_hash (&join_msg->public_key, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &pos->id); - GNUNET_PSEUDONYM_add (room->cfg, &pos->id, meta); + GNUNET_FS_pseudonym_add (room->cfg, &pos->id, meta); pos->next = room->members; room->members = pos; if (GNUNET_NO == room->is_joined) @@ -665,7 +665,7 @@ GNUNET_CHAT_join_room (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_CRYPTO_hash (&pub_key, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), me); - GNUNET_PSEUDONYM_add (cfg, me, member_info); + GNUNET_FS_pseudonym_add (cfg, me, member_info); client = GNUNET_CLIENT_connect ("chat", cfg); if (NULL == client) { diff --git a/src/chat/gnunet-chat.c b/src/chat/gnunet-chat.c index 8e6ba9bc2..f2c7f109a 100644 --- a/src/chat/gnunet-chat.c +++ b/src/chat/gnunet-chat.c @@ -125,14 +125,14 @@ receive_cb (void *cls, struct GNUNET_CHAT_Room *room, nick = GNUNET_strdup (_("anonymous")); else { - if (GNUNET_OK != GNUNET_PSEUDONYM_get_info (cfg, + if (GNUNET_OK != GNUNET_FS_pseudonym_get_info (cfg, sender, NULL, NULL, &non_unique_nick, &nick_is_a_dup) || (nick_is_a_dup == GNUNET_YES)) { GNUNET_free (non_unique_nick); non_unique_nick = GNUNET_strdup (_("anonymous")); } - nick = GNUNET_PSEUDONYM_name_uniquify (cfg, sender, non_unique_nick, NULL); + nick = GNUNET_FS_pseudonym_name_uniquify (cfg, sender, non_unique_nick, NULL); GNUNET_free (non_unique_nick); } @@ -204,14 +204,14 @@ confirmation_cb (void *cls, struct GNUNET_CHAT_Room *room, char *unique_nick; int nick_is_a_dup; - if (GNUNET_OK != GNUNET_PSEUDONYM_get_info (cfg, + if (GNUNET_OK != GNUNET_FS_pseudonym_get_info (cfg, receiver, NULL, NULL, &nick, &nick_is_a_dup) || (nick_is_a_dup == GNUNET_YES)) { GNUNET_free (nick); nick = GNUNET_strdup (_("anonymous")); } - unique_nick = GNUNET_PSEUDONYM_name_uniquify (cfg, receiver, nick, NULL); + unique_nick = GNUNET_FS_pseudonym_name_uniquify (cfg, receiver, nick, NULL); GNUNET_free (nick); FPRINTF (stdout, _("'%s' acknowledged message #%d\n"), unique_nick, orig_seq_number); GNUNET_free (unique_nick); @@ -244,14 +244,14 @@ member_list_cb (void *cls, const struct GNUNET_CONTAINER_MetaData *member_info, GNUNET_CRYPTO_hash (member_id, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &id); - if (GNUNET_OK != GNUNET_PSEUDONYM_get_info (cfg, + if (GNUNET_OK != GNUNET_FS_pseudonym_get_info (cfg, &id, NULL, NULL, &non_unique_nick, &nick_is_a_dup) || (nick_is_a_dup == GNUNET_YES)) { GNUNET_free (non_unique_nick); non_unique_nick = GNUNET_strdup (_("anonymous")); } - nick = GNUNET_PSEUDONYM_name_uniquify (cfg, &id, non_unique_nick, NULL); + nick = GNUNET_FS_pseudonym_name_uniquify (cfg, &id, non_unique_nick, NULL); GNUNET_free (non_unique_nick); FPRINTF (stdout, @@ -320,7 +320,7 @@ do_join (const char *arg, const void *xtra) FPRINTF (stdout, "%s", _("Could not change username\n")); return GNUNET_SYSERR; } - if ((GNUNET_OK != GNUNET_PSEUDONYM_get_info (cfg, + if ((GNUNET_OK != GNUNET_FS_pseudonym_get_info (cfg, &me, NULL, NULL, &my_name, &my_name_is_a_dup)) || (my_name_is_a_dup == GNUNET_YES)) { @@ -362,7 +362,7 @@ do_nick (const char *msg, const void *xtra) FPRINTF (stdout, "%s", _("Could not change username\n")); return GNUNET_SYSERR; } - if ((GNUNET_OK != GNUNET_PSEUDONYM_get_info (cfg, + if ((GNUNET_OK != GNUNET_FS_pseudonym_get_info (cfg, &me, NULL, NULL, &my_name, &my_name_is_a_dup)) || (my_name_is_a_dup == GNUNET_YES)) { @@ -391,14 +391,14 @@ do_names (const char *msg, const void *xtra) GNUNET_CRYPTO_hash (&pos->pkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &pid); - if (GNUNET_OK != GNUNET_PSEUDONYM_get_info (cfg, + if (GNUNET_OK != GNUNET_FS_pseudonym_get_info (cfg, &pid, NULL, NULL, &name, &name_is_a_dup) || (name_is_a_dup == GNUNET_YES)) { GNUNET_free (name); name = GNUNET_strdup (_("anonymous")); } - unique_name = GNUNET_PSEUDONYM_name_uniquify (cfg, &pid, name, NULL); + unique_name = GNUNET_FS_pseudonym_name_uniquify (cfg, &pid, name, NULL); GNUNET_free (name); FPRINTF (stdout, "`%s' ", unique_name); GNUNET_free (unique_name); @@ -436,7 +436,7 @@ do_send_pm (const char *msg, const void *xtra) user = GNUNET_strdup (msg); strstr (user, " ")[0] = '\0'; msg += strlen (user) + 1; - if (GNUNET_OK != GNUNET_PSEUDONYM_name_to_id (cfg, user, &uid)) + if (GNUNET_OK != GNUNET_FS_pseudonym_name_to_id (cfg, user, &uid)) { FPRINTF (stderr, _("Unknown user `%s'. Make sure you specify its numeric suffix, if any.\n"), @@ -691,7 +691,7 @@ run (void *cls, char *const *args, const char *cfgfile, ret = -1; return; } - if ((GNUNET_OK != GNUNET_PSEUDONYM_get_info (cfg, + if ((GNUNET_OK != GNUNET_FS_pseudonym_get_info (cfg, &me, NULL, NULL, &my_name, &my_name_is_a_dup)) || (my_name_is_a_dup == GNUNET_YES)) { diff --git a/src/fs/fs_api.h b/src/fs/fs_api.h index b2744237e..8d9c0b298 100644 --- a/src/fs/fs_api.h +++ b/src/fs/fs_api.h @@ -206,7 +206,7 @@ struct GNUNET_FS_Uri /** * Identifier of the namespace. */ - struct GNUNET_PseudonymIdentifier ns; + struct GNUNET_FS_PseudonymIdentifier ns; /** * Human-readable identifier chosen for this @@ -2008,7 +2008,7 @@ struct GNUNET_FS_Namespace /** * Private key for the namespace. */ - struct GNUNET_PseudonymHandle *key; + struct GNUNET_FS_PseudonymHandle *key; /** * Hash map mapping identifiers of update nodes diff --git a/src/fs/fs_namespace.c b/src/fs/fs_namespace.c index 87ddb667f..e129d70f8 100644 --- a/src/fs/fs_namespace.c +++ b/src/fs/fs_namespace.c @@ -245,7 +245,7 @@ GNUNET_FS_namespace_create (struct GNUNET_FS_Handle *h, const char *name) ret = GNUNET_malloc (sizeof (struct GNUNET_FS_Namespace)); ret->h = h; ret->rc = 1; - ret->key = GNUNET_PSEUDONYM_create (fn); + ret->key = GNUNET_FS_pseudonym_create (fn); if (NULL == ret->key) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -289,7 +289,7 @@ GNUNET_FS_namespace_open_existing (struct GNUNET_FS_Handle *h, const char *name) ret = GNUNET_malloc (sizeof (struct GNUNET_FS_Namespace)); ret->h = h; ret->rc = 1; - ret->key = GNUNET_PSEUDONYM_create_from_existing_file (fn); + ret->key = GNUNET_FS_pseudonym_create_from_existing_file (fn); if (NULL == ret->key) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -384,7 +384,7 @@ GNUNET_FS_namespace_delete (struct GNUNET_FS_Namespace *ns, int freeze) } if (0 != ns->rc) return GNUNET_OK; - GNUNET_PSEUDONYM_destroy (ns->key); + GNUNET_FS_pseudonym_destroy (ns->key); GNUNET_free (ns->filename); GNUNET_free (ns->name); for (i = 0; i < ns->update_node_count; i++) @@ -433,11 +433,11 @@ struct ProcessNamespaceContext */ int GNUNET_FS_namespace_get_public_identifier (struct GNUNET_FS_Namespace *ns, - struct GNUNET_PseudonymIdentifier *id) + struct GNUNET_FS_PseudonymIdentifier *id) { if ((NULL == ns) || (NULL == id)) return GNUNET_SYSERR; - GNUNET_PSEUDONYM_get_identifier (ns->key, id); + GNUNET_FS_pseudonym_get_identifier (ns->key, id); return GNUNET_OK; } @@ -455,12 +455,12 @@ static int process_namespace (void *cls, const char *filename) { struct ProcessNamespaceContext *pnc = cls; - struct GNUNET_PseudonymHandle *ph; - struct GNUNET_PseudonymIdentifier id; + struct GNUNET_FS_PseudonymHandle *ph; + struct GNUNET_FS_PseudonymIdentifier id; const char *name; const char *t; - if (NULL == (ph = GNUNET_PSEUDONYM_create (filename))) + if (NULL == (ph = GNUNET_FS_pseudonym_create (filename))) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _ @@ -470,8 +470,8 @@ process_namespace (void *cls, const char *filename) GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "unlink", filename); return GNUNET_OK; } - GNUNET_PSEUDONYM_get_identifier (ph, &id); - GNUNET_PSEUDONYM_destroy (ph); + GNUNET_FS_pseudonym_get_identifier (ph, &id); + GNUNET_FS_pseudonym_destroy (ph); name = filename; while (NULL != (t = strstr (name, DIR_SEPARATOR_STR))) name = t + 1; @@ -714,14 +714,14 @@ GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, &sk, &iv, &ub_enc[1]); ub_enc->purpose.size = htonl (nidlen + slen + mdsize + sizeof (struct UBlock) - - sizeof (struct GNUNET_PseudonymSignature)); + - sizeof (struct GNUNET_FS_PseudonymSignature)); ub_enc->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_FS_UBLOCK); - GNUNET_PSEUDONYM_sign (ns->key, + GNUNET_FS_pseudonym_sign (ns->key, &ub_enc->purpose, NULL, &signing_key, &ub_enc->signature); - GNUNET_PSEUDONYM_derive_verification_key (&sks_uri->data.sks.ns, + GNUNET_FS_pseudonym_derive_verification_key (&sks_uri->data.sks.ns, &signing_key, &ub_enc->verification_key); GNUNET_CRYPTO_hash (&ub_enc->verification_key, 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 @@ /** * Registered callbacks for discovery of pseudonyms. */ -struct GNUNET_PSEUDONYM_DiscoveryHandle +struct GNUNET_FS_pseudonym_DiscoveryHandle { /** * This is a doubly linked list. */ - struct GNUNET_PSEUDONYM_DiscoveryHandle *next; + struct GNUNET_FS_pseudonym_DiscoveryHandle *next; /** * This is a doubly linked list. */ - struct GNUNET_PSEUDONYM_DiscoveryHandle *prev; + struct GNUNET_FS_pseudonym_DiscoveryHandle *prev; /** * Function to call each time a pseudonym is discovered. */ - GNUNET_PSEUDONYM_Iterator callback; + GNUNET_FS_PseudonymIterator callback; /** * Closure for callback. @@ -95,13 +95,13 @@ struct GNUNET_PSEUDONYM_DiscoveryHandle * Head of the linked list of functions to call when * new pseudonyms are added. */ -static struct GNUNET_PSEUDONYM_DiscoveryHandle *disco_head; +static struct GNUNET_FS_pseudonym_DiscoveryHandle *disco_head; /** * Tail of the linked list of functions to call when * new pseudonyms are added. */ -static struct GNUNET_PSEUDONYM_DiscoveryHandle *disco_tail; +static struct GNUNET_FS_pseudonym_DiscoveryHandle *disco_tail; /** @@ -112,10 +112,10 @@ static struct GNUNET_PSEUDONYM_DiscoveryHandle *disco_tail; * @param rating rating of pseudonym */ static void -internal_notify (const struct GNUNET_PseudonymIdentifier *pseudonym, +internal_notify (const struct GNUNET_FS_PseudonymIdentifier *pseudonym, const struct GNUNET_CONTAINER_MetaData *md, int rating) { - struct GNUNET_PSEUDONYM_DiscoveryHandle *pos; + struct GNUNET_FS_pseudonym_DiscoveryHandle *pos; for (pos = disco_head; NULL != pos; pos = pos->next) pos->callback (pos->callback_cls, pseudonym, NULL, NULL, md, rating); @@ -133,19 +133,19 @@ internal_notify (const struct GNUNET_PseudonymIdentifier *pseudonym, * @param iterator_cls point to a closure * @return registration handle */ -struct GNUNET_PSEUDONYM_DiscoveryHandle * -GNUNET_PSEUDONYM_discovery_callback_register (const struct +struct GNUNET_FS_pseudonym_DiscoveryHandle * +GNUNET_FS_pseudonym_discovery_callback_register (const struct GNUNET_CONFIGURATION_Handle *cfg, - GNUNET_PSEUDONYM_Iterator iterator, + GNUNET_FS_PseudonymIterator iterator, void *iterator_cls) { - struct GNUNET_PSEUDONYM_DiscoveryHandle *dh; + struct GNUNET_FS_pseudonym_DiscoveryHandle *dh; - dh = GNUNET_malloc (sizeof (struct GNUNET_PSEUDONYM_DiscoveryHandle)); + dh = GNUNET_malloc (sizeof (struct GNUNET_FS_pseudonym_DiscoveryHandle)); dh->callback = iterator; dh->callback_cls = iterator_cls; GNUNET_CONTAINER_DLL_insert (disco_head, disco_tail, dh); - GNUNET_PSEUDONYM_list_all (cfg, iterator, iterator_cls); + GNUNET_FS_pseudonym_list_all (cfg, iterator, iterator_cls); return dh; } @@ -156,7 +156,7 @@ GNUNET_PSEUDONYM_discovery_callback_register (const struct * @param dh registration to unregister */ void -GNUNET_PSEUDONYM_discovery_callback_unregister (struct GNUNET_PSEUDONYM_DiscoveryHandle *dh) +GNUNET_FS_pseudonym_discovery_callback_unregister (struct GNUNET_FS_pseudonym_DiscoveryHandle *dh) { GNUNET_CONTAINER_DLL_remove (disco_head, disco_tail, dh); GNUNET_free (dh); @@ -175,7 +175,7 @@ GNUNET_PSEUDONYM_discovery_callback_unregister (struct GNUNET_PSEUDONYM_Discover static char * get_data_filename (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *prefix, - const struct GNUNET_PseudonymIdentifier *pseudonym) + const struct GNUNET_FS_PseudonymIdentifier *pseudonym) { struct GNUNET_CRYPTO_HashAsciiEncoded enc; struct GNUNET_HashCode psid; @@ -183,7 +183,7 @@ get_data_filename (const struct GNUNET_CONFIGURATION_Handle *cfg, if (NULL != pseudonym) { GNUNET_CRYPTO_hash (pseudonym, - sizeof (struct GNUNET_PseudonymIdentifier), + sizeof (struct GNUNET_FS_PseudonymIdentifier), &psid); GNUNET_CRYPTO_hash_to_enc (&psid, &enc); } @@ -237,8 +237,8 @@ get_data_filename_hash (const struct GNUNET_CONFIGURATION_Handle *cfg, * @return GNUNET_OK on success, GNUNET_SYSERR on failure */ int -GNUNET_PSEUDONYM_set_info (const struct GNUNET_CONFIGURATION_Handle *cfg, - const struct GNUNET_PseudonymIdentifier *pseudonym, +GNUNET_FS_pseudonym_set_info (const struct GNUNET_CONFIGURATION_Handle *cfg, + const struct GNUNET_FS_PseudonymIdentifier *pseudonym, const char *name, const struct GNUNET_CONTAINER_MetaData *md, int32_t rank) @@ -253,7 +253,7 @@ GNUNET_PSEUDONYM_set_info (const struct GNUNET_CONFIGURATION_Handle *cfg, return GNUNET_SYSERR; } if ((GNUNET_OK != GNUNET_BIO_write (fileW, pseudonym, - sizeof (struct GNUNET_PseudonymIdentifier))) || + sizeof (struct GNUNET_FS_PseudonymIdentifier))) || (GNUNET_OK != GNUNET_BIO_write_int32 (fileW, rank)) || (GNUNET_OK != GNUNET_BIO_write_string (fileW, name)) || (GNUNET_OK != GNUNET_BIO_write_meta_data (fileW, md))) @@ -272,7 +272,7 @@ GNUNET_PSEUDONYM_set_info (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_free (fn); /* create entry for pseudonym name in names */ if (NULL != name) - GNUNET_free_non_null (GNUNET_PSEUDONYM_name_uniquify (cfg, pseudonym, + GNUNET_free_non_null (GNUNET_FS_pseudonym_name_uniquify (cfg, pseudonym, name, NULL)); return GNUNET_OK; } @@ -290,12 +290,12 @@ GNUNET_PSEUDONYM_set_info (const struct GNUNET_CONFIGURATION_Handle *cfg, */ static int read_info (const struct GNUNET_CONFIGURATION_Handle *cfg, - const struct GNUNET_PseudonymIdentifier *pseudonym, + const struct GNUNET_FS_PseudonymIdentifier *pseudonym, struct GNUNET_CONTAINER_MetaData **meta, int32_t *rank, char **ns_name) { - struct GNUNET_PseudonymIdentifier pd; + struct GNUNET_FS_PseudonymIdentifier pd; char *fn; char *emsg; struct GNUNET_BIO_ReadHandle *fileR; @@ -351,7 +351,7 @@ read_info (const struct GNUNET_CONFIGURATION_Handle *cfg, /** * Return unique variant of the namespace name. Use it after - * GNUNET_PSEUDONYM_get_info() to make sure that name is unique. + * GNUNET_FS_pseudonym_get_info() to make sure that name is unique. * * @param cfg configuration * @param pseudonym public key of the pseudonym @@ -361,13 +361,13 @@ read_info (const struct GNUNET_CONFIGURATION_Handle *cfg, * Free the name with GNUNET_free(). */ char * -GNUNET_PSEUDONYM_name_uniquify (const struct GNUNET_CONFIGURATION_Handle *cfg, - const struct GNUNET_PseudonymIdentifier *pseudonym, +GNUNET_FS_pseudonym_name_uniquify (const struct GNUNET_CONFIGURATION_Handle *cfg, + const struct GNUNET_FS_PseudonymIdentifier *pseudonym, const char *name, unsigned int *suffix) { struct GNUNET_HashCode nh; - struct GNUNET_PseudonymIdentifier pi; + struct GNUNET_FS_PseudonymIdentifier pi; uint64_t len; char *fn; struct GNUNET_DISK_FileHandle *fh; @@ -388,11 +388,11 @@ GNUNET_PSEUDONYM_name_uniquify (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_DISK_PERM_USER_WRITE); i = 0; idx = -1; - while ((len >= sizeof (struct GNUNET_PseudonymIdentifier)) && - (sizeof (struct GNUNET_PseudonymIdentifier) == - GNUNET_DISK_file_read (fh, &pi, sizeof (struct GNUNET_PseudonymIdentifier)))) + while ((len >= sizeof (struct GNUNET_FS_PseudonymIdentifier)) && + (sizeof (struct GNUNET_FS_PseudonymIdentifier) == + GNUNET_DISK_file_read (fh, &pi, sizeof (struct GNUNET_FS_PseudonymIdentifier)))) { - if (0 == memcmp (&pi, pseudonym, sizeof (struct GNUNET_PseudonymIdentifier))) + if (0 == memcmp (&pi, pseudonym, sizeof (struct GNUNET_FS_PseudonymIdentifier))) { idx = i; break; @@ -403,8 +403,8 @@ GNUNET_PSEUDONYM_name_uniquify (const struct GNUNET_CONFIGURATION_Handle *cfg, if (-1 == idx) { idx = i; - if (sizeof (struct GNUNET_PseudonymIdentifier) != - GNUNET_DISK_file_write (fh, pseudonym, sizeof (struct GNUNET_PseudonymIdentifier))) + if (sizeof (struct GNUNET_FS_PseudonymIdentifier) != + GNUNET_DISK_file_write (fh, pseudonym, sizeof (struct GNUNET_FS_PseudonymIdentifier))) LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "write", fn); } GNUNET_DISK_file_close (fh); @@ -436,8 +436,8 @@ GNUNET_PSEUDONYM_name_uniquify (const struct GNUNET_CONFIGURATION_Handle *cfg, * empty metadata container, rank -1 and a "no-name" name). */ int -GNUNET_PSEUDONYM_get_info (const struct GNUNET_CONFIGURATION_Handle *cfg, - const struct GNUNET_PseudonymIdentifier *pseudonym, +GNUNET_FS_pseudonym_get_info (const struct GNUNET_CONFIGURATION_Handle *cfg, + const struct GNUNET_FS_PseudonymIdentifier *pseudonym, struct GNUNET_CONTAINER_MetaData **ret_meta, int32_t *ret_rank, char **ret_name, @@ -514,9 +514,9 @@ GNUNET_PSEUDONYM_get_info (const struct GNUNET_CONFIGURATION_Handle *cfg, * @return GNUNET_OK on success, GNUNET_SYSERR on failure */ int -GNUNET_PSEUDONYM_name_to_id (const struct GNUNET_CONFIGURATION_Handle *cfg, +GNUNET_FS_pseudonym_name_to_id (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *ns_uname, - struct GNUNET_PseudonymIdentifier *pseudonym) + struct GNUNET_FS_PseudonymIdentifier *pseudonym) { size_t slen; uint64_t len; @@ -541,7 +541,7 @@ GNUNET_PSEUDONYM_name_to_id (const struct GNUNET_CONFIGURATION_Handle *cfg, if ((GNUNET_OK != GNUNET_DISK_file_test (fn) || (GNUNET_OK != GNUNET_DISK_file_size (fn, &len, GNUNET_YES, GNUNET_YES))) || - ((idx + 1) * sizeof (struct GNUNET_PseudonymIdentifier) > len)) + ((idx + 1) * sizeof (struct GNUNET_FS_PseudonymIdentifier) > len)) { GNUNET_free (fn); return GNUNET_SYSERR; @@ -553,14 +553,14 @@ GNUNET_PSEUDONYM_name_to_id (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_DISK_PERM_USER_WRITE); GNUNET_free (fn); if (GNUNET_SYSERR == - GNUNET_DISK_file_seek (fh, idx * sizeof (struct GNUNET_PseudonymIdentifier), + GNUNET_DISK_file_seek (fh, idx * sizeof (struct GNUNET_FS_PseudonymIdentifier), GNUNET_DISK_SEEK_SET)) { GNUNET_DISK_file_close (fh); return GNUNET_SYSERR; } - if (sizeof (struct GNUNET_PseudonymIdentifier) != - GNUNET_DISK_file_read (fh, pseudonym, sizeof (struct GNUNET_PseudonymIdentifier))) + if (sizeof (struct GNUNET_FS_PseudonymIdentifier) != + GNUNET_DISK_file_read (fh, pseudonym, sizeof (struct GNUNET_FS_PseudonymIdentifier))) { GNUNET_DISK_file_close (fh); return GNUNET_SYSERR; @@ -580,7 +580,7 @@ struct ListPseudonymClosure /** * iterator over pseudonym */ - GNUNET_PSEUDONYM_Iterator iterator; + GNUNET_FS_PseudonymIterator iterator; /** * Closure for iterator. @@ -605,7 +605,7 @@ static int list_pseudonym_helper (void *cls, const char *fullname) { struct ListPseudonymClosure *lpc = cls; - struct GNUNET_PseudonymIdentifier pd; + struct GNUNET_FS_PseudonymIdentifier pd; char *emsg; struct GNUNET_BIO_ReadHandle *fileR; int32_t rank; @@ -645,7 +645,7 @@ list_pseudonym_helper (void *cls, const char *fullname) return GNUNET_SYSERR; } ret = GNUNET_OK; - name_unique = GNUNET_PSEUDONYM_name_uniquify (lpc->cfg, &pd, ns_name, NULL); + name_unique = GNUNET_FS_pseudonym_name_uniquify (lpc->cfg, &pd, ns_name, NULL); if (NULL != lpc->iterator) ret = lpc->iterator (lpc->iterator_cls, &pd, ns_name, name_unique, meta, rank); GNUNET_free (ns_name); @@ -664,8 +664,8 @@ list_pseudonym_helper (void *cls, const char *fullname) * @return number of pseudonyms found */ int -GNUNET_PSEUDONYM_list_all (const struct GNUNET_CONFIGURATION_Handle *cfg, - GNUNET_PSEUDONYM_Iterator iterator, +GNUNET_FS_pseudonym_list_all (const struct GNUNET_CONFIGURATION_Handle *cfg, + GNUNET_FS_PseudonymIterator iterator, void *iterator_cls) { struct ListPseudonymClosure cls; @@ -693,8 +693,8 @@ GNUNET_PSEUDONYM_list_all (const struct GNUNET_CONFIGURATION_Handle *cfg, * @return new rating of the pseudonym */ int -GNUNET_PSEUDONYM_rank (const struct GNUNET_CONFIGURATION_Handle *cfg, - const struct GNUNET_PseudonymIdentifier *pseudonym, +GNUNET_FS_pseudonym_rank (const struct GNUNET_CONFIGURATION_Handle *cfg, + const struct GNUNET_FS_PseudonymIdentifier *pseudonym, int32_t delta) { struct GNUNET_CONTAINER_MetaData *meta; @@ -710,7 +710,7 @@ GNUNET_PSEUDONYM_rank (const struct GNUNET_CONFIGURATION_Handle *cfg, meta = GNUNET_CONTAINER_meta_data_create (); } rank += delta; - GNUNET_PSEUDONYM_set_info (cfg, pseudonym, name, meta, rank); + GNUNET_FS_pseudonym_set_info (cfg, pseudonym, name, meta, rank); GNUNET_CONTAINER_meta_data_destroy (meta); GNUNET_free_non_null (name); return rank; @@ -728,8 +728,8 @@ GNUNET_PSEUDONYM_rank (const struct GNUNET_CONFIGURATION_Handle *cfg, * @return GNUNET_OK on success, GNUNET_SYSERR on failure */ int -GNUNET_PSEUDONYM_add (const struct GNUNET_CONFIGURATION_Handle *cfg, - const struct GNUNET_PseudonymIdentifier *pseudonym, +GNUNET_FS_pseudonym_add (const struct GNUNET_CONFIGURATION_Handle *cfg, + const struct GNUNET_FS_PseudonymIdentifier *pseudonym, const struct GNUNET_CONTAINER_MetaData *meta) { char *name; @@ -747,13 +747,13 @@ GNUNET_PSEUDONYM_add (const struct GNUNET_CONFIGURATION_Handle *cfg, (GNUNET_OK == read_info (cfg, pseudonym, &old, &rank, &name))) { GNUNET_CONTAINER_meta_data_merge (old, meta); - ret = GNUNET_PSEUDONYM_set_info (cfg, pseudonym, name, old, rank); + ret = GNUNET_FS_pseudonym_set_info (cfg, pseudonym, name, old, rank); GNUNET_CONTAINER_meta_data_destroy (old); GNUNET_free_non_null (name); } else { - ret = GNUNET_PSEUDONYM_set_info (cfg, pseudonym, NULL, meta, rank); + ret = GNUNET_FS_pseudonym_set_info (cfg, pseudonym, NULL, meta, rank); } GNUNET_free (fn); internal_notify (pseudonym, meta, rank); @@ -766,7 +766,7 @@ GNUNET_PSEUDONYM_add (const struct GNUNET_CONFIGURATION_Handle *cfg, /** * Handle for a pseudonym (private key). */ -struct GNUNET_PseudonymHandle +struct GNUNET_FS_PseudonymHandle { /** * 256-bit 'd' secret value (mod 'n', where n is 256-bit for NIST P-256). @@ -776,7 +776,7 @@ struct GNUNET_PseudonymHandle /** * Public key corresponding to the private key. */ - struct GNUNET_PseudonymIdentifier public_key; + struct GNUNET_FS_PseudonymIdentifier public_key; }; @@ -862,10 +862,10 @@ key_from_sexp (gcry_mpi_t * array, gcry_sexp_t sexp, const char *topname, * @param filename name of the file to use for storage, NULL for in-memory only * @return handle to the private key of the pseudonym */ -struct GNUNET_PseudonymHandle * -GNUNET_PSEUDONYM_create (const char *filename) +struct GNUNET_FS_PseudonymHandle * +GNUNET_FS_pseudonym_create (const char *filename) { - struct GNUNET_PseudonymHandle *ph; + struct GNUNET_FS_PseudonymHandle *ph; ssize_t ret; gcry_sexp_t r_key; gcry_sexp_t params; @@ -877,14 +877,14 @@ GNUNET_PSEUDONYM_create (const char *filename) gcry_mpi_t d; size_t size; - ph = GNUNET_malloc (sizeof (struct GNUNET_PseudonymHandle)); + ph = GNUNET_malloc (sizeof (struct GNUNET_FS_PseudonymHandle)); if ( (NULL != filename) && (GNUNET_YES == GNUNET_DISK_file_test (filename)) ) { ret = GNUNET_DISK_fn_read (filename, ph, - sizeof (struct GNUNET_PseudonymHandle)); + sizeof (struct GNUNET_FS_PseudonymHandle)); /* Note: we don't do any validation here, maybe we should? */ - if (sizeof (struct GNUNET_PseudonymHandle) == ret) + if (sizeof (struct GNUNET_FS_PseudonymHandle) == ret) return ph; } if (0 != (rc = gcry_sexp_build (¶ms, NULL, @@ -962,9 +962,9 @@ GNUNET_PSEUDONYM_create (const char *filename) /* write to disk */ if (NULL != filename) { - ret = GNUNET_DISK_fn_write (filename, ph, sizeof (struct GNUNET_PseudonymHandle), + ret = GNUNET_DISK_fn_write (filename, ph, sizeof (struct GNUNET_FS_PseudonymHandle), GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE); - if (sizeof (struct GNUNET_PseudonymHandle) != ret) + if (sizeof (struct GNUNET_FS_PseudonymHandle) != ret) { GNUNET_free (ph); return NULL; @@ -980,16 +980,16 @@ GNUNET_PSEUDONYM_create (const char *filename) * @param filename name of the file to use for storage, NULL for in-memory only * @return handle to the private key of the pseudonym */ -struct GNUNET_PseudonymHandle * -GNUNET_PSEUDONYM_create_from_existing_file (const char *filename) +struct GNUNET_FS_PseudonymHandle * +GNUNET_FS_pseudonym_create_from_existing_file (const char *filename) { - struct GNUNET_PseudonymHandle *ph; + struct GNUNET_FS_PseudonymHandle *ph; ssize_t ret; - ph = GNUNET_malloc (sizeof (struct GNUNET_PseudonymHandle)); + ph = GNUNET_malloc (sizeof (struct GNUNET_FS_PseudonymHandle)); ret = GNUNET_DISK_fn_read (filename, ph, - sizeof (struct GNUNET_PseudonymHandle)); - if (sizeof (struct GNUNET_PseudonymHandle) != ret) + sizeof (struct GNUNET_FS_PseudonymHandle)); + if (sizeof (struct GNUNET_FS_PseudonymHandle) != ret) { GNUNET_free (ph); return NULL; @@ -1007,12 +1007,12 @@ GNUNET_PSEUDONYM_create_from_existing_file (const char *filename) * * @return handle to the (non-secret) private key of the 'anonymous' pseudonym */ -struct GNUNET_PseudonymHandle * -GNUNET_PSEUDONYM_get_anonymous_pseudonym_handle () +struct GNUNET_FS_PseudonymHandle * +GNUNET_FS_pseudonym_get_anonymous_pseudonym_handle () { - struct GNUNET_PseudonymHandle *ph; + struct GNUNET_FS_PseudonymHandle *ph; - ph = GNUNET_malloc (sizeof (struct GNUNET_PseudonymHandle)); + ph = GNUNET_malloc (sizeof (struct GNUNET_FS_PseudonymHandle)); /* Note if we use 'd=0' for the anonymous handle (as per#2564), then I believe the public key should be also zero, as Q=0P=0; so setting everything to all-zeros (as per GNUNET_malloc) @@ -1029,7 +1029,7 @@ GNUNET_PSEUDONYM_get_anonymous_pseudonym_handle () * @param ph pseudonym handle to destroy */ void -GNUNET_PSEUDONYM_destroy (struct GNUNET_PseudonymHandle *ph) +GNUNET_FS_pseudonym_destroy (struct GNUNET_FS_PseudonymHandle *ph) { GNUNET_free (ph); } @@ -1043,7 +1043,7 @@ GNUNET_PSEUDONYM_destroy (struct GNUNET_PseudonymHandle *ph) * @return converted s-expression */ static gcry_sexp_t -data_to_pkcs1 (const struct GNUNET_PseudonymSignaturePurpose *purpose) +data_to_pkcs1 (const struct GNUNET_FS_PseudonymSignaturePurpose *purpose) { struct GNUNET_CRYPTO_ShortHashCode hc; size_t bufSize; @@ -1084,11 +1084,11 @@ gcry_ctx_t xctx; * @return GNUNET_SYSERR on failure */ int -GNUNET_PSEUDONYM_sign (struct GNUNET_PseudonymHandle *ph, - const struct GNUNET_PseudonymSignaturePurpose *purpose, +GNUNET_FS_pseudonym_sign (struct GNUNET_FS_PseudonymHandle *ph, + const struct GNUNET_FS_PseudonymSignaturePurpose *purpose, const struct GNUNET_HashCode *seed, const struct GNUNET_HashCode *signing_key, - struct GNUNET_PseudonymSignature *signature) + struct GNUNET_FS_PseudonymSignature *signature) { size_t size; size_t erroff; @@ -1215,7 +1215,7 @@ GNUNET_PSEUDONYM_sign (struct GNUNET_PseudonymHandle *ph, gcry_sexp_release (spriv); if (NULL != seed) gcry_mpi_release (k); - memset (signature, 0, sizeof (struct GNUNET_PseudonymSignature)); + memset (signature, 0, sizeof (struct GNUNET_FS_PseudonymSignature)); return GNUNET_SYSERR; } if (NULL != seed) @@ -1263,7 +1263,7 @@ GNUNET_PSEUDONYM_sign (struct GNUNET_PseudonymHandle *ph, * @return curve context */ static gcry_ctx_t -get_context_from_pseudonym (struct GNUNET_PseudonymIdentifier *pseudonym) +get_context_from_pseudonym (struct GNUNET_FS_PseudonymIdentifier *pseudonym) { gcry_ctx_t ctx; gcry_mpi_t ONE; @@ -1317,13 +1317,13 @@ get_context_from_pseudonym (struct GNUNET_PseudonymIdentifier *pseudonym) * @param signing_key input to derive 'h' (see section 2.4 of #2564) * @param verification_key resulting public key to verify the signature * created from the '(d+h)' of 'pseudonym' and the 'signing_key'; - * the value stored here can then be given to GNUNET_PSEUDONYM_verify. + * the value stored here can then be given to GNUNET_FS_pseudonym_verify. * @return GNUNET_OK on success, GNUNET_SYSERR on error */ int -GNUNET_PSEUDONYM_derive_verification_key (struct GNUNET_PseudonymIdentifier *pseudonym, +GNUNET_FS_pseudonym_derive_verification_key (struct GNUNET_FS_PseudonymIdentifier *pseudonym, const struct GNUNET_HashCode *signing_key, - struct GNUNET_PseudonymIdentifier *verification_key) + struct GNUNET_FS_PseudonymIdentifier *verification_key) { gcry_mpi_t h; size_t size; @@ -1433,9 +1433,9 @@ GNUNET_PSEUDONYM_derive_verification_key (struct GNUNET_PseudonymIdentifier *pse * GNUNET_SYSERR if the signature is invalid */ int -GNUNET_PSEUDONYM_verify (const struct GNUNET_PseudonymSignaturePurpose *purpose, - const struct GNUNET_PseudonymSignature *signature, - const struct GNUNET_PseudonymIdentifier *verification_key) +GNUNET_FS_pseudonym_verify (const struct GNUNET_FS_PseudonymSignaturePurpose *purpose, + const struct GNUNET_FS_PseudonymSignature *signature, + const struct GNUNET_FS_PseudonymIdentifier *verification_key) { gcry_sexp_t data; gcry_sexp_t sig_sexpr; @@ -1557,11 +1557,11 @@ exit (1); * @param pseudonym pseudonym identifier (set based on 'ph') */ void -GNUNET_PSEUDONYM_get_identifier (struct GNUNET_PseudonymHandle *ph, - struct GNUNET_PseudonymIdentifier *pseudonym) +GNUNET_FS_pseudonym_get_identifier (struct GNUNET_FS_PseudonymHandle *ph, + struct GNUNET_FS_PseudonymIdentifier *pseudonym) { memcpy (pseudonym, &ph->public_key, - sizeof (struct GNUNET_PseudonymIdentifier)); + sizeof (struct GNUNET_FS_PseudonymIdentifier)); } @@ -1573,8 +1573,8 @@ GNUNET_PSEUDONYM_get_identifier (struct GNUNET_PseudonymHandle *ph, * @return GNUNET_OK on success, GNUNET_SYSERR on failure */ int -GNUNET_PSEUDONYM_remove (const struct GNUNET_CONFIGURATION_Handle *cfg, - const struct GNUNET_PseudonymIdentifier *id) +GNUNET_FS_pseudonym_remove (const struct GNUNET_CONFIGURATION_Handle *cfg, + const struct GNUNET_FS_PseudonymIdentifier *id) { char *fn; int result; diff --git a/src/fs/fs_publish_ksk.c b/src/fs/fs_publish_ksk.c index bbbbdc1d6..93eee7d72 100644 --- a/src/fs/fs_publish_ksk.c +++ b/src/fs/fs_publish_ksk.c @@ -172,8 +172,8 @@ publish_ksk_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct GNUNET_HashCode query; struct GNUNET_CRYPTO_AesSessionKey skey; struct GNUNET_CRYPTO_AesInitializationVector iv; - struct GNUNET_PseudonymHandle *ph; - struct GNUNET_PseudonymIdentifier pseudonym; + struct GNUNET_FS_PseudonymHandle *ph; + struct GNUNET_FS_PseudonymIdentifier pseudonym; pkc->ksk_task = GNUNET_SCHEDULER_NO_TASK; if ((pkc->i == pkc->ksk_uri->data.ksk.keywordCount) || (NULL == pkc->dsh)) @@ -198,24 +198,24 @@ publish_ksk_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 1 + pkc->slen + pkc->mdsize, &skey, &iv, &pkc->cpy[1]); - ph = GNUNET_PSEUDONYM_get_anonymous_pseudonym_handle (); + ph = GNUNET_FS_pseudonym_get_anonymous_pseudonym_handle (); GNUNET_CRYPTO_hash (&key, sizeof (key), &signing_key); pkc->cpy->purpose.size = htonl (1 + pkc->slen + pkc->mdsize + sizeof (struct UBlock) - - sizeof (struct GNUNET_PseudonymSignature)); + - sizeof (struct GNUNET_FS_PseudonymSignature)); pkc->cpy->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_FS_UBLOCK); - GNUNET_PSEUDONYM_sign (ph, + GNUNET_FS_pseudonym_sign (ph, &pkc->cpy->purpose, &seed, &signing_key, &pkc->cpy->signature); - GNUNET_PSEUDONYM_get_identifier (ph, &pseudonym); - GNUNET_PSEUDONYM_derive_verification_key (&pseudonym, + GNUNET_FS_pseudonym_get_identifier (ph, &pseudonym); + GNUNET_FS_pseudonym_derive_verification_key (&pseudonym, &signing_key, &pkc->cpy->verification_key); GNUNET_CRYPTO_hash (&pkc->cpy->verification_key, sizeof (pkc->cpy->verification_key), &query); - GNUNET_PSEUDONYM_destroy (ph); + GNUNET_FS_pseudonym_destroy (ph); pkc->qre = GNUNET_DATASTORE_put (pkc->dsh, 0, &query, 1 + pkc->slen + pkc->mdsize + sizeof (struct UBlock), @@ -311,7 +311,7 @@ GNUNET_FS_publish_ksk (struct GNUNET_FS_Handle *h, pkc->cpy = GNUNET_malloc (size); pkc->cpy->purpose.size = - htonl (sizeof (struct GNUNET_PseudonymSignaturePurpose) + + htonl (sizeof (struct GNUNET_FS_PseudonymSignaturePurpose) + pkc->mdsize + pkc->slen + 1); pkc->cpy->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_FS_UBLOCK); pkc->ksk_uri = GNUNET_FS_uri_dup (ksk_uri); diff --git a/src/fs/fs_search.c b/src/fs/fs_search.c index eaf26f73f..25b34d99c 100644 --- a/src/fs/fs_search.c +++ b/src/fs/fs_search.c @@ -589,7 +589,7 @@ process_sks_result (struct GNUNET_FS_SearchContext *sc, const char *id_update, */ static int decrypt_block_with_keyword (const struct GNUNET_FS_SearchContext *sc, - const struct GNUNET_PseudonymIdentifier *verification_key, + const struct GNUNET_FS_PseudonymIdentifier *verification_key, const void *edata, size_t edata_size, char *data) @@ -600,7 +600,7 @@ decrypt_block_with_keyword (const struct GNUNET_FS_SearchContext *sc, int i; GNUNET_CRYPTO_hash (verification_key, - sizeof (struct GNUNET_PseudonymIdentifier), + sizeof (struct GNUNET_FS_PseudonymIdentifier), &q); /* find key */ for (i = 0; i < sc->uri->data.ksk.keywordCount; i++) @@ -965,7 +965,7 @@ transmit_search_request (void *cls, size_t size, void *buf) struct GNUNET_HashCode signing_key; struct GNUNET_HashCode ns_hash; struct GNUNET_HashCode id_hash; - struct GNUNET_PseudonymIdentifier verification_key; + struct GNUNET_FS_PseudonymIdentifier verification_key; unsigned int sqms; uint32_t options; @@ -1039,7 +1039,7 @@ transmit_search_request (void *cls, size_t size, void *buf) sizeof (sc->uri->data.sks.ns), &ns_hash); GNUNET_CRYPTO_hash_xor (&id_hash, &ns_hash, &key); GNUNET_CRYPTO_hash (&key, sizeof (struct GNUNET_HashCode), &signing_key); - GNUNET_PSEUDONYM_derive_verification_key (&sc->uri->data.sks.ns, + GNUNET_FS_pseudonym_derive_verification_key (&sc->uri->data.sks.ns, &signing_key, &verification_key); GNUNET_CRYPTO_hash (&verification_key, @@ -1208,17 +1208,17 @@ GNUNET_FS_search_start_searching_ (struct GNUNET_FS_SearchContext *sc) unsigned int i; const char *keyword; struct GNUNET_HashCode signing_key; - struct GNUNET_PseudonymHandle *ph; - struct GNUNET_PseudonymIdentifier anon; - struct GNUNET_PseudonymIdentifier verification_key; + struct GNUNET_FS_PseudonymHandle *ph; + struct GNUNET_FS_PseudonymIdentifier anon; + struct GNUNET_FS_PseudonymIdentifier verification_key; GNUNET_assert (NULL == sc->client); if (GNUNET_FS_uri_test_ksk (sc->uri)) { GNUNET_assert (0 != sc->uri->data.ksk.keywordCount); - ph = GNUNET_PSEUDONYM_get_anonymous_pseudonym_handle (); - GNUNET_PSEUDONYM_get_identifier (ph, &anon); - GNUNET_PSEUDONYM_destroy (ph); + ph = GNUNET_FS_pseudonym_get_anonymous_pseudonym_handle (); + GNUNET_FS_pseudonym_get_identifier (ph, &anon); + GNUNET_FS_pseudonym_destroy (ph); sc->requests = GNUNET_malloc (sizeof (struct SearchRequestEntry) * sc->uri->data.ksk.keywordCount); @@ -1227,10 +1227,10 @@ GNUNET_FS_search_start_searching_ (struct GNUNET_FS_SearchContext *sc) keyword = &sc->uri->data.ksk.keywords[i][1]; GNUNET_CRYPTO_hash (keyword, strlen (keyword), &sc->requests[i].ukey); GNUNET_CRYPTO_hash (&sc->requests[i].ukey, sizeof (struct GNUNET_HashCode), &signing_key); - GNUNET_PSEUDONYM_derive_verification_key (&anon, + GNUNET_FS_pseudonym_derive_verification_key (&anon, &signing_key, &verification_key); - GNUNET_CRYPTO_hash (&verification_key, sizeof (struct GNUNET_PseudonymIdentifier), + GNUNET_CRYPTO_hash (&verification_key, sizeof (struct GNUNET_FS_PseudonymIdentifier), &sc->requests[i].uquery); sc->requests[i].mandatory = (sc->uri->data.ksk.keywords[i][0] == '+'); if (sc->requests[i].mandatory) diff --git a/src/fs/fs_unindex.c b/src/fs/fs_unindex.c index 17c3731fe..365698c4f 100644 --- a/src/fs/fs_unindex.c +++ b/src/fs/fs_unindex.c @@ -553,9 +553,9 @@ void GNUNET_FS_unindex_do_remove_kblocks_ (struct GNUNET_FS_UnindexContext *uc) { const char *keyword; - struct GNUNET_PseudonymHandle *ph; - struct GNUNET_PseudonymIdentifier anon; - struct GNUNET_PseudonymIdentifier verification_key; + struct GNUNET_FS_PseudonymHandle *ph; + struct GNUNET_FS_PseudonymIdentifier anon; + struct GNUNET_FS_PseudonymIdentifier verification_key; struct GNUNET_HashCode signing_key; if (NULL == uc->dsh) @@ -575,17 +575,17 @@ GNUNET_FS_unindex_do_remove_kblocks_ (struct GNUNET_FS_UnindexContext *uc) return; } /* FIXME: code duplication with fs_search.c here... */ - ph = GNUNET_PSEUDONYM_get_anonymous_pseudonym_handle (); - GNUNET_PSEUDONYM_get_identifier (ph, &anon); - GNUNET_PSEUDONYM_destroy (ph); + ph = GNUNET_FS_pseudonym_get_anonymous_pseudonym_handle (); + GNUNET_FS_pseudonym_get_identifier (ph, &anon); + GNUNET_FS_pseudonym_destroy (ph); keyword = &uc->ksk_uri->data.ksk.keywords[uc->ksk_offset][1]; GNUNET_CRYPTO_hash (keyword, strlen (keyword), &uc->ukey); GNUNET_CRYPTO_hash (&uc->ukey, sizeof (struct GNUNET_HashCode), &signing_key); - GNUNET_PSEUDONYM_derive_verification_key (&anon, + GNUNET_FS_pseudonym_derive_verification_key (&anon, &signing_key, &verification_key); GNUNET_CRYPTO_hash (&verification_key, - sizeof (struct GNUNET_PseudonymIdentifier), + sizeof (struct GNUNET_FS_PseudonymIdentifier), &uc->uquery); uc->first_uid = 0; uc->dqe = GNUNET_DATASTORE_get_key (uc->dsh, diff --git a/src/fs/fs_uri.c b/src/fs/fs_uri.c index a3a54227f..48c347a52 100644 --- a/src/fs/fs_uri.c +++ b/src/fs/fs_uri.c @@ -356,7 +356,7 @@ static struct GNUNET_FS_Uri * uri_sks_parse (const char *s, char **emsg) { struct GNUNET_FS_Uri *ret; - struct GNUNET_PseudonymIdentifier id; + struct GNUNET_FS_PseudonymIdentifier id; size_t pos; char *end; @@ -969,7 +969,7 @@ GNUNET_FS_uri_sks_create (struct GNUNET_FS_Namespace *ns, const char *id, * @return an FS URI for the given namespace and identifier */ struct GNUNET_FS_Uri * -GNUNET_FS_uri_sks_create_from_nsid (struct GNUNET_PseudonymIdentifier *pseudonym, +GNUNET_FS_uri_sks_create_from_nsid (struct GNUNET_FS_PseudonymIdentifier *pseudonym, const char *id) { struct GNUNET_FS_Uri *ns_uri; @@ -1280,7 +1280,7 @@ GNUNET_FS_uri_test_equal (const struct GNUNET_FS_Uri *u1, case GNUNET_FS_URI_SKS: if ((0 == memcmp (&u1->data.sks.ns, &u2->data.sks.ns, - sizeof (struct GNUNET_PseudonymIdentifier))) && + sizeof (struct GNUNET_FS_PseudonymIdentifier))) && (0 == strcmp (u1->data.sks.identifier, u2->data.sks.identifier))) return GNUNET_YES; @@ -1341,7 +1341,7 @@ GNUNET_FS_uri_test_sks (const struct GNUNET_FS_Uri *uri) */ int GNUNET_FS_uri_sks_get_namespace (const struct GNUNET_FS_Uri *uri, - struct GNUNET_PseudonymIdentifier *pseudonym) + struct GNUNET_FS_PseudonymIdentifier *pseudonym) { if (!GNUNET_FS_uri_test_sks (uri)) { @@ -1389,9 +1389,9 @@ GNUNET_FS_uri_sks_to_string_fancy (struct GNUNET_CONFIGURATION_Handle *cfg, if (uri->type != GNUNET_FS_URI_SKS) return NULL; - (void) GNUNET_PSEUDONYM_get_info (cfg, &uri->data.sks.ns, + (void) GNUNET_FS_pseudonym_get_info (cfg, &uri->data.sks.ns, NULL, NULL, &name, NULL); - unique_name = GNUNET_PSEUDONYM_name_uniquify (cfg, &uri->data.sks.ns, name, NULL); + unique_name = GNUNET_FS_pseudonym_name_uniquify (cfg, &uri->data.sks.ns, name, NULL); GNUNET_free (name); GNUNET_asprintf (&ret, "%s: %s", unique_name, uri->data.sks.identifier); GNUNET_free (unique_name); @@ -1944,7 +1944,7 @@ uri_sks_to_string (const struct GNUNET_FS_Uri *uri) if (GNUNET_FS_URI_SKS != uri->type) return NULL; ret = GNUNET_STRINGS_data_to_string (&uri->data.sks.ns, - sizeof (struct GNUNET_PseudonymIdentifier), + sizeof (struct GNUNET_FS_PseudonymIdentifier), buf, sizeof (buf)); GNUNET_assert (NULL != ret); diff --git a/src/fs/gnunet-pseudonym.c b/src/fs/gnunet-pseudonym.c index dd3c9d4a2..61975e463 100644 --- a/src/fs/gnunet-pseudonym.c +++ b/src/fs/gnunet-pseudonym.c @@ -95,13 +95,13 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info) static void -ns_printer (void *cls, const char *name, const struct GNUNET_PseudonymIdentifier *pseudonym) +ns_printer (void *cls, const char *name, const struct GNUNET_FS_PseudonymIdentifier *pseudonym) { struct GNUNET_CRYPTO_HashAsciiEncoded enc; struct GNUNET_HashCode hc; GNUNET_CRYPTO_hash (pseudonym, - sizeof (struct GNUNET_PseudonymIdentifier), + sizeof (struct GNUNET_FS_PseudonymIdentifier), &hc); GNUNET_CRYPTO_hash_to_enc (&hc, &enc); FPRINTF (stdout, "%s (%s)\n", name, (const char *) &enc); @@ -121,7 +121,7 @@ ns_printer (void *cls, const char *name, const struct GNUNET_PseudonymIdentifier */ static int pseudo_printer (void *cls, - const struct GNUNET_PseudonymIdentifier *pseudonym, + const struct GNUNET_FS_PseudonymIdentifier *pseudonym, const char *name, const char *unique_name, const struct GNUNET_CONTAINER_MetaData *md, @@ -132,16 +132,16 @@ pseudo_printer (void *cls, int getinfo_result; /* While we get a name from the caller, it might be NULL. - * GNUNET_PSEUDONYM_get_info () never returns NULL. + * GNUNET_FS_pseudonym_get_info () never returns NULL. */ - getinfo_result = GNUNET_PSEUDONYM_get_info (cfg, pseudonym, + getinfo_result = GNUNET_FS_pseudonym_get_info (cfg, pseudonym, NULL, NULL, &id, NULL); if (getinfo_result != GNUNET_OK) { GNUNET_break (0); return GNUNET_OK; } - unique_id = GNUNET_PSEUDONYM_name_uniquify (cfg, pseudonym, id, NULL); + unique_id = GNUNET_FS_pseudonym_name_uniquify (cfg, pseudonym, id, NULL); GNUNET_free (id); FPRINTF (stdout, "%s (%d):\n", unique_id, rating); GNUNET_CONTAINER_meta_data_iterate (md, &EXTRACTOR_meta_data_print, stdout); @@ -154,7 +154,7 @@ pseudo_printer (void *cls, static void post_advertising (void *cls, const struct GNUNET_FS_Uri *uri, const char *emsg) { - struct GNUNET_PseudonymIdentifier nsid; + struct GNUNET_FS_PseudonymIdentifier nsid; char *set; int delta; @@ -183,9 +183,9 @@ post_advertising (void *cls, const struct GNUNET_FS_Uri *uri, const char *emsg) *set = '\0'; delta = strtol (&set[1], NULL, /* no error handling yet */ 10); - if (GNUNET_OK == GNUNET_PSEUDONYM_name_to_id (cfg, rating_change, &nsid)) + if (GNUNET_OK == GNUNET_FS_pseudonym_name_to_id (cfg, rating_change, &nsid)) { - (void) GNUNET_PSEUDONYM_rank (cfg, &nsid, delta); + (void) GNUNET_FS_pseudonym_rank (cfg, &nsid, delta); } else { @@ -203,7 +203,7 @@ post_advertising (void *cls, const struct GNUNET_FS_Uri *uri, const char *emsg) } else if (0 == no_remote_printing) { - GNUNET_PSEUDONYM_list_all (cfg, &pseudo_printer, NULL); + GNUNET_FS_pseudonym_list_all (cfg, &pseudo_printer, NULL); } GNUNET_FS_stop (h); } diff --git a/src/fs/plugin_block_fs.c b/src/fs/plugin_block_fs.c index a05283f16..f41e0cd44 100644 --- a/src/fs/plugin_block_fs.c +++ b/src/fs/plugin_block_fs.c @@ -105,13 +105,13 @@ block_plugin_fs_evaluate (void *cls, enum GNUNET_BLOCK_Type type, GNUNET_break_op (0); return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; } - if (reply_block_size != ntohl (ub->purpose.size) + sizeof (struct GNUNET_PseudonymSignature)) + if (reply_block_size != ntohl (ub->purpose.size) + sizeof (struct GNUNET_FS_PseudonymSignature)) { GNUNET_break_op (0); return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; } if (GNUNET_OK != - GNUNET_PSEUDONYM_verify (&ub->purpose, + GNUNET_FS_pseudonym_verify (&ub->purpose, &ub->signature, &ub->verification_key)) { diff --git a/src/fs/test_fs_namespace.c b/src/fs/test_fs_namespace.c index a72197e10..ddeab6dc9 100644 --- a/src/fs/test_fs_namespace.c +++ b/src/fs/test_fs_namespace.c @@ -29,7 +29,7 @@ #include "gnunet_fs_service.h" -static struct GNUNET_PseudonymIdentifier nsid; +static struct GNUNET_FS_PseudonymIdentifier nsid; static struct GNUNET_FS_Uri *sks_expect_uri; @@ -269,7 +269,7 @@ adv_cont (void *cls, const struct GNUNET_FS_Uri *uri, const char *emsg) static void -ns_iterator (void *cls, const char *name, const struct GNUNET_PseudonymIdentifier *id) +ns_iterator (void *cls, const char *name, const struct GNUNET_FS_PseudonymIdentifier *id) { int *ok = cls; diff --git a/src/fs/test_fs_uri.c b/src/fs/test_fs_uri.c index 6d0bfdea9..d0aa26b79 100644 --- a/src/fs/test_fs_uri.c +++ b/src/fs/test_fs_uri.c @@ -162,8 +162,8 @@ testNamespace (int i) char *uri; struct GNUNET_FS_Uri *ret; char *emsg; - struct GNUNET_PseudonymHandle *ph; - struct GNUNET_PseudonymIdentifier id; + struct GNUNET_FS_PseudonymHandle *ph; + struct GNUNET_FS_PseudonymIdentifier id; char buf[1024]; char ubuf[1024]; char *sret; @@ -192,8 +192,8 @@ testNamespace (int i) GNUNET_assert (0); } GNUNET_free (emsg); - ph = GNUNET_PSEUDONYM_create (NULL); - GNUNET_PSEUDONYM_get_identifier (ph, &id); + ph = GNUNET_FS_pseudonym_create (NULL); + GNUNET_FS_pseudonym_get_identifier (ph, &id); sret = GNUNET_STRINGS_data_to_string (&id, sizeof (id), ubuf, sizeof (ubuf) - 1); GNUNET_assert (NULL != sret); diff --git a/src/fs/test_pseudonym.c b/src/fs/test_pseudonym.c index 5247d6dcc..0615f5a5b 100644 --- a/src/fs/test_pseudonym.c +++ b/src/fs/test_pseudonym.c @@ -33,17 +33,17 @@ static struct GNUNET_CONTAINER_MetaData *meta; -static struct GNUNET_PseudonymIdentifier id1; +static struct GNUNET_FS_PseudonymIdentifier id1; static int -iter (void *cls, const struct GNUNET_PseudonymIdentifier * pseudonym, +iter (void *cls, const struct GNUNET_FS_PseudonymIdentifier * pseudonym, const char *name, const char *unique_name, const struct GNUNET_CONTAINER_MetaData *md, int32_t rating) { int *ok = cls; - if ((0 == memcmp (pseudonym, &id1, sizeof (struct GNUNET_PseudonymIdentifier))) && + if ((0 == memcmp (pseudonym, &id1, sizeof (struct GNUNET_FS_PseudonymIdentifier))) && (!GNUNET_CONTAINER_meta_data_test_equal (md, meta))) { *ok = GNUNET_NO; @@ -54,7 +54,7 @@ iter (void *cls, const struct GNUNET_PseudonymIdentifier * pseudonym, static int -noti_callback (void *cls, const struct GNUNET_PseudonymIdentifier * pseudonym, +noti_callback (void *cls, const struct GNUNET_FS_PseudonymIdentifier * pseudonym, const char *name, const char *unique_name, const struct GNUNET_CONTAINER_MetaData *md, int32_t rating) { @@ -66,7 +66,7 @@ noti_callback (void *cls, const struct GNUNET_PseudonymIdentifier * pseudonym, static int -fake_noti_callback (void *cls, const struct GNUNET_PseudonymIdentifier * pseudonym, +fake_noti_callback (void *cls, const struct GNUNET_FS_PseudonymIdentifier * pseudonym, const char *name, const char *unique_name, const struct GNUNET_CONTAINER_MetaData *md, int32_t rating) { @@ -78,13 +78,13 @@ fake_noti_callback (void *cls, const struct GNUNET_PseudonymIdentifier * pseudon static void -create_pseu (struct GNUNET_PseudonymIdentifier *pseu) +create_pseu (struct GNUNET_FS_PseudonymIdentifier *pseu) { - struct GNUNET_PseudonymHandle *ph; + struct GNUNET_FS_PseudonymHandle *ph; - ph = GNUNET_PSEUDONYM_create (NULL); - GNUNET_PSEUDONYM_get_identifier (ph, pseu); - GNUNET_PSEUDONYM_destroy (ph); + ph = GNUNET_FS_pseudonym_create (NULL); + GNUNET_FS_pseudonym_get_identifier (ph, pseu); + GNUNET_FS_pseudonym_destroy (ph); } @@ -95,11 +95,11 @@ static int test_io () { int ok; - struct GNUNET_PseudonymIdentifier rid1; - struct GNUNET_PseudonymIdentifier id2; - struct GNUNET_PseudonymIdentifier rid2; - struct GNUNET_PseudonymIdentifier fid; - struct GNUNET_PseudonymIdentifier id3; + struct GNUNET_FS_PseudonymIdentifier rid1; + struct GNUNET_FS_PseudonymIdentifier id2; + struct GNUNET_FS_PseudonymIdentifier rid2; + struct GNUNET_FS_PseudonymIdentifier fid; + struct GNUNET_FS_PseudonymIdentifier id3; int old; int newVal; struct GNUNET_CONFIGURATION_Handle *cfg; @@ -112,8 +112,8 @@ test_io () int noname_is_a_dup; int notiCount, fakenotiCount; static char m[1024 * 1024 * 10]; - struct GNUNET_PSEUDONYM_DiscoveryHandle *dh1; - struct GNUNET_PSEUDONYM_DiscoveryHandle *dh2; + struct GNUNET_FS_pseudonym_DiscoveryHandle *dh1; + struct GNUNET_FS_pseudonym_DiscoveryHandle *dh2; memset (m, 'b', sizeof (m)); m[sizeof (m) - 1] = '\0'; @@ -130,30 +130,30 @@ test_io () } notiCount = 0; fakenotiCount = 0; - dh1 = GNUNET_PSEUDONYM_discovery_callback_register (cfg, &fake_noti_callback, + dh1 = GNUNET_FS_pseudonym_discovery_callback_register (cfg, &fake_noti_callback, &fakenotiCount); - dh2 = GNUNET_PSEUDONYM_discovery_callback_register (cfg, ¬i_callback, + dh2 = GNUNET_FS_pseudonym_discovery_callback_register (cfg, ¬i_callback, ¬iCount); - GNUNET_PSEUDONYM_discovery_callback_unregister (dh1); + GNUNET_FS_pseudonym_discovery_callback_unregister (dh1); /* ACTUAL TEST CODE */ - old = GNUNET_PSEUDONYM_list_all (cfg, NULL, NULL); + old = GNUNET_FS_pseudonym_list_all (cfg, NULL, NULL); meta = GNUNET_CONTAINER_meta_data_create (); GNUNET_CONTAINER_meta_data_insert (meta, "", EXTRACTOR_METATYPE_TITLE, EXTRACTOR_METAFORMAT_UTF8, "text/plain", "test", strlen ("test") + 1); create_pseu (&id1); - GNUNET_PSEUDONYM_add (cfg, &id1, meta); + GNUNET_FS_pseudonym_add (cfg, &id1, meta); CHECK (notiCount == 1); - GNUNET_PSEUDONYM_add (cfg, &id1, meta); + GNUNET_FS_pseudonym_add (cfg, &id1, meta); CHECK (notiCount == 2); - newVal = GNUNET_PSEUDONYM_list_all (cfg, &iter, &ok); + newVal = GNUNET_FS_pseudonym_list_all (cfg, &iter, &ok); CHECK (old < newVal); old = newVal; create_pseu (&id2); - GNUNET_PSEUDONYM_add (cfg, &id2, meta); + GNUNET_FS_pseudonym_add (cfg, &id2, meta); CHECK (notiCount == 3); - newVal = GNUNET_PSEUDONYM_list_all (cfg, &iter, &ok); + newVal = GNUNET_FS_pseudonym_list_all (cfg, &iter, &ok); CHECK (old < newVal); GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_meta_data_insert (meta, "", @@ -162,36 +162,36 @@ test_io () "text/plain", m, strlen (m) + 1)); create_pseu (&id3); - GNUNET_PSEUDONYM_add (cfg, &id3, meta); - GNUNET_PSEUDONYM_get_info (cfg, &id3, NULL, NULL, &name3, NULL); + GNUNET_FS_pseudonym_add (cfg, &id3, meta); + GNUNET_FS_pseudonym_get_info (cfg, &id3, NULL, NULL, &name3, NULL); CHECK (name3 != NULL); - GNUNET_PSEUDONYM_get_info (cfg, &id2, NULL, NULL, &name2, NULL); + GNUNET_FS_pseudonym_get_info (cfg, &id2, NULL, NULL, &name2, NULL); CHECK (name2 != NULL); - GNUNET_PSEUDONYM_get_info (cfg, &id1, NULL, NULL, &name1, NULL); + GNUNET_FS_pseudonym_get_info (cfg, &id1, NULL, NULL, &name1, NULL); CHECK (name1 != NULL); CHECK (0 == strcmp (name1, name2)); - name1_unique = GNUNET_PSEUDONYM_name_uniquify (cfg, &id1, name1, NULL); - name2_unique = GNUNET_PSEUDONYM_name_uniquify (cfg, &id2, name2, NULL); + name1_unique = GNUNET_FS_pseudonym_name_uniquify (cfg, &id1, name1, NULL); + name2_unique = GNUNET_FS_pseudonym_name_uniquify (cfg, &id2, name2, NULL); CHECK (0 != strcmp (name1_unique, name2_unique)); - CHECK (GNUNET_SYSERR == GNUNET_PSEUDONYM_name_to_id (cfg, "fake", &rid2)); - CHECK (GNUNET_SYSERR == GNUNET_PSEUDONYM_name_to_id (cfg, name2, &rid2)); - CHECK (GNUNET_SYSERR == GNUNET_PSEUDONYM_name_to_id (cfg, name1, &rid1)); - CHECK (GNUNET_OK == GNUNET_PSEUDONYM_name_to_id (cfg, name2_unique, &rid2)); - CHECK (GNUNET_OK == GNUNET_PSEUDONYM_name_to_id (cfg, name1_unique, &rid1)); - CHECK (0 == memcmp (&id1, &rid1, sizeof (struct GNUNET_PseudonymIdentifier))); - CHECK (0 == memcmp (&id2, &rid2, sizeof (struct GNUNET_PseudonymIdentifier))); + CHECK (GNUNET_SYSERR == GNUNET_FS_pseudonym_name_to_id (cfg, "fake", &rid2)); + CHECK (GNUNET_SYSERR == GNUNET_FS_pseudonym_name_to_id (cfg, name2, &rid2)); + CHECK (GNUNET_SYSERR == GNUNET_FS_pseudonym_name_to_id (cfg, name1, &rid1)); + CHECK (GNUNET_OK == GNUNET_FS_pseudonym_name_to_id (cfg, name2_unique, &rid2)); + CHECK (GNUNET_OK == GNUNET_FS_pseudonym_name_to_id (cfg, name1_unique, &rid1)); + CHECK (0 == memcmp (&id1, &rid1, sizeof (struct GNUNET_FS_PseudonymIdentifier))); + CHECK (0 == memcmp (&id2, &rid2, sizeof (struct GNUNET_FS_PseudonymIdentifier))); create_pseu (&fid); GNUNET_log_skip (1, GNUNET_NO); - CHECK (0 == GNUNET_PSEUDONYM_rank (cfg, &fid, 0)); + CHECK (0 == GNUNET_FS_pseudonym_rank (cfg, &fid, 0)); GNUNET_log_skip (0, GNUNET_NO); - CHECK (GNUNET_OK == GNUNET_PSEUDONYM_get_info (cfg, &fid, NULL, NULL, &noname, &noname_is_a_dup)); + CHECK (GNUNET_OK == GNUNET_FS_pseudonym_get_info (cfg, &fid, NULL, NULL, &noname, &noname_is_a_dup)); CHECK (noname != NULL); CHECK (noname_is_a_dup == GNUNET_YES); - CHECK (0 == GNUNET_PSEUDONYM_rank (cfg, &id1, 0)); - CHECK (5 == GNUNET_PSEUDONYM_rank (cfg, &id1, 5)); - CHECK (-5 == GNUNET_PSEUDONYM_rank (cfg, &id1, -10)); - CHECK (0 == GNUNET_PSEUDONYM_rank (cfg, &id1, 5)); + CHECK (0 == GNUNET_FS_pseudonym_rank (cfg, &id1, 0)); + CHECK (5 == GNUNET_FS_pseudonym_rank (cfg, &id1, 5)); + CHECK (-5 == GNUNET_FS_pseudonym_rank (cfg, &id1, -10)); + CHECK (0 == GNUNET_FS_pseudonym_rank (cfg, &id1, 5)); GNUNET_free (name1); GNUNET_free (name2); GNUNET_free (name1_unique); @@ -200,7 +200,7 @@ test_io () GNUNET_free (noname); /* END OF TEST CODE */ FAILURE: - GNUNET_PSEUDONYM_discovery_callback_unregister (dh2); + GNUNET_FS_pseudonym_discovery_callback_unregister (dh2); GNUNET_CONTAINER_meta_data_destroy (meta); GNUNET_CONFIGURATION_destroy (cfg); return (ok == GNUNET_YES) ? 0 : 1; @@ -211,38 +211,38 @@ FAILURE: * Use the given input to sign and check the resulting signature. */ static void -test_signature (struct GNUNET_PseudonymHandle *ph, - struct GNUNET_PseudonymSignaturePurpose *purpose, +test_signature (struct GNUNET_FS_PseudonymHandle *ph, + struct GNUNET_FS_PseudonymSignaturePurpose *purpose, struct GNUNET_HashCode *seed, struct GNUNET_HashCode *signing_key, char *bit) { - struct GNUNET_PseudonymSignature signature; - struct GNUNET_PseudonymSignature signature2; - struct GNUNET_PseudonymIdentifier pseudonym; - struct GNUNET_PseudonymIdentifier verification_key; + struct GNUNET_FS_PseudonymSignature signature; + struct GNUNET_FS_PseudonymSignature signature2; + struct GNUNET_FS_PseudonymIdentifier pseudonym; + struct GNUNET_FS_PseudonymIdentifier verification_key; - GNUNET_PSEUDONYM_sign (ph, purpose, seed, signing_key, &signature); + GNUNET_FS_pseudonym_sign (ph, purpose, seed, signing_key, &signature); if (0) { - GNUNET_PSEUDONYM_sign (ph, purpose, seed, signing_key, &signature2); + GNUNET_FS_pseudonym_sign (ph, purpose, seed, signing_key, &signature2); /* with seed, two sigs must be identical, without, they must be different! */ if (NULL != seed) GNUNET_break (0 == memcmp (&signature, &signature2, sizeof (signature))); else /* crypto not implemented, thus for now 'break' */ GNUNET_break (0 != memcmp (&signature, &signature2, sizeof (signature))); } - GNUNET_PSEUDONYM_get_identifier (ph, &pseudonym); - GNUNET_PSEUDONYM_derive_verification_key (&pseudonym, + GNUNET_FS_pseudonym_get_identifier (ph, &pseudonym); + GNUNET_FS_pseudonym_derive_verification_key (&pseudonym, signing_key, &verification_key); GNUNET_break (GNUNET_OK == - GNUNET_PSEUDONYM_verify (purpose, &signature, &verification_key)); + GNUNET_FS_pseudonym_verify (purpose, &signature, &verification_key)); /* also check that if the data is changed, the signature no longer matches */ (*bit)++; /* crypto not implemented, thus for now 'break' */ GNUNET_break (GNUNET_OK != - GNUNET_PSEUDONYM_verify (purpose, &signature, &verification_key)); + GNUNET_FS_pseudonym_verify (purpose, &signature, &verification_key)); (*bit)--; } @@ -253,21 +253,21 @@ test_signature (struct GNUNET_PseudonymHandle *ph, * @param ph private key to test */ static void -test_crypto_ops (struct GNUNET_PseudonymHandle *ph) +test_crypto_ops (struct GNUNET_FS_PseudonymHandle *ph) { char data[16]; - struct GNUNET_PseudonymSignaturePurpose *purpose; + struct GNUNET_FS_PseudonymSignaturePurpose *purpose; struct GNUNET_HashCode seed; struct GNUNET_HashCode signing_key; memset (data, 42, sizeof (data)); - purpose = (struct GNUNET_PseudonymSignaturePurpose *) data; + purpose = (struct GNUNET_FS_PseudonymSignaturePurpose *) data; purpose->size = htonl (sizeof (data)); purpose->purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TEST); memset (&seed, 41, sizeof (seed)); memset (&signing_key, 40, sizeof (signing_key)); - test_signature (ph, purpose, &seed, &signing_key, &data[sizeof (struct GNUNET_PseudonymSignaturePurpose)]); - test_signature (ph, purpose, NULL, &signing_key, &data[sizeof (struct GNUNET_PseudonymSignaturePurpose)]); + test_signature (ph, purpose, &seed, &signing_key, &data[sizeof (struct GNUNET_FS_PseudonymSignaturePurpose)]); + test_signature (ph, purpose, NULL, &signing_key, &data[sizeof (struct GNUNET_FS_PseudonymSignaturePurpose)]); } @@ -277,36 +277,36 @@ test_crypto_ops (struct GNUNET_PseudonymHandle *ph) static int test_crypto () { - struct GNUNET_PseudonymHandle *ph; - struct GNUNET_PseudonymIdentifier pseudonym; - struct GNUNET_PseudonymIdentifier pseudonym2; + struct GNUNET_FS_PseudonymHandle *ph; + struct GNUNET_FS_PseudonymIdentifier pseudonym; + struct GNUNET_FS_PseudonymIdentifier pseudonym2; /* check writing to and reading from disk */ - ph = GNUNET_PSEUDONYM_create ("/tmp/gnunet-pseudonym-test/pseu.dsa"); - GNUNET_PSEUDONYM_get_identifier (ph, &pseudonym); - GNUNET_PSEUDONYM_destroy (ph); - ph = GNUNET_PSEUDONYM_create ("/tmp/gnunet-pseudonym-test/pseu.dsa"); - GNUNET_PSEUDONYM_get_identifier (ph, &pseudonym2); + ph = GNUNET_FS_pseudonym_create ("/tmp/gnunet-pseudonym-test/pseu.dsa"); + GNUNET_FS_pseudonym_get_identifier (ph, &pseudonym); + GNUNET_FS_pseudonym_destroy (ph); + ph = GNUNET_FS_pseudonym_create ("/tmp/gnunet-pseudonym-test/pseu.dsa"); + GNUNET_FS_pseudonym_get_identifier (ph, &pseudonym2); test_crypto_ops (ph); - GNUNET_PSEUDONYM_destroy (ph); + GNUNET_FS_pseudonym_destroy (ph); if (0 != memcmp (&pseudonym, &pseudonym2, sizeof (pseudonym))) return 1; /* check in-memory generation */ - ph = GNUNET_PSEUDONYM_create (NULL); - GNUNET_PSEUDONYM_get_identifier (ph, &pseudonym2); + ph = GNUNET_FS_pseudonym_create (NULL); + GNUNET_FS_pseudonym_get_identifier (ph, &pseudonym2); if (0 == memcmp (&pseudonym, &pseudonym2, sizeof (pseudonym))) return 1; test_crypto_ops (ph); - GNUNET_PSEUDONYM_destroy (ph); + GNUNET_FS_pseudonym_destroy (ph); /* check anonymous pseudonym operations generation */ - ph = GNUNET_PSEUDONYM_get_anonymous_pseudonym_handle (); - GNUNET_PSEUDONYM_get_identifier (ph, &pseudonym2); + ph = GNUNET_FS_pseudonym_get_anonymous_pseudonym_handle (); + GNUNET_FS_pseudonym_get_identifier (ph, &pseudonym2); if (0 == memcmp (&pseudonym, &pseudonym2, sizeof (pseudonym))) return 1; test_crypto_ops (ph); - GNUNET_PSEUDONYM_destroy (ph); + GNUNET_FS_pseudonym_destroy (ph); return 0; } diff --git a/src/include/block_fs.h b/src/include/block_fs.h index 233d8035e..4806bf7b1 100644 --- a/src/include/block_fs.h +++ b/src/include/block_fs.h @@ -48,18 +48,18 @@ struct UBlock /** * Signature using pseudonym and search keyword / identifier. */ - struct GNUNET_PseudonymSignature signature; + struct GNUNET_FS_PseudonymSignature signature; /** * What is being signed and why? */ - struct GNUNET_PseudonymSignaturePurpose purpose; + struct GNUNET_FS_PseudonymSignaturePurpose purpose; /** * Public key used to sign this block. Hash of this value * is the query. */ - struct GNUNET_PseudonymIdentifier verification_key; + struct GNUNET_FS_PseudonymIdentifier verification_key; /* rest of the data is encrypted */ diff --git a/src/include/gnunet_fs_service.h b/src/include/gnunet_fs_service.h index 6143f0630..83279cb08 100644 --- a/src/include/gnunet_fs_service.h +++ b/src/include/gnunet_fs_service.h @@ -84,7 +84,7 @@ struct GNUNET_FS_Uri; * Identifier for a GNUnet pseudonym (the public key). * Q-point, Q=dp. */ -struct GNUNET_PseudonymIdentifier +struct GNUNET_FS_PseudonymIdentifier { /** * Q consists of an x- and a y-value, each mod p (256 bits), @@ -104,7 +104,7 @@ struct GNUNET_PseudonymIdentifier /** * Handle for a pseudonym (private key). */ -struct GNUNET_PseudonymHandle; +struct GNUNET_FS_PseudonymHandle; /** @@ -114,13 +114,13 @@ struct GNUNET_PseudonymHandle; * where z is derived from the hash of the message that is being * signed. */ -struct GNUNET_PseudonymSignature +struct GNUNET_FS_PseudonymSignature { /** * Who created the signature? (public key of the signer), 'd' value in NIST P-256. */ - struct GNUNET_PseudonymIdentifier signer; + struct GNUNET_FS_PseudonymIdentifier signer; /** * Binary ECDSA signature data, r-value. Value is mod n, and n is 256 bits. @@ -137,7 +137,7 @@ struct GNUNET_PseudonymSignature /** * Purpose for signature made with a pseudonym. */ -struct GNUNET_PseudonymSignaturePurpose +struct GNUNET_FS_PseudonymSignaturePurpose { /** * How many bytes are being signed (including this header)? @@ -171,8 +171,8 @@ typedef int (*GNUNET_FS_KeywordIterator) (void *cls, const char *keyword, * @param filename name of the file to use for storage, NULL for in-memory only * @return handle to the private key of the pseudonym */ -struct GNUNET_PseudonymHandle * -GNUNET_PSEUDONYM_create (const char *filename); +struct GNUNET_FS_PseudonymHandle * +GNUNET_FS_pseudonym_create (const char *filename); /** @@ -181,8 +181,8 @@ GNUNET_PSEUDONYM_create (const char *filename); * @param filename name of the file to use for storage, NULL for in-memory only * @return handle to the private key of the pseudonym */ -struct GNUNET_PseudonymHandle * -GNUNET_PSEUDONYM_create_from_existing_file (const char *filename); +struct GNUNET_FS_PseudonymHandle * +GNUNET_FS_pseudonym_create_from_existing_file (const char *filename); /** @@ -193,8 +193,8 @@ GNUNET_PSEUDONYM_create_from_existing_file (const char *filename); * * @return handle to the (non-secret) private key of the 'anonymous' pseudonym */ -struct GNUNET_PseudonymHandle * -GNUNET_PSEUDONYM_get_anonymous_pseudonym_handle (void); +struct GNUNET_FS_PseudonymHandle * +GNUNET_FS_pseudonym_get_anonymous_pseudonym_handle (void); /** @@ -204,7 +204,7 @@ GNUNET_PSEUDONYM_get_anonymous_pseudonym_handle (void); * @param ph pseudonym handle to destroy */ void -GNUNET_PSEUDONYM_destroy (struct GNUNET_PseudonymHandle *ph); +GNUNET_FS_pseudonym_destroy (struct GNUNET_FS_PseudonymHandle *ph); /** @@ -221,11 +221,11 @@ GNUNET_PSEUDONYM_destroy (struct GNUNET_PseudonymHandle *ph); * @return GNUNET_SYSERR on failure */ int -GNUNET_PSEUDONYM_sign (struct GNUNET_PseudonymHandle *ph, - const struct GNUNET_PseudonymSignaturePurpose *purpose, - const struct GNUNET_HashCode *seed, - const struct GNUNET_HashCode *signing_key, - struct GNUNET_PseudonymSignature *signature); +GNUNET_FS_pseudonym_sign (struct GNUNET_FS_PseudonymHandle *ph, + const struct GNUNET_FS_PseudonymSignaturePurpose *purpose, + const struct GNUNET_HashCode *seed, + const struct GNUNET_HashCode *signing_key, + struct GNUNET_FS_PseudonymSignature *signature); /** @@ -236,13 +236,13 @@ GNUNET_PSEUDONYM_sign (struct GNUNET_PseudonymHandle *ph, * @param signing_key input to derive 'h' (see section 2.4 of #2564) * @param verification_key resulting public key to verify the signature * created from the 'ph' of 'pseudonym' and the 'signing_key'; - * the value stored here can then be given to GNUNET_PSEUDONYM_verify. + * the value stored here can then be given to GNUNET_FS_pseudonym_verify. * @return GNUNET_OK on success, GNUNET_SYSERR on error */ int -GNUNET_PSEUDONYM_derive_verification_key (struct GNUNET_PseudonymIdentifier *pseudonym, - const struct GNUNET_HashCode *signing_key, - struct GNUNET_PseudonymIdentifier *verification_key); +GNUNET_FS_pseudonym_derive_verification_key (struct GNUNET_FS_PseudonymIdentifier *pseudonym, + const struct GNUNET_HashCode *signing_key, + struct GNUNET_FS_PseudonymIdentifier *verification_key); /** @@ -256,9 +256,9 @@ GNUNET_PSEUDONYM_derive_verification_key (struct GNUNET_PseudonymIdentifier *pse * GNUNET_SYSERR if the signature is invalid */ int -GNUNET_PSEUDONYM_verify (const struct GNUNET_PseudonymSignaturePurpose *purpose, - const struct GNUNET_PseudonymSignature *signature, - const struct GNUNET_PseudonymIdentifier *verification_key); +GNUNET_FS_pseudonym_verify (const struct GNUNET_FS_PseudonymSignaturePurpose *purpose, + const struct GNUNET_FS_PseudonymSignature *signature, + const struct GNUNET_FS_PseudonymIdentifier *verification_key); /** @@ -268,8 +268,8 @@ GNUNET_PSEUDONYM_verify (const struct GNUNET_PseudonymSignaturePurpose *purpose, * @param pseudonym pseudonym identifier (set based on 'ph') */ void -GNUNET_PSEUDONYM_get_identifier (struct GNUNET_PseudonymHandle *ph, - struct GNUNET_PseudonymIdentifier *pseudonym); +GNUNET_FS_pseudonym_get_identifier (struct GNUNET_FS_PseudonymHandle *ph, + struct GNUNET_FS_PseudonymIdentifier *pseudonym); @@ -284,12 +284,12 @@ GNUNET_PSEUDONYM_get_identifier (struct GNUNET_PseudonymHandle *ph, * @param rating the local rating of the pseudonym * @return GNUNET_OK to continue iteration, GNUNET_SYSERR to abort */ -typedef int (*GNUNET_PSEUDONYM_Iterator) (void *cls, - const struct GNUNET_PseudonymIdentifier *pseudonym, - const char *name, - const char *unique_name, - const struct GNUNET_CONTAINER_MetaData *md, - int32_t rating); +typedef int (*GNUNET_FS_PseudonymIterator) (void *cls, + const struct GNUNET_FS_PseudonymIdentifier *pseudonym, + const char *name, + const char *unique_name, + const struct GNUNET_CONTAINER_MetaData *md, + int32_t rating); /** @@ -301,9 +301,9 @@ typedef int (*GNUNET_PSEUDONYM_Iterator) (void *cls, * @return new rating of the pseudonym */ int -GNUNET_PSEUDONYM_rank (const struct GNUNET_CONFIGURATION_Handle *cfg, - const struct GNUNET_PseudonymIdentifier *pseudonym, - int32_t delta); +GNUNET_FS_pseudonym_rank (const struct GNUNET_CONFIGURATION_Handle *cfg, + const struct GNUNET_FS_PseudonymIdentifier *pseudonym, + int32_t delta); /** @@ -317,9 +317,9 @@ GNUNET_PSEUDONYM_rank (const struct GNUNET_CONFIGURATION_Handle *cfg, * @return GNUNET_OK on success, GNUNET_SYSERR on failure */ int -GNUNET_PSEUDONYM_add (const struct GNUNET_CONFIGURATION_Handle *cfg, - const struct GNUNET_PseudonymIdentifier *pseudonym, - const struct GNUNET_CONTAINER_MetaData *meta); +GNUNET_FS_pseudonym_add (const struct GNUNET_CONFIGURATION_Handle *cfg, + const struct GNUNET_FS_PseudonymIdentifier *pseudonym, + const struct GNUNET_CONTAINER_MetaData *meta); /** @@ -331,15 +331,15 @@ GNUNET_PSEUDONYM_add (const struct GNUNET_CONFIGURATION_Handle *cfg, * @return number of pseudonyms found */ int -GNUNET_PSEUDONYM_list_all (const struct GNUNET_CONFIGURATION_Handle *cfg, - GNUNET_PSEUDONYM_Iterator iterator, - void *iterator_cls); +GNUNET_FS_pseudonym_list_all (const struct GNUNET_CONFIGURATION_Handle *cfg, + GNUNET_FS_PseudonymIterator iterator, + void *iterator_cls); /** * Handle for a discovery callback registration. */ -struct GNUNET_PSEUDONYM_DiscoveryHandle; +struct GNUNET_FS_pseudonym_DiscoveryHandle; /** @@ -351,10 +351,10 @@ struct GNUNET_PSEUDONYM_DiscoveryHandle; * @param iterator_cls closure for iterator * @return registration handle */ -struct GNUNET_PSEUDONYM_DiscoveryHandle * -GNUNET_PSEUDONYM_discovery_callback_register (const struct GNUNET_CONFIGURATION_Handle *cfg, - GNUNET_PSEUDONYM_Iterator iterator, - void *iterator_cls); +struct GNUNET_FS_pseudonym_DiscoveryHandle * +GNUNET_FS_pseudonym_discovery_callback_register (const struct GNUNET_CONFIGURATION_Handle *cfg, + GNUNET_FS_PseudonymIterator iterator, + void *iterator_cls); /** @@ -363,12 +363,12 @@ GNUNET_PSEUDONYM_discovery_callback_register (const struct GNUNET_CONFIGURATION_ * @param dh registration to unregister */ void -GNUNET_PSEUDONYM_discovery_callback_unregister (struct GNUNET_PSEUDONYM_DiscoveryHandle *dh); +GNUNET_FS_pseudonym_discovery_callback_unregister (struct GNUNET_FS_pseudonym_DiscoveryHandle *dh); /** * Return unique variant of the pseudonym name. Use after - * GNUNET_PSEUDONYM_id_to_name() to make sure that name is unique. + * GNUNET_FS_pseudonym_id_to_name() to make sure that name is unique. * * @param cfg configuration * @param pseudonym cryptographic ID of the pseudonym @@ -378,10 +378,10 @@ GNUNET_PSEUDONYM_discovery_callback_unregister (struct GNUNET_PSEUDONYM_Discover * Free the name with GNUNET_free(). */ char * -GNUNET_PSEUDONYM_name_uniquify (const struct GNUNET_CONFIGURATION_Handle *cfg, - const struct GNUNET_PseudonymIdentifier *pseudonym, - const char *name, - unsigned int *suffix); +GNUNET_FS_pseudonym_name_uniquify (const struct GNUNET_CONFIGURATION_Handle *cfg, + const struct GNUNET_FS_PseudonymIdentifier *pseudonym, + const char *name, + unsigned int *suffix); /** @@ -405,12 +405,12 @@ GNUNET_PSEUDONYM_name_uniquify (const struct GNUNET_CONFIGURATION_Handle *cfg, * empty metadata container, rank -1 and a "no-name" name). */ int -GNUNET_PSEUDONYM_get_info (const struct GNUNET_CONFIGURATION_Handle *cfg, - const struct GNUNET_PseudonymIdentifier *pseudonym, - struct GNUNET_CONTAINER_MetaData **ret_meta, - int32_t *ret_rank, - char **ret_name, - int *name_is_a_dup); +GNUNET_FS_pseudonym_get_info (const struct GNUNET_CONFIGURATION_Handle *cfg, + const struct GNUNET_FS_PseudonymIdentifier *pseudonym, + struct GNUNET_CONTAINER_MetaData **ret_meta, + int32_t *ret_rank, + char **ret_name, + int *name_is_a_dup); /** @@ -422,9 +422,9 @@ GNUNET_PSEUDONYM_get_info (const struct GNUNET_CONFIGURATION_Handle *cfg, * @return GNUNET_OK on success, GNUNET_SYSERR on failure */ int -GNUNET_PSEUDONYM_name_to_id (const struct GNUNET_CONFIGURATION_Handle *cfg, - const char *ns_uname, - struct GNUNET_PseudonymIdentifier *pseudonym); +GNUNET_FS_pseudonym_name_to_id (const struct GNUNET_CONFIGURATION_Handle *cfg, + const char *ns_uname, + struct GNUNET_FS_PseudonymIdentifier *pseudonym); /** @@ -440,11 +440,11 @@ GNUNET_PSEUDONYM_name_to_id (const struct GNUNET_CONFIGURATION_Handle *cfg, * @return GNUNET_OK on success, GNUNET_SYSERR on failure */ int -GNUNET_PSEUDONYM_set_info (const struct GNUNET_CONFIGURATION_Handle *cfg, - const struct GNUNET_PseudonymIdentifier *pseudonym, - const char *name, - const struct GNUNET_CONTAINER_MetaData *md, - int32_t rank); +GNUNET_FS_pseudonym_set_info (const struct GNUNET_CONFIGURATION_Handle *cfg, + const struct GNUNET_FS_PseudonymIdentifier *pseudonym, + const char *name, + const struct GNUNET_CONTAINER_MetaData *md, + int32_t rank); /** @@ -455,8 +455,8 @@ GNUNET_PSEUDONYM_set_info (const struct GNUNET_CONFIGURATION_Handle *cfg, * @return GNUNET_OK on success, GNUNET_SYSERR on failure */ int -GNUNET_PSEUDONYM_remove (const struct GNUNET_CONFIGURATION_Handle *cfg, - const struct GNUNET_PseudonymIdentifier *id); +GNUNET_FS_pseudonym_remove (const struct GNUNET_CONFIGURATION_Handle *cfg, + const struct GNUNET_FS_PseudonymIdentifier *id); /** @@ -719,7 +719,7 @@ GNUNET_FS_uri_sks_create (struct GNUNET_FS_Namespace *ns, const char *id, * @return an FS URI for the given namespace and identifier */ struct GNUNET_FS_Uri * -GNUNET_FS_uri_sks_create_from_nsid (struct GNUNET_PseudonymIdentifier *pseudonym, +GNUNET_FS_uri_sks_create_from_nsid (struct GNUNET_FS_PseudonymIdentifier *pseudonym, const char *id); @@ -733,7 +733,7 @@ GNUNET_FS_uri_sks_create_from_nsid (struct GNUNET_PseudonymIdentifier *pseudonym */ int GNUNET_FS_uri_sks_get_namespace (const struct GNUNET_FS_Uri *uri, - struct GNUNET_PseudonymIdentifier *pseudonym); + struct GNUNET_FS_PseudonymIdentifier *pseudonym); /** @@ -1778,7 +1778,7 @@ struct GNUNET_FS_ProgressInfo /** * Public key of the namespace. */ - struct GNUNET_PseudonymIdentifier pseudonym; + struct GNUNET_FS_PseudonymIdentifier pseudonym; } ns; @@ -2619,7 +2619,7 @@ GNUNET_FS_namespace_dup (struct GNUNET_FS_Namespace *ns); */ int GNUNET_FS_namespace_get_public_identifier (struct GNUNET_FS_Namespace *ns, - struct GNUNET_PseudonymIdentifier *id); + struct GNUNET_FS_PseudonymIdentifier *id); /** @@ -2647,7 +2647,7 @@ GNUNET_FS_namespace_delete (struct GNUNET_FS_Namespace *ns, int freeze); * @param id identifier for the namespace */ typedef void (*GNUNET_FS_NamespaceInfoProcessor) (void *cls, const char *name, - const struct GNUNET_PseudonymIdentifier *id); + const struct GNUNET_FS_PseudonymIdentifier *id); /** -- cgit v1.2.3