helper library for handling URI-based HELLOs More...
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_signatures.h"
#include "gnunet_hello_uri_lib.h"
#include "gnunet_protocols.h"
Go to the source code of this file.
Data Structures | |
struct | SignedAddress |
Binary block we sign when we sign an address. More... | |
struct | HelloSignaturePurpose |
Message signed as part of a HELLO block/URL. More... | |
struct | HelloUriMessage |
Message used when gossiping HELLOs between peers. More... | |
struct | BlockHeader |
Start of a 'block'. More... | |
struct | DhtHelloMessage |
Message used when a DHT provides its HELLO to direct neighbours. More... | |
struct | Address |
Address of a peer. More... | |
struct | GNUNET_HELLO_Builder |
Context for building (or parsing) HELLO URIs. More... | |
struct | AddressUriMergeResult |
Struct to wrap data to do the merge of to hello uris. More... | |
struct | GNUNET_HELLO_Parser |
Context for parsing HELLOs. More... | |
Functions | |
static void | hash_addresses (const struct Address *a_head, struct GNUNET_HashCode *hash) |
Compute hash over addresses in builder. More... | |
static void | sign_hello (const struct GNUNET_HELLO_Builder *builder, struct GNUNET_TIME_Absolute et, const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, struct GNUNET_CRYPTO_EddsaSignature *sig) |
Create HELLO signature. More... | |
static enum GNUNET_GenericReturnValue | verify_hello (const struct GNUNET_HELLO_Parser *parser, struct GNUNET_TIME_Absolute et, const struct GNUNET_CRYPTO_EddsaSignature *sig) |
Verify HELLO signature. More... | |
static struct GNUNET_HELLO_Parser * | parser_new (const struct GNUNET_PeerIdentity *pid) |
struct GNUNET_HELLO_Builder * | GNUNET_HELLO_builder_new (const struct GNUNET_PeerIdentity *pid) |
Allocate builder. More... | |
const struct GNUNET_PeerIdentity * | GNUNET_HELLO_parser_get_id (const struct GNUNET_HELLO_Parser *parser) |
Get the PeerIdentity for this builder. More... | |
struct GNUNET_HELLO_Builder * | GNUNET_HELLO_builder_from_parser (const struct GNUNET_HELLO_Parser *p) |
Allocate builder from parser. More... | |
void | GNUNET_HELLO_parser_free (struct GNUNET_HELLO_Parser *parser) |
Release resources of a builder. More... | |
void | GNUNET_HELLO_builder_free (struct GNUNET_HELLO_Builder *builder) |
Release resources of a builder. More... | |
struct GNUNET_HELLO_Parser * | GNUNET_HELLO_parser_from_msg (const struct GNUNET_MessageHeader *msg) |
Parse msg. More... | |
static enum GNUNET_GenericReturnValue | check_address (const char *address) |
static enum GNUNET_GenericReturnValue | parser_add_address (struct GNUNET_HELLO_Parser *parser, const char *address) |
struct GNUNET_HELLO_Parser * | GNUNET_HELLO_parser_from_block (const void *block, size_t block_size) |
Parse block. More... | |
struct GNUNET_TIME_Absolute | GNUNET_HELLO_get_expiration_time_from_msg (const struct GNUNET_MessageHeader *msg) |
Get the expiration time for this HELLO. More... | |
enum GNUNET_GenericReturnValue | GNUNET_HELLO_builder_add_address (struct GNUNET_HELLO_Builder *builder, const char *address) |
Add individual address to the builder. More... | |
struct GNUNET_HELLO_Parser * | GNUNET_HELLO_parser_from_url (const char *url) |
Parse GNUnet HELLO url. More... | |
struct GNUNET_MessageHeader * | GNUNET_HELLO_builder_to_dht_hello_msg (const struct GNUNET_HELLO_Builder *builder, const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, struct GNUNET_TIME_Relative expiration_time) |
Generate DHT HELLO message (without peer ID) from a builder. More... | |
char * | GNUNET_HELLO_builder_to_url2 (const struct GNUNET_HELLO_Builder *builder, const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, struct GNUNET_TIME_Relative validity) |
Generate GNUnet HELLO URI from a builder. More... | |
char * | GNUNET_HELLO_parser_to_url (const struct GNUNET_HELLO_Parser *parser) |
Generate GNUnet HELLO URI from a parser. More... | |
char * | GNUNET_HELLO_builder_to_url (const struct GNUNET_HELLO_Builder *builder, const struct GNUNET_CRYPTO_EddsaPrivateKey *priv) |
Generate GNUnet HELLO URI from a builder. More... | |
enum GNUNET_GenericReturnValue | GNUNET_HELLO_builder_to_block (const struct GNUNET_HELLO_Builder *builder, const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, void *block, size_t *block_size, struct GNUNET_TIME_Relative expiration_time) |
Generate DHT block from a builder. More... | |
enum GNUNET_GenericReturnValue | GNUNET_HELLO_parser_to_block (const struct GNUNET_HELLO_Parser *parser, void *block, size_t *block_size) |
Generate DHT block from a parser. More... | |
struct GNUNET_MQ_Envelope * | GNUNET_HELLO_parser_to_env (const struct GNUNET_HELLO_Parser *parser) |
Generate envelope with GNUnet HELLO message (including peer ID) from a parser. More... | |
static struct GNUNET_MQ_Envelope * | GNUNET_HELLO_builder_to_env_ (const struct GNUNET_HELLO_Builder *builder, const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, struct GNUNET_TIME_Relative expiration_time, const struct GNUNET_CRYPTO_EddsaSignature *sig) |
struct GNUNET_MQ_Envelope * | GNUNET_HELLO_builder_to_env (const struct GNUNET_HELLO_Builder *builder, const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, struct GNUNET_TIME_Relative expiration_time) |
Generate envelope with GNUnet HELLO message (including peer ID) from a builder. More... | |
enum GNUNET_GenericReturnValue | GNUNET_HELLO_builder_del_address (struct GNUNET_HELLO_Builder *builder, const char *address) |
Remove individual address from the builder. More... | |
const struct GNUNET_PeerIdentity * | GNUNET_HELLO_parser_iterate (const struct GNUNET_HELLO_Parser *parser, GNUNET_HELLO_UriCallback uc, void *uc_cls) |
Iterate over URIs in a parser. More... | |
enum GNUNET_GenericReturnValue | GNUNET_HELLO_dht_msg_to_block (const struct GNUNET_MessageHeader *hello, const struct GNUNET_PeerIdentity *pid, void **block, size_t *block_size, struct GNUNET_TIME_Absolute *block_expiration) |
Convert a DHT hello message to a HELLO block. More... | |
char * | GNUNET_HELLO_address_to_prefix (const char *address) |
Given an address as a string, extract the prefix that identifies the communicator offering transmissions to that address. More... | |
void | GNUNET_HELLO_sign_address (const char *address, enum GNUNET_NetworkType nt, struct GNUNET_TIME_Absolute mono_time, const struct GNUNET_CRYPTO_EddsaPrivateKey *private_key, void **result, size_t *result_size) |
Build address record by signing raw information with private key. More... | |
helper library for handling URI-based HELLOs
Note:
Definition in file hello-uri.c.
|
static |
Compute hash over addresses in builder.
builder | the builder to hash addresses of | |
[out] | hash | where to write the hash |
Definition at line 297 of file hello-uri.c.
References a_head, GNUNET_CRYPTO_hash_context_finish(), GNUNET_CRYPTO_hash_context_read(), GNUNET_CRYPTO_hash_context_start(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, and MyAddress::next.
Referenced by sign_hello(), and verify_hello().
|
static |
Create HELLO signature.
builder | the builder to use | |
et | expiration time to sign | |
priv | key to sign with | |
[out] | sig | where to write the signature |
Definition at line 330 of file hello-uri.c.
References builder, GNUNET_CRYPTO_eddsa_sign, GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s_full(), GNUNET_log, GNUNET_SIGNATURE_PURPOSE_HELLO, GNUNET_TIME_absolute_hton(), HelloSignaturePurpose::h_addrs, hash_addresses(), HelloSignaturePurpose::purpose, and GNUNET_CRYPTO_EccSignaturePurpose::size.
Referenced by GNUNET_HELLO_builder_to_block(), and GNUNET_HELLO_builder_to_url2().
|
static |
Verify HELLO signature.
builder | the builder to use |
et | expiration time to verify |
sig | signature to verify |
Definition at line 362 of file hello-uri.c.
References GNUNET_break_op, GNUNET_CRYPTO_eddsa_verify, GNUNET_NO, GNUNET_OK, GNUNET_SIGNATURE_PURPOSE_HELLO, GNUNET_SYSERR, GNUNET_TIME_absolute_hton(), GNUNET_TIME_absolute_is_past(), HelloSignaturePurpose::h_addrs, hash_addresses(), consensus-simulation::parser, HelloSignaturePurpose::purpose, and GNUNET_CRYPTO_EccSignaturePurpose::size.
Referenced by GNUNET_HELLO_dht_msg_to_block(), GNUNET_HELLO_parser_from_block(), and GNUNET_HELLO_parser_from_url().
|
static |
Definition at line 390 of file hello-uri.c.
References GNUNET_new, p, GNUNET_OS_Process::pid, and pid.
Referenced by GNUNET_HELLO_parser_from_block(), and GNUNET_HELLO_parser_from_url().
|
static |
Definition at line 494 of file hello-uri.c.
References address, GNUNET_break_op, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_OK, GNUNET_SYSERR, and p.
Referenced by GNUNET_HELLO_builder_add_address(), and parser_add_address().
|
static |
Definition at line 523 of file hello-uri.c.
References address, check_address(), GNUNET_CONTAINER_DLL_insert_tail, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_malloc, GNUNET_NO, GNUNET_OK, Address::next, consensus-simulation::parser, ret, Address::uri, and Address::uri_len.
Referenced by GNUNET_HELLO_parser_from_block(), and GNUNET_HELLO_parser_from_url().
|
static |
Definition at line 1132 of file hello-uri.c.
References builder, env, GNUNET_assert, GNUNET_break, GNUNET_HELLO_builder_to_block(), GNUNET_MESSAGE_TYPE_HELLO_URI, GNUNET_MQ_msg_extra, GNUNET_NO, GNUNET_OK, and msg.
Referenced by GNUNET_HELLO_builder_to_env().