API to perform and access key revocations. More...
#include "platform.h"
#include "gnunet_revocation_service.h"
#include "gnunet_signatures.h"
#include "gnunet_protocols.h"
#include "revocation.h"
#include <inttypes.h>
Go to the source code of this file.
Data Structures | |
struct | GNUNET_REVOCATION_Query |
Handle for the key revocation query. More... | |
struct | BestPow |
Helper struct that holds a found pow nonce and the corresponding number of leading zeros. More... | |
struct | GNUNET_REVOCATION_PowCalculationHandle |
The handle to a PoW calculation. More... | |
struct | GNUNET_REVOCATION_Handle |
Handle for the key revocation operation. More... | |
Functions | |
static void | query_mq_error_handler (void *cls, enum GNUNET_MQ_Error error) |
Generic error handler, called with the appropriate error code and the same closure specified at the creation of the message queue. More... | |
static void | handle_revocation_query_response (void *cls, const struct QueryResponseMessage *qrm) |
Handle response to our revocation query. More... | |
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. More... | |
void | GNUNET_REVOCATION_query_cancel (struct GNUNET_REVOCATION_Query *q) |
Cancel key revocation check. More... | |
static void | revocation_mq_error_handler (void *cls, enum GNUNET_MQ_Error error) |
Generic error handler, called with the appropriate error code and the same closure specified at the creation of the message queue. More... | |
static void | handle_revocation_response (void *cls, const struct RevocationResponseMessage *rrm) |
Handle response to our revocation query. More... | |
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. More... | |
void | GNUNET_REVOCATION_revoke_cancel (struct GNUNET_REVOCATION_Handle *h) |
Cancel key revocation. More... | |
static unsigned int | calculate_score (const struct GNUNET_REVOCATION_PowCalculationHandle *ph) |
Calculate the average zeros in the pows. More... | |
struct GNUNET_REVOCATION_SignaturePurposePS * | REV_create_signature_message (const struct GNUNET_REVOCATION_PowP *pow) |
Create the revocation metadata to sign for a revocation message. More... | |
enum GNUNET_GenericReturnValue | check_signature_identity (const struct GNUNET_REVOCATION_PowP *pow, const struct GNUNET_IDENTITY_PublicKey *key) |
enum GNUNET_GenericReturnValue | check_signature (const struct GNUNET_REVOCATION_PowP *pow) |
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. More... | |
enum GNUNET_GenericReturnValue | sign_pow_identity (const struct GNUNET_IDENTITY_PrivateKey *key, struct GNUNET_REVOCATION_PowP *pow) |
enum GNUNET_GenericReturnValue | sign_pow (const struct GNUNET_IDENTITY_PrivateKey *key, struct GNUNET_REVOCATION_PowP *pow) |
void | GNUNET_REVOCATION_pow_init (const struct GNUNET_IDENTITY_PrivateKey *key, struct GNUNET_REVOCATION_PowP *pow) |
Initializes a fresh PoW computation. More... | |
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. More... | |
static int | cmp_pow_value (const void *a, const void *b) |
Comparison function for quicksort. More... | |
enum GNUNET_GenericReturnValue | GNUNET_REVOCATION_pow_round (struct GNUNET_REVOCATION_PowCalculationHandle *pc) |
Calculate a key revocation valid for broadcasting for a number of epochs. More... | |
void | GNUNET_REVOCATION_pow_stop (struct GNUNET_REVOCATION_PowCalculationHandle *pc) |
Stop a PoW calculation. More... | |
size_t | GNUNET_REVOCATION_proof_get_size (const struct GNUNET_REVOCATION_PowP *pow) |
Variables | |
static struct GNUNET_CRYPTO_PowSalt | salt = { "GnsRevocationPow" } |
API to perform and access key revocations.
Definition in file revocation_api.c.
|
static |
Generic error handler, called with the appropriate error code and the same closure specified at the creation of the message queue.
Not every message queue implementation supports an error handler.
cls | closure with the struct GNUNET_NSE_Handle * |
error | error code |
Definition at line 118 of file revocation_api.c.
References GNUNET_REVOCATION_Query::func, GNUNET_REVOCATION_Query::func_cls, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_REVOCATION_query_cancel(), GNUNET_SYSERR, and q.
Referenced by GNUNET_REVOCATION_query().
|
static |
Handle response to our revocation query.
cls | our struct GNUNET_REVOCATION_Query handle |
qrm | response we got |
Definition at line 138 of file revocation_api.c.
References GNUNET_REVOCATION_Query::func, GNUNET_REVOCATION_Query::func_cls, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_REVOCATION_query_cancel(), QueryResponseMessage::is_valid, and q.
|
static |
Generic error handler, called with the appropriate error code and the same closure specified at the creation of the message queue.
Not every message queue implementation supports an error handler.
cls | closure with the struct GNUNET_NSE_Handle * |
error | error code |
Definition at line 252 of file revocation_api.c.
References GNUNET_ERROR_TYPE_WARNING, GNUNET_log, GNUNET_REVOCATION_revoke_cancel(), GNUNET_SYSERR, and h.
Referenced by GNUNET_REVOCATION_revoke().
|
static |
Handle response to our revocation query.
cls | our struct GNUNET_REVOCATION_Handle handle |
rrm | response we got |
Definition at line 272 of file revocation_api.c.
References GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_REVOCATION_revoke_cancel(), h, and RevocationResponseMessage::is_valid.
|
static |
Calculate the average zeros in the pows.
ph | the PowHandle |
Definition at line 395 of file revocation_api.c.
References ph, POW_COUNT, and consensus-simulation::sum.
struct GNUNET_REVOCATION_SignaturePurposePS* REV_create_signature_message | ( | const struct GNUNET_REVOCATION_PowP * | pow | ) |
Create the revocation metadata to sign for a revocation message.
pow | the PoW to sign |
Definition at line 406 of file revocation_api.c.
Referenced by run_with_key().
enum GNUNET_GenericReturnValue check_signature_identity | ( | const struct GNUNET_REVOCATION_PowP * | pow, |
const struct GNUNET_IDENTITY_PublicKey * | key | ||
) |
Definition at line 406 of file revocation_api.c.
enum GNUNET_GenericReturnValue check_signature | ( | const struct GNUNET_REVOCATION_PowP * | pow | ) |
Definition at line 406 of file revocation_api.c.
References GNUNET_IDENTITY_public_key_get_length(), GNUNET_IDENTITY_write_public_key_to_buffer(), GNUNET_malloc, GNUNET_SIGNATURE_PURPOSE_GNS_REVOCATION, pk, GNUNET_CRYPTO_EccSignaturePurpose::purpose, GNUNET_REVOCATION_SignaturePurposePS::purpose, GNUNET_CRYPTO_EccSignaturePurpose::size, GNUNET_REVOCATION_SignaturePurposePS::timestamp, and GNUNET_REVOCATION_PowP::timestamp.
enum GNUNET_GenericReturnValue sign_pow_identity | ( | const struct GNUNET_IDENTITY_PrivateKey * | key, |
struct GNUNET_REVOCATION_PowP * | pow | ||
) |
Predate the validity period to prevent rejections due to unsynchronized clocks
Definition at line 406 of file revocation_api.c.
enum GNUNET_GenericReturnValue sign_pow | ( | const struct GNUNET_IDENTITY_PrivateKey * | key, |
struct GNUNET_REVOCATION_PowP * | pow | ||
) |
Definition at line 406 of file revocation_api.c.
Referenced by GNUNET_REVOCATION_pow_init().
|
static |
Comparison function for quicksort.
a | left element |
b | right element |
Definition at line 656 of file revocation_api.c.
References GNUNET_ntohll().
|
static |
Definition at line 1 of file revocation_api.c.