Manipulate GNS record data. More...
Data Structures | |
struct | GNUNET_GNSRECORD_Data |
A GNS record. More... | |
struct | GNUNET_GNSRECORD_PlaceData |
Data stored in a PLACE record. More... | |
struct | GNUNET_GNSRECORD_EcdsaBlock |
Information we have in an encrypted block with record data (i.e. More... | |
struct | GNUNET_GNSRECORD_EddsaBlock |
Information we have in an encrypted block with record data (i.e. More... | |
struct | GNUNET_GNSRECORD_Block |
struct | GNUNET_GNSRECORD_BoxRecord |
Record type used to box up SRV and TLSA records. More... | |
struct | GNUNET_GNSRECORD_SBoxRecord |
Record type used to box up SMIMEA records. More... | |
struct | GNUNET_GNSRECORD_ReverseRecord |
Record type used internally to keep track of reverse mappings into a namespace. More... | |
struct | GNUNET_GNSRECORD_PowP |
Struct for a proof of work as part of the revocation. More... | |
struct | GNUNET_GNSRECORD_SignaturePurposePS |
The signature object we use for the PoW. More... | |
Macros | |
#define | GNUNET_GNS_EMPTY_LABEL_AT "@" |
String we use to indicate an empty label (top-level entry in the zone). More... | |
#define | GNUNET_GNSRECORD_MAX_BLOCK_SIZE (63 * 1024) |
Maximum size of a value that can be stored in a GNS block. More... | |
#define | GNUNET_GNSRECORD_TYPE_ANY 0 |
Record type indicating any record/'*'. More... | |
#define | GNUNET_GNSRECORD_RF_RCMP_FLAGS (GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION) |
Include the record types generated from GANA. More... | |
#define | GNUNET_MAX_POW_SIZE |
Maximum length of a revocation. More... | |
#define | POW_COUNT 32 |
The proof-of-work narrowing factor. More... | |
Typedefs | |
typedef void(* | GNUNET_GNSRECORD_RecordCallback) (void *cls, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd) |
Process a records that were decrypted from a block. More... | |
Enumerations | |
enum | GNUNET_GNSRECORD_Flags { GNUNET_GNSRECORD_RF_NONE = 0 , GNUNET_GNSRECORD_RF_CRITICAL = 1 << (15 - 15) , GNUNET_GNSRECORD_RF_SHADOW = 1 << (15 - 14) , GNUNET_GNSRECORD_RF_SUPPLEMENTAL = 1 << (15 - 13) , GNUNET_GNSRECORD_RF_MAINTENANCE = 1 << (15 - 2) , GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION = 1 << (15 - 1) , GNUNET_GNSRECORD_RF_PRIVATE = 1 << (15 - 0) } |
Flags that can be set for a record. More... | |
enum | GNUNET_GNSRECORD_Filter { GNUNET_GNSRECORD_FILTER_NONE = 0 , GNUNET_GNSRECORD_FILTER_INCLUDE_MAINTENANCE = 1 , GNUNET_GNSRECORD_FILTER_OMIT_PRIVATE = 2 } |
Filter for GNUNET_GNSRECORD_normalize_record_set(). More... | |
Functions | |
struct GNUNET_JSON_Specification | GNUNET_GNSRECORD_JSON_spec_gnsrecord (struct GNUNET_GNSRECORD_Data **rd, unsigned int *rd_count, char **name) |
JSON Specification for GNS Records. More... | |
json_t * | GNUNET_GNSRECORD_JSON_from_gnsrecord (const char *rname, const struct GNUNET_GNSRECORD_Data *rd, unsigned int rd_count) |
Convert GNS record to JSON. More... | |
char * | GNUNET_GNSRECORD_value_to_string (uint32_t type, const void *data, size_t data_size) |
Convert the binary value data of a record of type type to a human-readable string. More... | |
int | GNUNET_GNSRECORD_string_to_value (uint32_t type, const char *s, void **data, size_t *data_size) |
Convert human-readable version of the value s of a record of type type to the respective binary representation. More... | |
uint32_t | GNUNET_GNSRECORD_typename_to_number (const char *dns_typename) |
Convert a type name (e.g. More... | |
const char * | GNUNET_GNSRECORD_number_to_typename (uint32_t type) |
Convert a type number to the corresponding type string (e.g. More... | |
ssize_t | GNUNET_GNSRECORD_records_get_size (unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd) |
Calculate how many bytes we will need to serialize the given records. More... | |
ssize_t | GNUNET_GNSRECORD_records_serialize (unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd, size_t dest_size, char *dest) |
Serialize the given records to the given destination buffer. More... | |
unsigned int | GNUNET_GNSRECORD_records_deserialize_get_size (size_t len, const char *src) |
int | GNUNET_GNSRECORD_records_deserialize (size_t len, const char *src, unsigned int rd_count, struct GNUNET_GNSRECORD_Data *dest) |
Deserialize the given records to the given destination. More... | |
int | GNUNET_GNSRECORD_is_expired (const struct GNUNET_GNSRECORD_Data *rd) |
Test if a given record is expired. More... | |
char * | GNUNET_GNSRECORD_string_normalize (const char *src) |
Normalize a UTF-8 string to a GNS name. More... | |
const char * | GNUNET_GNSRECORD_z2s (const struct GNUNET_CRYPTO_PublicKey *z) |
Convert a zone to a string (for printing debug messages). More... | |
const char * | GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_CRYPTO_PublicKey *pkey) |
Convert public key to the respective absolute domain name in the ".zkey" pTLD. More... | |
int | GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey, struct GNUNET_CRYPTO_PublicKey *pkey) |
Convert an absolute domain name to the respective public key. More... | |
void | GNUNET_GNSRECORD_query_from_private_key (const struct GNUNET_CRYPTO_PrivateKey *zone, const char *label, struct GNUNET_HashCode *query) |
Calculate the DHT query for a given label in a given zone. More... | |
void | GNUNET_GNSRECORD_query_from_public_key (const struct GNUNET_CRYPTO_PublicKey *pub, const char *label, struct GNUNET_HashCode *query) |
Calculate the DHT query for a given label in a given zone. More... | |
ssize_t | GNUNET_GNSRECORD_block_calculate_size (const struct GNUNET_CRYPTO_PrivateKey *key, const struct GNUNET_GNSRECORD_Data *rd, unsigned int rd_count) |
Get size of buffer for block creation. More... | |
enum GNUNET_GenericReturnValue | GNUNET_GNSRECORD_block_sign (const struct GNUNET_CRYPTO_PrivateKey *key, const char *label, struct GNUNET_GNSRECORD_Block *block) |
Sign a block create with GNUNET_GNSRECORD_block_create_unsigned. More... | |
enum GNUNET_GenericReturnValue | GNUNET_GNSRECORD_block_create (const struct GNUNET_CRYPTO_PrivateKey *key, struct GNUNET_TIME_Absolute expire, const char *label, const struct GNUNET_GNSRECORD_Data *rd, unsigned int rd_count, struct GNUNET_GNSRECORD_Block **block) |
Sign name and records. More... | |
enum GNUNET_GenericReturnValue | GNUNET_GNSRECORD_block_create_unsigned (const struct GNUNET_CRYPTO_PrivateKey *key, struct GNUNET_TIME_Absolute expire, const char *label, const struct GNUNET_GNSRECORD_Data *rd, unsigned int rd_count, struct GNUNET_GNSRECORD_Block **result) |
Create name and records but do not sign! Sign later with GNUNET_GNSRECORD_block_sign(). More... | |
enum GNUNET_GenericReturnValue | GNUNET_GNSRECORD_block_create2 (const struct GNUNET_CRYPTO_PrivateKey *key, struct GNUNET_TIME_Absolute expire, const char *label, const struct GNUNET_GNSRECORD_Data *rd, unsigned int rd_count, struct GNUNET_GNSRECORD_Block **result) |
Sign name and records, cache derived public key (also keeps the private key in static memory, so do not use this function if keeping the private key in the process'es RAM is a major issue). More... | |
enum GNUNET_GenericReturnValue | GNUNET_GNSRECORD_block_verify (const struct GNUNET_GNSRECORD_Block *block) |
Check if a signature is valid. More... | |
enum GNUNET_GenericReturnValue | GNUNET_GNSRECORD_block_decrypt (const struct GNUNET_GNSRECORD_Block *block, const struct GNUNET_CRYPTO_PublicKey *zone_key, const char *label, GNUNET_GNSRECORD_RecordCallback proc, void *proc_cls) |
Decrypt block. More... | |
enum GNUNET_GenericReturnValue | GNUNET_GNSRECORD_records_cmp (const struct GNUNET_GNSRECORD_Data *a, const struct GNUNET_GNSRECORD_Data *b) |
Compares if two records are equal. More... | |
struct GNUNET_TIME_Absolute | GNUNET_GNSRECORD_record_get_expiration_time (unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd, struct GNUNET_TIME_Absolute min) |
Returns the expiration time of the given block of records. More... | |
size_t | GNUNET_GNSRECORD_block_get_size (const struct GNUNET_GNSRECORD_Block *block) |
Returns the length of this block in bytes. More... | |
struct GNUNET_TIME_Absolute | GNUNET_GNSRECORD_block_get_expiration (const struct GNUNET_GNSRECORD_Block *block) |
Returns the expiration of a block. More... | |
enum GNUNET_GenericReturnValue | GNUNET_GNSRECORD_query_from_block (const struct GNUNET_GNSRECORD_Block *block, struct GNUNET_HashCode *query) |
Builds the query hash from a block. More... | |
enum GNUNET_GenericReturnValue | GNUNET_GNSRECORD_identity_from_data (const char *data, size_t data_size, uint32_t type, struct GNUNET_CRYPTO_PublicKey *key) |
Build a #GNUNET_GNSRECORD_PublicKey from zone delegation resource record data. More... | |
enum GNUNET_GenericReturnValue | GNUNET_GNSRECORD_data_from_identity (const struct GNUNET_CRYPTO_PublicKey *key, char **data, size_t *data_size, uint32_t *type) |
Create record data and size from an identity key. More... | |
enum GNUNET_GenericReturnValue | GNUNET_GNSRECORD_is_zonekey_type (uint32_t type) |
Check if this type is one of the supported GNS zone types. More... | |
enum GNUNET_GenericReturnValue | GNUNET_GNSRECORD_is_critical (uint32_t type) |
Check if this type is a critical record. More... | |
enum GNUNET_GenericReturnValue | GNUNET_GNSRECORD_normalize_record_set (const char *label, const struct GNUNET_GNSRECORD_Data *rd, unsigned int rd_count, struct GNUNET_GNSRECORD_Data *rd_public, unsigned int *rd_count_public, struct GNUNET_TIME_Absolute *min_expiry, enum GNUNET_GNSRECORD_Filter filter, char **emsg) |
Normalize namestore records: Check for consistency and expirations. More... | |
enum GNUNET_GenericReturnValue | GNUNET_GNSRECORD_label_check (const char *label, char **emsg) |
Check label for invalid characters. More... | |
enum GNUNET_GenericReturnValue | GNUNET_GNSRECORD_check_pow (const struct GNUNET_GNSRECORD_PowP *pow, unsigned int matching_bits, struct GNUNET_TIME_Relative epoch_duration) |
Check if the given proof-of-work is valid. More... | |
void | GNUNET_GNSRECORD_pow_init (const struct GNUNET_CRYPTO_PrivateKey *key, struct GNUNET_GNSRECORD_PowP *pow) |
Initializes a fresh PoW computation. More... | |
struct GNUNET_GNSRECORD_PowCalculationHandle * | GNUNET_GNSRECORD_pow_start (struct GNUNET_GNSRECORD_PowP *pow, int epochs, unsigned int difficulty) |
Starts a proof-of-work calculation given the pow object as well as target epochs and difficulty. More... | |
enum GNUNET_GenericReturnValue | GNUNET_GNSRECORD_pow_round (struct GNUNET_GNSRECORD_PowCalculationHandle *pc) |
Calculate a single round in the key revocation PoW. More... | |
size_t | GNUNET_GNSRECORD_proof_get_size (const struct GNUNET_GNSRECORD_PowP *pow) |
void | GNUNET_GNSRECORD_pow_stop (struct GNUNET_GNSRECORD_PowCalculationHandle *pc) |
Stop a PoW calculation. More... | |
Manipulate GNS record data.
#define GNUNET_GNS_EMPTY_LABEL_AT "@" |
String we use to indicate an empty label (top-level entry in the zone).
DNS uses "@", so do we.
Definition at line 55 of file gnunet_gnsrecord_lib.h.
#define GNUNET_GNSRECORD_MAX_BLOCK_SIZE (63 * 1024) |
Maximum size of a value that can be stored in a GNS block.
Definition at line 60 of file gnunet_gnsrecord_lib.h.
#define GNUNET_GNSRECORD_TYPE_ANY 0 |
Record type indicating any record/'*'.
Definition at line 66 of file gnunet_gnsrecord_lib.h.
#define GNUNET_GNSRECORD_RF_RCMP_FLAGS (GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION) |
Include the record types generated from GANA.
When comparing flags for record equality for removal, which flags should must match (in addition to the type, name, expiration value and data of the record)? All flags that are not listed here will be ignored for this purpose. (for example, we don't expect that users will remember to pass the '–private' option when removing a record from the namestore, hence we don't require this particular option to match upon removal). See also GNUNET_GNSRECORD_records_cmp.
Definition at line 84 of file gnunet_gnsrecord_lib.h.
#define GNUNET_MAX_POW_SIZE |
Maximum length of a revocation.
Definition at line 864 of file gnunet_gnsrecord_lib.h.
#define POW_COUNT 32 |
The proof-of-work narrowing factor.
The number of PoWs that are calculates as part of revocation.
Definition at line 872 of file gnunet_gnsrecord_lib.h.
typedef void(* GNUNET_GNSRECORD_RecordCallback) (void *cls, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd) |
Process a records that were decrypted from a block.
cls | closure |
rd_count | number of entries in rd array |
rd | array of records with data to store |
Definition at line 389 of file gnunet_gnsrecord_lib.h.
Flags that can be set for a record.
The numbers in the registry correspond to the bit index as specified in LSD0001 Chapter "Resource Records". Each enum member represents the 16-bit integer value of the flags field if only that particular flag was set. The value can be used to efficiently compare the bitmask setting for the record flag in C. WARNING: The values are in host byte order! In order to correctly check against the flags field a record, the respective fields must also be converted to HBO (or the enum value to NBO).
Definition at line 99 of file gnunet_gnsrecord_lib.h.
Filter for GNUNET_GNSRECORD_normalize_record_set().
Definition at line 146 of file gnunet_gnsrecord_lib.h.
struct GNUNET_JSON_Specification GNUNET_GNSRECORD_JSON_spec_gnsrecord | ( | struct GNUNET_GNSRECORD_Data ** | rd, |
unsigned int * | rd_count, | ||
char ** | name | ||
) |
JSON Specification for GNS Records.
gnsrecord_object | struct of GNUNET_GNSRECORD_Data to fill |
Definition at line 284 of file json_gnsrecord.c.
References clean_gnsrecordobject(), GNUNET_new, name, GnsRecordInfo::name, parse_gnsrecordobject(), rd, GnsRecordInfo::rd, rd_count, GnsRecordInfo::rd_count, and ret.
Referenced by bulk_tx_start(), and namestore_add_or_update().
json_t * GNUNET_GNSRECORD_JSON_from_gnsrecord | ( | const char * | rname, |
const struct GNUNET_GNSRECORD_Data * | rd, | ||
unsigned int | rd_count | ||
) |
Convert GNS record to JSON.
rname | name of record |
rd | record data |
Definition at line 313 of file json_gnsrecord.c.
References data, data_size, GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_GNSRECORD_number_to_typename(), GNUNET_GNSRECORD_RF_MAINTENANCE, GNUNET_GNSRECORD_RF_PRIVATE, GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION, GNUNET_GNSRECORD_RF_SHADOW, GNUNET_GNSRECORD_RF_SUPPLEMENTAL, GNUNET_GNSRECORD_value_to_string(), GNUNET_JSON_GNSRECORD_ABSOLUTE_EXPIRATION_TIME, GNUNET_JSON_GNSRECORD_FLAG_MAINTENANCE, GNUNET_JSON_GNSRECORD_FLAG_PRIVATE, GNUNET_JSON_GNSRECORD_FLAG_RELATIVE, GNUNET_JSON_GNSRECORD_FLAG_SHADOW, GNUNET_JSON_GNSRECORD_FLAG_SUPPLEMENTAL, GNUNET_JSON_GNSRECORD_RELATIVE_EXPIRATION_TIME, GNUNET_JSON_GNSRECORD_TYPE, GNUNET_JSON_GNSRECORD_VALUE, GNUNET_log, rd, rd_count, record(), and records.
Referenced by handle_gns_response(), namestore_list_iteration(), and ns_get_lookup_cb().
char * GNUNET_GNSRECORD_value_to_string | ( | uint32_t | type, |
const void * | data, | ||
size_t | data_size | ||
) |
Convert the binary value data of a record of type type to a human-readable string.
type | type of the record |
data | value in binary encoding |
data_size | number of bytes in data |
Convert the binary value data of a record of type type to a human-readable string.
type | type of the record |
data | value in binary encoding |
data_size | number of bytes in data |
Definition at line 155 of file gnsrecord.c.
References GNUNET_TESTING_PluginFunctions::cls, data, data_size, gns_plugins, init(), num_plugins, plugin, ret, and type.
Referenced by check_pkey(), del_monitor(), display_record(), display_records_from_block(), gns_value_to_string(), GNUNET_GNSRECORD_JSON_from_gnsrecord(), GNUNET_GNSRECORD_records_deserialize(), GNUNET_GNSRECORD_records_get_size(), GNUNET_GNSRECORD_records_serialize(), process_lookup_result(), and start_phone().
int GNUNET_GNSRECORD_string_to_value | ( | uint32_t | type, |
const char * | s, | ||
void ** | data, | ||
size_t * | data_size | ||
) |
Convert human-readable version of the value s of a record of type type to the respective binary representation.
type | type of the record |
s | human-readable string |
data | set to value in binary encoding (will be allocated) |
data_size | set to number of bytes in data |
Definition at line 177 of file gnsrecord.c.
References GNUNET_TESTING_PluginFunctions::cls, data, data_size, gns_plugins, GNUNET_OK, GNUNET_SYSERR, init(), num_plugins, plugin, and type.
Referenced by gns_string_to_value(), parse(), parse_record(), parse_recordline(), run(), run_with_zone_pkey(), and store_cb().
uint32_t GNUNET_GNSRECORD_typename_to_number | ( | const char * | dns_typename | ) |
Convert a type name (e.g.
"AAAA") to the corresponding number.
dns_typename | name to convert |
Definition at line 200 of file gnsrecord.c.
References GNUNET_TESTING_PluginFunctions::cls, gns_plugins, GNUNET_GNSRECORD_TYPE_ANY, init(), num_plugins, plugin, and ret.
Referenced by del_monitor(), DID_create_namestore_lookup_cb(), display_record(), get_gns_cont(), namestore_get(), parse(), parse_record(), parse_recordline(), run(), and run_with_zone_pkey().
const char * GNUNET_GNSRECORD_number_to_typename | ( | uint32_t | type | ) |
Convert a type number to the corresponding type string (e.g.
1 to "A")
type | number of a type to convert |
Definition at line 227 of file gnsrecord.c.
References GNUNET_TESTING_PluginFunctions::cls, gns_plugins, GNUNET_GNSRECORD_TYPE_ANY, init(), num_plugins, plugin, ret, and type.
Referenced by display_record(), display_records_from_block(), GNUNET_GNSRECORD_JSON_from_gnsrecord(), parse_recordline(), process_lookup_result(), and run_with_zone_pkey().
ssize_t GNUNET_GNSRECORD_records_get_size | ( | unsigned int | rd_count, |
const struct GNUNET_GNSRECORD_Data * | rd | ||
) |
Calculate how many bytes we will need to serialize the given records.
rd_count | number of records in the rd array |
rd | array of GNUNET_GNSRECORD_Data with rd_count elements |
Efficiently round up to the next power of 2 for padding https://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2
Definition at line 78 of file gnsrecord_serialization.c.
References data, data_size, GNUNET_GNSRECORD_Data::data_size, GNUNET_break, GNUNET_break_op, GNUNET_free, GNUNET_GNSRECORD_TYPE_EDKEY, GNUNET_GNSRECORD_TYPE_PKEY, GNUNET_GNSRECORD_value_to_string(), rd, rd_count, GNUNET_GNSRECORD_Data::record_type, NetworkRecord::record_type, and ret.
Referenced by block_create_ecdsa(), block_create_eddsa(), block_get_size_ecdsa(), block_get_size_eddsa(), consistency_iter(), GNUNET_NAMESTORE_records_store(), handle_zone_to_name_it(), lookup_it(), namestore_postgres_store_records(), namestore_sqlite_store_records(), result_processor(), run_edkey(), run_pkey(), rvk_ticket_update(), send_lookup_response(), send_lookup_response_with_filter(), and store_and_free_entries().
ssize_t GNUNET_GNSRECORD_records_serialize | ( | unsigned int | rd_count, |
const struct GNUNET_GNSRECORD_Data * | rd, | ||
size_t | dest_size, | ||
char * | dest | ||
) |
Serialize the given records to the given destination buffer.
rd_count | number of records in the rd array |
rd | array of GNUNET_GNSRECORD_Data with rd_count elements |
dest_size | size of the destination array dst |
dest | where to write the result |
Definition at line 136 of file gnsrecord_serialization.c.
References data, data_size, GNUNET_GNSRECORD_Data::data_size, NetworkRecord::data_size, warningfilter::dest, NetworkRecord::expiration_time, NetworkRecord::flags, GNUNET_break, GNUNET_break_op, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_GNSRECORD_value_to_string(), GNUNET_htonll(), GNUNET_memcpy, LOG, rd, rd_count, and NetworkRecord::record_type.
Referenced by block_create_ecdsa(), block_create_eddsa(), consistency_iter(), GNUNET_NAMESTORE_records_store(), handle_zone_to_name_it(), lookup_it(), namestore_postgres_store_records(), namestore_sqlite_store_records(), result_processor(), run_edkey(), run_pkey(), rvk_ticket_update(), send_lookup_response(), send_lookup_response_with_filter(), and store_and_free_entries().
unsigned int GNUNET_GNSRECORD_records_deserialize_get_size | ( | size_t | len, |
const char * | src | ||
) |
Definition at line 199 of file gnsrecord_serialization.c.
References NetworkRecord::data_size, GNUNET_break_op, GNUNET_memcmp, GNUNET_memcpy, and rd_count.
Referenced by block_decrypt_ecdsa(), and block_decrypt_eddsa().
int GNUNET_GNSRECORD_records_deserialize | ( | size_t | len, |
const char * | src, | ||
unsigned int | rd_count, | ||
struct GNUNET_GNSRECORD_Data * | dest | ||
) |
Deserialize the given records to the given destination.
len | size of the serialized record data |
src | the serialized record data |
rd_count | number of records in the dest array |
dest | where to put the data |
len | size of the serialized record data |
src | the serialized record data |
rd_count | number of records parsed |
dest | where to put the data |
Definition at line 244 of file gnsrecord_serialization.c.
References data, data_size, NetworkRecord::data_size, warningfilter::dest, NetworkRecord::expiration_time, NetworkRecord::flags, GNUNET_break_op, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_GNSRECORD_value_to_string(), GNUNET_memcpy, GNUNET_ntohll(), GNUNET_OK, GNUNET_SYSERR, LOG, rd_count, and NetworkRecord::record_type.
Referenced by block_decrypt_ecdsa(), block_decrypt_eddsa(), check_rd(), check_result(), continue_store_activity(), database_setup(), get_records_and_call_iterator(), handle_edit_record_set_response(), handle_lookup_result(), handle_record_result(), handle_result(), handle_zone_to_name_response(), parse_result_call_iterator(), process_tickets(), store_record_set(), update_tickets(), and vpn_allocation_cb().
int GNUNET_GNSRECORD_is_expired | ( | const struct GNUNET_GNSRECORD_Data * | rd | ) |
Test if a given record is expired.
rd | record to test |
Definition at line 205 of file gnsrecord_misc.c.
References GNUNET_TIME_Absolute::abs_value_us, GNUNET_GNSRECORD_Data::expiration_time, GNUNET_GNSRECORD_Data::flags, GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION, GNUNET_NO, GNUNET_TIME_absolute_get_remaining(), GNUNET_YES, and rd.
char * GNUNET_GNSRECORD_string_normalize | ( | const char * | src | ) |
Normalize a UTF-8 string to a GNS name.
src | source string |
Definition at line 36 of file gnsrecord_misc.c.
References GNUNET_STRINGS_utf8_normalize().
Referenced by block_create2(), GNUNET_GNSRECORD_block_create(), GNUNET_GNSRECORD_block_decrypt(), GNUNET_GNSRECORD_block_sign(), GNUNET_GNSRECORD_query_from_private_key(), GNUNET_GNSRECORD_query_from_public_key(), handle_edit_record_set(), handle_edit_record_set_cancel(), handle_record_lookup(), run_edkey(), run_pkey(), and store_record_set().
const char * GNUNET_GNSRECORD_z2s | ( | const struct GNUNET_CRYPTO_PublicKey * | z | ) |
Convert a zone to a string (for printing debug messages).
This is one of the very few calls in the entire API that is NOT reentrant!
z | public key of a zone |
Definition at line 61 of file gnsrecord_misc.c.
References end, GNUNET_break, and GNUNET_STRINGS_data_to_string().
Referenced by get_nick_record(), handle_gns_resolution_result(), handle_namecache_block_response(), handle_revocation_result(), namestore_flat_zone_to_name(), namestore_sqlite_store_records(), namestore_sqlite_zone_to_name(), recursive_gns_resolution_namecache(), and recursive_gns_resolution_revocation().
const char * GNUNET_GNSRECORD_pkey_to_zkey | ( | const struct GNUNET_CRYPTO_PublicKey * | pkey | ) |
Convert public key to the respective absolute domain name in the ".zkey" pTLD.
This is one of the very few calls in the entire API that is NOT reentrant!
pkey | a public key with a point on the elliptic curve |
This is one of the very few calls in the entire API that is NOT reentrant!
pkey | a public key with a point on the elliptic curve |
Definition at line 228 of file gnsrecord_misc.c.
References GNUNET_CRYPTO_public_key_to_string(), GNUNET_free, GNUNET_snprintf(), pkey, and ret.
Referenced by caller_event_handler(), do_accept(), do_call(), do_resume(), do_status(), handle_phone_hangup(), phone_event_handler(), and translate_dot_plus().
int GNUNET_GNSRECORD_zkey_to_pkey | ( | const char * | zkey, |
struct GNUNET_CRYPTO_PublicKey * | pkey | ||
) |
Convert an absolute domain name to the respective public key.
zkey | string "X" where X is the public key in an encoding suitable for DNS labels. |
pkey | set to a public key on the elliptic curve |
zkey | string encoding the coordinates of the public key in an encoding suitable for DNS labels. |
pkey | set to a public key on the elliptic curve |
Definition at line 253 of file gnsrecord_misc.c.
References GNUNET_CRYPTO_public_key_from_string(), GNUNET_OK, GNUNET_SYSERR, and pkey.
Referenced by GNS_find_tld(), handle_gns_redirect_result(), and recursive_gns2dns_resolution().
void GNUNET_GNSRECORD_query_from_private_key | ( | const struct GNUNET_CRYPTO_PrivateKey * | zone, |
const char * | label, | ||
struct GNUNET_HashCode * | query | ||
) |
Calculate the DHT query for a given label in a given zone.
zone | private key of the zone |
label | label of the record |
query | hash to use for the query |
Definition at line 1025 of file gnsrecord_crypto.c.
References GNUNET_assert, GNUNET_CRYPTO_key_get_public(), GNUNET_free, GNUNET_GNSRECORD_query_from_public_key(), GNUNET_GNSRECORD_string_normalize(), GNUNET_GNSRECORD_TYPE_EDKEY, GNUNET_GNSRECORD_TYPE_PKEY, pub, and GNUNET_CRYPTO_PrivateKey::type.
Referenced by initiate_put_from_pipe_trigger().
void GNUNET_GNSRECORD_query_from_public_key | ( | const struct GNUNET_CRYPTO_PublicKey * | pub, |
const char * | label, | ||
struct GNUNET_HashCode * | query | ||
) |
Calculate the DHT query for a given label in a given zone.
FIXME: We may want to plugin-ize this at some point.
pub | public key of the zone |
label | label of the record |
query | hash to use for the query |
Definition at line 1053 of file gnsrecord_crypto.c.
References GNUNET_CRYPTO_PublicKey::ecdsa_key, GNUNET_CRYPTO_PublicKey::eddsa_key, GNUNET_assert, GNUNET_CRYPTO_ecdsa_public_key_derive(), GNUNET_CRYPTO_eddsa_public_key_derive(), GNUNET_CRYPTO_hash(), GNUNET_free, GNUNET_GNSRECORD_string_normalize(), GNUNET_GNSRECORD_TYPE_EDKEY, GNUNET_GNSRECORD_TYPE_PKEY, pub, and GNUNET_CRYPTO_PublicKey::type.
Referenced by GNUNET_GNSRECORD_query_from_private_key(), handle_namecache_block_response(), recursive_gns_resolution_namecache(), run(), run_edkey(), and run_pkey().
ssize_t GNUNET_GNSRECORD_block_calculate_size | ( | const struct GNUNET_CRYPTO_PrivateKey * | key, |
const struct GNUNET_GNSRECORD_Data * | rd, | ||
unsigned int | rd_count | ||
) |
Get size of buffer for block creation.
key | the zone key |
rd | record data |
rd_count | number of records |
Definition at line 512 of file gnsrecord_crypto.c.
References block_get_size_ecdsa(), block_get_size_eddsa(), GNUNET_assert, GNUNET_CRYPTO_key_get_public(), GNUNET_GNSRECORD_TYPE_EDKEY, GNUNET_GNSRECORD_TYPE_PKEY, key, pkey, rd, rd_count, and res.
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_block_sign | ( | const struct GNUNET_CRYPTO_PrivateKey * | key, |
const char * | label, | ||
struct GNUNET_GNSRECORD_Block * | block | ||
) |
Sign a block create with GNUNET_GNSRECORD_block_create_unsigned.
key | the private key |
label | the label of the block |
block | the unsigned block |
Definition at line 275 of file gnsrecord_crypto.c.
References block_sign_ecdsa(), block_sign_eddsa(), GNUNET_assert, GNUNET_CRYPTO_key_get_public(), GNUNET_free, GNUNET_GNSRECORD_string_normalize(), GNUNET_GNSRECORD_TYPE_EDKEY, GNUNET_GNSRECORD_TYPE_PKEY, GNUNET_SYSERR, key, pkey, and res.
Referenced by sign_worker().
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_block_create | ( | const struct GNUNET_CRYPTO_PrivateKey * | key, |
struct GNUNET_TIME_Absolute | expire, | ||
const char * | label, | ||
const struct GNUNET_GNSRECORD_Data * | rd, | ||
unsigned int | rd_count, | ||
struct GNUNET_GNSRECORD_Block ** | block | ||
) |
Sign name and records.
key | the private key |
expire | block expiration |
label | the name for the records |
rd | record data |
rd_count | number of records in rd |
result | the block buffer. Will be allocated. |
Definition at line 539 of file gnsrecord_crypto.c.
References block_create_ecdsa(), block_create_eddsa(), expire, GNUNET_assert, GNUNET_CRYPTO_key_get_public(), GNUNET_free, GNUNET_GNSRECORD_string_normalize(), GNUNET_GNSRECORD_TYPE_EDKEY, GNUNET_GNSRECORD_TYPE_PKEY, GNUNET_SYSERR, GNUNET_YES, key, pkey, rd, rd_count, res, and result.
Referenced by run_edkey(), and run_pkey().
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_block_create_unsigned | ( | const struct GNUNET_CRYPTO_PrivateKey * | key, |
struct GNUNET_TIME_Absolute | expire, | ||
const char * | label, | ||
const struct GNUNET_GNSRECORD_Data * | rd, | ||
unsigned int | rd_count, | ||
struct GNUNET_GNSRECORD_Block ** | result | ||
) |
Create name and records but do not sign! Sign later with GNUNET_GNSRECORD_block_sign().
Cache derived public key (also keeps the private key in static memory, so do not use this function if keeping the private key in the process'es RAM is a major issue).
key | the private key |
expire | block expiration |
label | the name for the records |
rd | record data |
rd_count | number of records in rd |
result | the block buffer. Will be allocated. |
Definition at line 663 of file gnsrecord_crypto.c.
References block_create2(), expire, GNUNET_NO, pkey, rd, rd_count, and result.
Referenced by dispatch_job(), and dispatch_job_monitor().
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_block_create2 | ( | const struct GNUNET_CRYPTO_PrivateKey * | key, |
struct GNUNET_TIME_Absolute | expire, | ||
const char * | label, | ||
const struct GNUNET_GNSRECORD_Data * | rd, | ||
unsigned int | rd_count, | ||
struct GNUNET_GNSRECORD_Block ** | result | ||
) |
Sign name and records, cache derived public key (also keeps the private key in static memory, so do not use this function if keeping the private key in the process'es RAM is a major issue).
key | the private key |
expire | block expiration |
label | the name for the records |
rd | record data |
rd_count | number of records in rd |
result | the block buffer. Will be allocated. |
Definition at line 676 of file gnsrecord_crypto.c.
References block_create2(), expire, GNUNET_YES, pkey, rd, rd_count, and result.
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_block_verify | ( | const struct GNUNET_GNSRECORD_Block * | block | ) |
Check if a signature is valid.
This API is used by the GNS Block to validate signatures received from the network.
block | block to verify |
Definition at line 695 of file gnsrecord_crypto.c.
References GNUNET_GNSRECORD_EcdsaBlock::derived_key, GNUNET_GNSRECORD_EddsaBlock::derived_key, GNUNET_GNSRECORD_Block::ecdsa_block, GNUNET_GNSRECORD_Block::eddsa_block, GNUNET_GNSRECORD_EcdsaBlock::expiration_time, GNUNET_GNSRECORD_EddsaBlock::expiration_time, GNRBlockPS::expiration_time, GNUNET_CRYPTO_ecdsa_verify_(), GNUNET_CRYPTO_eddsa_verify_(), GNUNET_free, GNUNET_GNSRECORD_TYPE_EDKEY, GNUNET_GNSRECORD_TYPE_PKEY, GNUNET_malloc, GNUNET_memcpy, GNUNET_NO, GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN, GNUNET_CRYPTO_EccSignaturePurpose::purpose, GNRBlockPS::purpose, res, GNUNET_GNSRECORD_EcdsaBlock::signature, GNUNET_GNSRECORD_EddsaBlock::signature, GNUNET_CRYPTO_EccSignaturePurpose::size, GNUNET_GNSRECORD_Block::size, and GNUNET_GNSRECORD_Block::type.
Referenced by block_plugin_gns_check_block(), and handle_lookup_block_response().
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_block_decrypt | ( | const struct GNUNET_GNSRECORD_Block * | block, |
const struct GNUNET_CRYPTO_PublicKey * | zone_key, | ||
const char * | label, | ||
GNUNET_GNSRECORD_RecordCallback | proc, | ||
void * | proc_cls | ||
) |
Decrypt block.
block | block to decrypt |
zone_key | public key of the zone |
label | the name for the records |
proc | function to call with the result |
proc_cls | closure for proc |
Definition at line 986 of file gnsrecord_crypto.c.
References block_decrypt_ecdsa(), block_decrypt_eddsa(), GNUNET_CRYPTO_PublicKey::ecdsa_key, GNUNET_CRYPTO_PublicKey::eddsa_key, GNUNET_free, GNUNET_GNSRECORD_string_normalize(), GNUNET_PUBLIC_KEY_TYPE_ECDSA, GNUNET_PUBLIC_KEY_TYPE_EDDSA, GNUNET_SYSERR, res, and GNUNET_CRYPTO_PublicKey::type.
Referenced by handle_block(), handle_dht_response(), and handle_namecache_block_response().
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_records_cmp | ( | const struct GNUNET_GNSRECORD_Data * | a, |
const struct GNUNET_GNSRECORD_Data * | b | ||
) |
Compares if two records are equal.
a | a record |
b | another record |
Compares if two records are equal.
absolute expiration time).
a | record |
b | record |
Definition at line 90 of file gnsrecord_misc.c.
References GNUNET_GNSRECORD_Data::data, GNUNET_GNSRECORD_Data::data_size, GNUNET_GNSRECORD_Data::expiration_time, GNUNET_GNSRECORD_Data::flags, GNUNET_ERROR_TYPE_DEBUG, GNUNET_GNSRECORD_RF_RCMP_FLAGS, GNUNET_NO, GNUNET_YES, LOG, and GNUNET_GNSRECORD_Data::record_type.
struct GNUNET_TIME_Absolute GNUNET_GNSRECORD_record_get_expiration_time | ( | unsigned int | rd_count, |
const struct GNUNET_GNSRECORD_Data * | rd, | ||
struct GNUNET_TIME_Absolute | min | ||
) |
Returns the expiration time of the given block of records.
The block expiration time is the expiration time of the record with smallest expiration time.
rd_count | number of records given in rd |
rd | array of records |
min | minimum expiration time |
Definition at line 140 of file gnsrecord_misc.c.
References GNUNET_TIME_Absolute::abs_value_us, GNUNET_GNSRECORD_Data::expiration_time, expire, GNUNET_ERROR_TYPE_DEBUG, GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION, GNUNET_GNSRECORD_RF_SHADOW, GNUNET_STRINGS_absolute_time_to_string(), GNUNET_TIME_absolute_max(), GNUNET_TIME_absolute_min(), GNUNET_TIME_relative_to_absolute(), GNUNET_TIME_UNIT_FOREVER_ABS, GNUNET_TIME_UNIT_ZERO_ABS, LOG, min, rd, rd_count, and GNUNET_TIME_Relative::rel_value_us.
Referenced by GNUNET_GNSRECORD_normalize_record_set(), process_lookup_result(), run_edkey(), and run_pkey().
size_t GNUNET_GNSRECORD_block_get_size | ( | const struct GNUNET_GNSRECORD_Block * | block | ) |
Returns the length of this block in bytes.
Block length strongly depends on the zone type.
block | the block. |
Definition at line 327 of file gnsrecord_misc.c.
References GNUNET_GNSRECORD_Block::size.
Referenced by block_plugin_gns_check_block(), block_plugin_gns_check_reply(), dispatch_job(), dispatch_job_monitor(), GNUNET_NAMECACHE_block_cache(), handle_dht_response(), handle_lookup_block_it(), namecache_cache_block(), namecache_postgres_cache_block(), namecache_sqlite_cache_block(), and store_and_free_entries().
struct GNUNET_TIME_Absolute GNUNET_GNSRECORD_block_get_expiration | ( | const struct GNUNET_GNSRECORD_Block * | block | ) |
Returns the expiration of a block.
block | the block. |
Definition at line 334 of file gnsrecord_misc.c.
References GNUNET_break, GNUNET_GNSRECORD_TYPE_EDKEY, GNUNET_GNSRECORD_TYPE_PKEY, GNUNET_TIME_absolute_get_zero_(), and GNUNET_TIME_absolute_ntoh().
Referenced by expire_blocks(), handle_dht_response(), handle_lookup_block_it(), handle_namecache_block_response(), namecache_postgres_cache_block(), and namecache_sqlite_cache_block().
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_query_from_block | ( | const struct GNUNET_GNSRECORD_Block * | block, |
struct GNUNET_HashCode * | query | ||
) |
Builds the query hash from a block.
block | the block. |
query | where to write the query hash. |
Definition at line 353 of file gnsrecord_misc.c.
References GNUNET_GNSRECORD_EcdsaBlock::derived_key, GNUNET_GNSRECORD_EddsaBlock::derived_key, GNUNET_GNSRECORD_Block::ecdsa_block, GNUNET_GNSRECORD_Block::eddsa_block, GNUNET_CRYPTO_hash(), GNUNET_GNSRECORD_TYPE_EDKEY, GNUNET_GNSRECORD_TYPE_PKEY, GNUNET_OK, GNUNET_SYSERR, and GNUNET_GNSRECORD_Block::type.
Referenced by block_plugin_gns_get_key(), namecache_cache_block(), namecache_postgres_cache_block(), and namecache_sqlite_cache_block().
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_identity_from_data | ( | const char * | data, |
size_t | data_size, | ||
uint32_t | type, | ||
struct GNUNET_CRYPTO_PublicKey * | key | ||
) |
Build a #GNUNET_GNSRECORD_PublicKey from zone delegation resource record data.
data | the record data- |
data_size | the data size. |
type | the record type |
key | the identity key to store the data in (must be allocated). |
Definition at line 265 of file gnsrecord_misc.c.
References data, data_size, GNUNET_GNSRECORD_is_zonekey_type(), GNUNET_GNSRECORD_TYPE_EDKEY, GNUNET_GNSRECORD_TYPE_PKEY, GNUNET_NO, GNUNET_SYSERR, GNUNET_YES, key, and type.
Referenced by check_pkey(), gns_value_to_string(), handle_gns_resolution_result(), namestore_postgres_store_records(), namestore_sqlite_store_records(), and recursive_pkey_resolution().
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_data_from_identity | ( | const struct GNUNET_CRYPTO_PublicKey * | key, |
char ** | data, | ||
size_t * | data_size, | ||
uint32_t * | type | ||
) |
Create record data and size from an identity key.
key | the identity key to use. |
data | the record data (will be allocated) |
data_size | the allocated data size. |
type | the resulting record type |
Definition at line 294 of file gnsrecord_misc.c.
References data, data_size, GNUNET_CRYPTO_public_key_get_length(), GNUNET_malloc, GNUNET_OK, GNUNET_SYSERR, key, and type.
Referenced by gns_string_to_value().
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_is_zonekey_type | ( | uint32_t | type | ) |
Check if this type is one of the supported GNS zone types.
type | the type to check |
Definition at line 313 of file gnsrecord_misc.c.
References GNUNET_GNSRECORD_TYPE_EDKEY, GNUNET_GNSRECORD_TYPE_PKEY, GNUNET_NO, GNUNET_YES, and type.
Referenced by GNUNET_GNSRECORD_identity_from_data(), GNUNET_GNSRECORD_normalize_record_set(), namestore_postgres_store_records(), namestore_sqlite_store_records(), and zone_to_name().
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_is_critical | ( | uint32_t | type | ) |
Check if this type is a critical record.
type | the type to check |
Definition at line 247 of file gnsrecord.c.
References GNUNET_TESTING_PluginFunctions::cls, gns_plugins, GNUNET_GNSRECORD_TYPE_ANY, GNUNET_NO, GNUNET_YES, init(), num_plugins, plugin, and type.
Referenced by GNUNET_GNSRECORD_normalize_record_set(), and handle_gns_resolution_result().
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_normalize_record_set | ( | const char * | label, |
const struct GNUNET_GNSRECORD_Data * | rd, | ||
unsigned int | rd_count, | ||
struct GNUNET_GNSRECORD_Data * | rd_public, | ||
unsigned int * | rd_count_public, | ||
struct GNUNET_TIME_Absolute * | min_expiry, | ||
enum GNUNET_GNSRECORD_Filter | filter, | ||
char ** | emsg | ||
) |
Normalize namestore records: Check for consistency and expirations.
Purge expired records. Returns a "clean" record set. Also returns the minimum expiration time this block should be published under. Also checks rules with respect to labels (e.g. no delegations under the empty label)
label | the label under which this set (supposed to be) stored. |
rd | input records |
rd_count | size of the rd and rd_public arrays |
rd_public | where to write the converted records |
rd_count_public | number of records written to rd_public |
min_expiry | the minimum expiration of this set |
filter | the record set filter, see GNUNET_GNSRECORD_Filter. |
emsg | the error message if something went wrong |
Check for delegation and redirect consistency. Note that we check for consistency BEFORE we filter for private records ON PURPOSE. We also want consistent record sets in our local zone(s). The only exception is the tombstone (above) which we ignore for the consistency check(s). FIXME: What about shadow records? Should we ignore them?
Definition at line 377 of file gnsrecord_misc.c.
References _, GNUNET_TIME_Absolute::abs_value_us, filter, GNUNET_GNSRECORD_Data::flags, GNUNET_ERROR_TYPE_DEBUG, GNUNET_GNS_EMPTY_LABEL_AT, GNUNET_GNSRECORD_FILTER_INCLUDE_MAINTENANCE, GNUNET_GNSRECORD_FILTER_OMIT_PRIVATE, GNUNET_GNSRECORD_is_critical(), GNUNET_GNSRECORD_is_zonekey_type(), GNUNET_GNSRECORD_record_get_expiration_time(), GNUNET_GNSRECORD_RF_CRITICAL, GNUNET_GNSRECORD_RF_MAINTENANCE, GNUNET_GNSRECORD_RF_PRIVATE, GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION, GNUNET_GNSRECORD_TYPE_GNS2DNS, GNUNET_GNSRECORD_TYPE_NICK, GNUNET_GNSRECORD_TYPE_REDIRECT, GNUNET_log, GNUNET_NO, GNUNET_OK, GNUNET_strdup, GNUNET_SYSERR, GNUNET_TIME_absolute_get(), GNUNET_TIME_UNIT_ZERO_ABS, GNUNET_YES, rd, and rd_count.
Referenced by dispatch_job(), dispatch_job_monitor(), get_existing_rd_exp(), lookup_it(), send_lookup_response_with_filter(), and store_record_set().
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_label_check | ( | const char * | label, |
char ** | emsg | ||
) |
Check label for invalid characters.
label | the label to check |
emsg | an error message (NULL if label is valid). Will be allocated. |
Definition at line 44 of file gnsrecord_misc.c.
References _, GNUNET_NO, GNUNET_OK, and GNUNET_strdup.
Referenced by store_record_set().
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_check_pow | ( | const struct GNUNET_GNSRECORD_PowP * | pow, |
unsigned int | difficulty, | ||
struct GNUNET_TIME_Relative | epoch_duration | ||
) |
Check if the given proof-of-work is valid.
pow | proof of work |
matching_bits | how many bits must match (configuration) |
epoch_duration | length of single epoch in configuration |
pow | proof of work |
difficulty | how many bits must match (configuration) LSD0001: D |
epoch_duration | length of single epoch in configuration |
Check if signature valid
First, check if PoW set is strictly monotically increasing
Check expiration
Extend by 10% for unsynchronized clocks
Definition at line 165 of file gnsrecord_pow.c.
References check_signature(), epoch_duration, epochs, GNUNET_ALIGN, GNUNET_break, GNUNET_CRYPTO_hash_count_leading_zeros(), GNUNET_CRYPTO_pow_hash(), GNUNET_CRYPTO_public_key_get_length(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_memcpy, GNUNET_NO, GNUNET_ntohll(), GNUNET_OK, GNUNET_SYSERR, GNUNET_TIME_absolute_add(), GNUNET_TIME_absolute_get_remaining(), GNUNET_TIME_absolute_ntoh(), GNUNET_TIME_relative_divide(), GNUNET_TIME_relative_multiply(), GNUNET_YES, pk, GNUNET_GNSRECORD_PowP::pow, POW_COUNT, result, salt, GNUNET_GNSRECORD_PowP::timestamp, and ttl.
Referenced by block_plugin_revocation_check_block(), ego_callback(), GNUNET_REVOCATION_revoke(), run(), run_with_key(), and verify_revoke_message().
void GNUNET_GNSRECORD_pow_init | ( | const struct GNUNET_CRYPTO_PrivateKey * | key, |
struct GNUNET_GNSRECORD_PowP * | pow | ||
) |
Initializes a fresh PoW computation.
key | the key to calculate the PoW for. | |
pow | the pow object to work with in the calculation. | |
key | the key to calculate the PoW for. | |
[out] | pow | starting point for PoW calculation (not yet valid) |
Definition at line 318 of file gnsrecord_pow.c.
References GNUNET_assert, GNUNET_OK, key, and sign_pow().
Referenced by ego_callback(), and run_with_key().
struct GNUNET_GNSRECORD_PowCalculationHandle * GNUNET_GNSRECORD_pow_start | ( | struct GNUNET_GNSRECORD_PowP * | pow, |
int | epochs, | ||
unsigned int | difficulty | ||
) |
Starts a proof-of-work calculation given the pow object as well as target epochs and difficulty.
pow | the PoW to based calculations on. |
epochs | the number of epochs for which the PoW must be valid. |
difficulty | the base difficulty of the PoW. |
Definition at line 326 of file gnsrecord_pow.c.
References epochs, GNUNET_CRYPTO_QUALITY_WEAK, GNUNET_CRYPTO_random_u64(), GNUNET_new, GNUNET_TIME_relative_hton(), GNUNET_TIME_relative_multiply(), GNUNET_TIME_UNIT_YEARS, pc, and ttl.
Referenced by ego_callback(), run(), and run_with_key().
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_pow_round | ( | struct GNUNET_GNSRECORD_PowCalculationHandle * | pc | ) |
Calculate a single round in the key revocation PoW.
pc | handle to the PoW, initially called with NULL. |
Calculate a single round in the key revocation PoW.
pc | handle to the PoW, initially called with NULL. |
epochs | number of epochs for which the revocation must be valid. |
pow | current pow value to try |
difficulty | current base difficulty to achieve |
Do not try duplicates
Definition at line 372 of file gnsrecord_pow.c.
References calculate_score(), cmp_pow_value(), GNUNET_ALIGN, GNUNET_assert, GNUNET_CRYPTO_hash_count_leading_zeros(), GNUNET_CRYPTO_pow_hash(), GNUNET_CRYPTO_public_key_get_length(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_htonll(), GNUNET_log, GNUNET_memcpy, GNUNET_NO, GNUNET_YES, pc, pk, POW_COUNT, result, ret, and salt.
Referenced by calculate_pow(), and run_with_key().
size_t GNUNET_GNSRECORD_proof_get_size | ( | const struct GNUNET_GNSRECORD_PowP * | pow | ) |
Definition at line 434 of file gnsrecord_pow.c.
References GNUNET_CRYPTO_public_key_get_length(), GNUNET_CRYPTO_signature_get_raw_length_by_type(), pk, size, and GNUNET_CRYPTO_PrivateKey::type.
Referenced by calculate_pow(), GNUNET_REVOCATION_revoke(), run(), run_with_key(), and sync_pow().
void GNUNET_GNSRECORD_pow_stop | ( | struct GNUNET_GNSRECORD_PowCalculationHandle * | pc | ) |
Stop a PoW calculation.
pc | the calculation to clean up |
Definition at line 457 of file gnsrecord_pow.c.
References GNUNET_free, and pc.
Referenced by calculate_pow_shutdown().