![]() |
GNUnet
0.11.x
|
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 53 of file gnunet_revocation_service.h.
#define GNUNET_REVOCATION_MAX_PROOF_SIZE |
Maximum length of a revocation.
Definition at line 58 of file gnunet_revocation_service.h.
Referenced by ego_callback(), and run().
#define POW_COUNT 32 |
The proof-of-work narrowing factor.
The number of PoWs that are calculates as part of revocation.
Definition at line 66 of file gnunet_revocation_service.h.
Referenced by calculate_score(), GNUNET_REVOCATION_check_pow(), and GNUNET_REVOCATION_pow_round().
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 135 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 env, GNUNET_REVOCATION_Query::func, GNUNET_REVOCATION_Query::func_cls, GNUNET_CLIENT_connect(), GNUNET_free, GNUNET_MESSAGE_TYPE_REVOCATION_QUERY, GNUNET_MESSAGE_TYPE_REVOCATION_QUERY_RESPONSE, GNUNET_MQ_handler_end, GNUNET_MQ_hd_fixed_size, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_new, key, QueryMessage::key, GNUNET_REVOCATION_Query::mq, q, query_mq_error_handler(), and QueryMessage::reserved.
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 207 of file revocation_api.c.
References GNUNET_free, GNUNET_MQ_destroy(), and GNUNET_REVOCATION_Query::mq.
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 301 of file revocation_api.c.
References env, GNUNET_REVOCATION_Query::func, GNUNET_REVOCATION_Handle::func, GNUNET_REVOCATION_Query::func_cls, GNUNET_REVOCATION_Handle::func_cls, 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, matching_bits, GNUNET_REVOCATION_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 380 of file revocation_api.c.
References GNUNET_free, GNUNET_MQ_destroy(), and GNUNET_REVOCATION_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 |
Check if signature valid
First, check if PoW set is strictly monotically increasing
Check expiration
Extend by 10% for unsynchronized clocks
Definition at line 479 of file revocation_api.c.
References buf, check_signature(), count_leading_zeroes(), epochs, GNUNET_CRYPTO_pow_hash(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_IDENTITY_key_get_length(), 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_REVOCATION_PowP::pow, POW_COUNT, and GNUNET_REVOCATION_PowP::timestamp.
Referenced by block_plugin_revocation_evaluate(), ego_callback(), GNUNET_REVOCATION_revoke(), run(), and verify_revoke_message().
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 630 of file revocation_api.c.
References GNUNET_assert, GNUNET_OK, and sign_pow().
Referenced by ego_callback(), and run().
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 647 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, and pc.
Referenced by ego_callback(), and run().
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 693 of file revocation_api.c.
References GNUNET_REVOCATION_PowCalculationHandle::best, BestPow::bits, buf, calculate_score(), cmp_pow_value(), count_leading_zeroes(), GNUNET_REVOCATION_PowCalculationHandle::current_pow, GNUNET_REVOCATION_PowCalculationHandle::difficulty, GNUNET_REVOCATION_PowCalculationHandle::epochs, GNUNET_CRYPTO_pow_hash(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_htonll(), GNUNET_IDENTITY_key_get_length(), GNUNET_log, GNUNET_memcpy, GNUNET_NO, GNUNET_YES, pk, BestPow::pow, GNUNET_REVOCATION_PowCalculationHandle::pow, GNUNET_REVOCATION_PowP::pow, POW_COUNT, ret, and GNUNET_REVOCATION_PowP::timestamp.
Referenced by calculate_pow(), and run().
void GNUNET_REVOCATION_pow_stop | ( | struct GNUNET_REVOCATION_PowCalculationHandle * | pc | ) |
Stop a PoW calculation.
pc | the calculation to clean up |
Definition at line 759 of file revocation_api.c.
References GNUNET_free.
Referenced by calculate_pow_shutdown().
size_t GNUNET_REVOCATION_proof_get_size | ( | const struct GNUNET_REVOCATION_PowP * | pow | ) |
Definition at line 766 of file revocation_api.c.
References GNUNET_IDENTITY_key_get_length(), GNUNET_IDENTITY_signature_get_length(), pk, and size.
Referenced by calculate_pow(), GNUNET_REVOCATION_revoke(), run(), and sync_pow().