Perform and access key revocations. More...
Data Structures | |
struct | GNUNET_REVOCATION_PowP |
Struct for a proof of work as part of the revocation. More... | |
struct | GNUNET_REVOCATION_SignaturePurposePS |
The signature object we use for the PoW. More... | |
Macros | |
#define | GNUNET_REVOCATION_VERSION 0x00000001 |
Version of the key revocation API. More... | |
#define | GNUNET_REVOCATION_MAX_PROOF_SIZE |
Maximum length of a revocation. More... | |
#define | POW_COUNT 32 |
The proof-of-work narrowing factor. More... | |
Typedefs | |
typedef void(* | GNUNET_REVOCATION_Callback) (void *cls, enum GNUNET_GenericReturnValue is_valid) |
Callback to call with the result of a key revocation query. More... | |
Perform and access key revocations.
#define GNUNET_REVOCATION_VERSION 0x00000001 |
Version of the key revocation API.
Definition at line 57 of file gnunet_revocation_service.h.
#define GNUNET_REVOCATION_MAX_PROOF_SIZE |
Maximum length of a revocation.
Definition at line 62 of file gnunet_revocation_service.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 70 of file gnunet_revocation_service.h.
typedef void(* GNUNET_REVOCATION_Callback) (void *cls, enum GNUNET_GenericReturnValue is_valid) |
Callback to call with the result of a key revocation query.
cls | closure |
is_valid | GNUNET_NO of the key is/was revoked, GNUNET_YES if the key is still valid, GNUNET_SYSERR if we had trouble querying the service |
Definition at line 139 of file gnunet_revocation_service.h.
struct GNUNET_REVOCATION_Query* GNUNET_REVOCATION_query | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
const struct GNUNET_IDENTITY_PublicKey * | key, | ||
GNUNET_REVOCATION_Callback | func, | ||
void * | func_cls | ||
) |
Check if a key was revoked.
cfg | the configuration to use |
key | key to check for revocation |
func | function to call with the result of the check |
func_cls | closure to pass to func |
Definition at line 162 of file revocation_api.c.
References cfg, env, GNUNET_REVOCATION_Query::func, GNUNET_REVOCATION_Query::func_cls, GNUNET_CLIENT_connect(), GNUNET_free, GNUNET_IDENTITY_public_key_get_length(), GNUNET_IDENTITY_write_public_key_to_buffer(), GNUNET_MESSAGE_TYPE_REVOCATION_QUERY, GNUNET_MESSAGE_TYPE_REVOCATION_QUERY_RESPONSE, GNUNET_MQ_handler_end, GNUNET_MQ_hd_fixed_size, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_new, handlers, key, QueryMessage::key_len, GNUNET_REVOCATION_Query::mq, q, and query_mq_error_handler().
Referenced by recursive_gns_resolution_revocation(), and run().
void GNUNET_REVOCATION_query_cancel | ( | struct GNUNET_REVOCATION_Query * | q | ) |
Cancel key revocation check.
q | query to cancel |
Definition at line 209 of file revocation_api.c.
References GNUNET_free, GNUNET_MQ_destroy(), GNUNET_REVOCATION_Query::mq, and q.
Referenced by do_shutdown(), GNS_resolver_lookup_cancel(), handle_revocation_query_response(), and query_mq_error_handler().
struct GNUNET_REVOCATION_Handle* GNUNET_REVOCATION_revoke | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
const struct GNUNET_REVOCATION_PowP * | pow, | ||
GNUNET_REVOCATION_Callback | func, | ||
void * | func_cls | ||
) |
Perform key revocation.
cfg | the configuration to use |
pow | proof of work to use (should have been created by iteratively calling GNUNET_REVOCATION_pow_round) |
func | function to call with the result of the check (called with is_valid being GNUNET_NO if the revocation worked). |
func_cls | closure to pass to func |
cfg | the configuration to use |
key | public key of the key to revoke |
sig | signature to use on the revocation (should have been created using #GNUNET_REVOCATION_sign_revocation). |
ts | revocation timestamp |
pow | proof of work to use (should have been created by iteratively calling GNUNET_REVOCATION_check_pow) |
func | function to call with the result of the check (called with is_valid being GNUNET_NO if the revocation worked). |
func_cls | closure to pass to func |
Definition at line 303 of file revocation_api.c.
References cfg, env, epoch_duration, GNUNET_break, GNUNET_CLIENT_connect(), GNUNET_CONFIGURATION_get_value_number(), GNUNET_CONFIGURATION_get_value_time(), GNUNET_free, GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE, GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE_RESPONSE, GNUNET_MQ_handler_end, GNUNET_MQ_hd_fixed_size, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_new, GNUNET_OK, GNUNET_REVOCATION_check_pow(), GNUNET_REVOCATION_proof_get_size(), GNUNET_YES, h, handlers, matching_bits, GNUNET_ARM_Handle::mq, RevokeMessage::pow_size, and revocation_mq_error_handler().
Referenced by perform_revocation().
void GNUNET_REVOCATION_revoke_cancel | ( | struct GNUNET_REVOCATION_Handle * | h | ) |
Cancel key revocation.
h | operation to cancel |
Definition at line 377 of file revocation_api.c.
References GNUNET_free, GNUNET_MQ_destroy(), h, and GNUNET_ARM_Handle::mq.
Referenced by do_shutdown(), handle_revocation_response(), and revocation_mq_error_handler().
enum GNUNET_GenericReturnValue GNUNET_REVOCATION_check_pow | ( | const struct GNUNET_REVOCATION_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 406 of file revocation_api.c.
Referenced by ego_callback(), GNUNET_REVOCATION_revoke(), run(), and run_with_key().
void GNUNET_REVOCATION_pow_init | ( | const struct GNUNET_IDENTITY_PrivateKey * | key, |
struct GNUNET_REVOCATION_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 619 of file revocation_api.c.
References GNUNET_assert, GNUNET_OK, key, and sign_pow().
Referenced by ego_callback(), and run_with_key().
struct GNUNET_REVOCATION_PowCalculationHandle* GNUNET_REVOCATION_pow_start | ( | struct GNUNET_REVOCATION_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 627 of file revocation_api.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_REVOCATION_pow_round | ( | struct GNUNET_REVOCATION_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 656 of file revocation_api.c.
Referenced by calculate_pow(), and run_with_key().
void GNUNET_REVOCATION_pow_stop | ( | struct GNUNET_REVOCATION_PowCalculationHandle * | pc | ) |
Stop a PoW calculation.
pc | the calculation to clean up |
Definition at line 742 of file revocation_api.c.
References GNUNET_free, and pc.
Referenced by calculate_pow_shutdown().
size_t GNUNET_REVOCATION_proof_get_size | ( | const struct GNUNET_REVOCATION_PowP * | pow | ) |
Definition at line 749 of file revocation_api.c.
References GNUNET_IDENTITY_public_key_get_length(), GNUNET_IDENTITY_signature_get_raw_length_by_type(), pk, size, and GNUNET_IDENTITY_PrivateKey::type.
Referenced by calculate_pow(), GNUNET_REVOCATION_revoke(), run(), run_with_key(), and sync_pow().