GNUnet 0.22.2
Revocation service

Perform and access key revocations. More...

Collaboration diagram for Revocation service:

Macros

#define GNUNET_REVOCATION_VERSION   0x00000001
 Version of the key revocation API. 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...
 

Functions

struct GNUNET_REVOCATION_QueryGNUNET_REVOCATION_query (const struct GNUNET_CONFIGURATION_Handle *cfg, const struct GNUNET_CRYPTO_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...
 
struct GNUNET_REVOCATION_HandleGNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg, const struct GNUNET_GNSRECORD_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...
 

Detailed Description

Perform and access key revocations.

See also
Documentation

Macro Definition Documentation

◆ GNUNET_REVOCATION_VERSION

#define GNUNET_REVOCATION_VERSION   0x00000001

Version of the key revocation API.

Definition at line 58 of file gnunet_revocation_service.h.

Typedef Documentation

◆ GNUNET_REVOCATION_Callback

typedef void(* GNUNET_REVOCATION_Callback) (void *cls, enum GNUNET_GenericReturnValue is_valid)

Callback to call with the result of a key revocation query.

Parameters
clsclosure
is_validGNUNET_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 75 of file gnunet_revocation_service.h.

Function Documentation

◆ GNUNET_REVOCATION_query()

struct GNUNET_REVOCATION_Query * GNUNET_REVOCATION_query ( const struct GNUNET_CONFIGURATION_Handle cfg,
const struct GNUNET_CRYPTO_PublicKey key,
GNUNET_REVOCATION_Callback  func,
void *  func_cls 
)

Check if a key was revoked.

Parameters
cfgthe configuration to use
keykey to check for revocation
funcfunction to call with the result of the check
func_clsclosure to pass to func
Returns
handle to use in GNUNET_REVOCATION_query_cancel to stop REVOCATION from invoking the callback

Definition at line 108 of file revocation_api.c.

112{
116 GNUNET_MQ_hd_fixed_size (revocation_query_response,
119 q),
121 };
122 struct QueryMessage *qm;
123 struct GNUNET_MQ_Envelope *env;
124 size_t key_len;
125
127 "revocation",
128 handlers,
130 q);
131 if (NULL == q->mq)
132 {
133 GNUNET_free (q);
134 return NULL;
135 }
136 q->func = func;
137 q->func_cls = func_cls;
139 env = GNUNET_MQ_msg_extra (qm, key_len,
142 qm->key_len = htonl (key_len);
144 env);
145 return q;
146}
struct GNUNET_MQ_MessageHandlers handlers[]
Definition: 003.c:1
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:108
struct GNUNET_HashCode key
The key used in the DHT.
static struct GNUNET_REVOCATION_Query * q
Handle for revocation query.
struct GNUNET_MQ_Handle * GNUNET_CLIENT_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *service_name, const struct GNUNET_MQ_MessageHandler *handlers, GNUNET_MQ_ErrorHandler error_handler, void *error_handler_cls)
Create a message queue to connect to a GNUnet service.
Definition: client.c:1060
ssize_t GNUNET_CRYPTO_public_key_get_length(const struct GNUNET_CRYPTO_PublicKey *key)
Get the compacted length of a GNUNET_CRYPTO_PublicKey.
Definition: crypto_pkey.c:85
ssize_t GNUNET_CRYPTO_write_public_key_to_buffer(const struct GNUNET_CRYPTO_PublicKey *key, void *buffer, size_t len)
Writes a GNUNET_CRYPTO_PublicKey to a compact buffer.
Definition: crypto_pkey.c:128
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:305
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct.
Definition: gnunet_mq_lib.h:61
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
#define GNUNET_MESSAGE_TYPE_REVOCATION_QUERY
Client to service: was this key revoked?
#define GNUNET_MESSAGE_TYPE_REVOCATION_QUERY_RESPONSE
Service to client: answer if key was revoked!
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 c...
Message handler for a specific message type.
Handle for the key revocation query.
void * func_cls
Closure for func.
struct GNUNET_MQ_Handle * mq
Message queue to the service.
GNUNET_REVOCATION_Callback func
Function to call with the result.
Query key revocation status.
Definition: revocation.h:38
uint32_t key_len
Key length.
Definition: revocation.h:47
Key revocation response.
Definition: revocation.h:59

References cfg, env, GNUNET_REVOCATION_Query::func, GNUNET_REVOCATION_Query::func_cls, GNUNET_CLIENT_connect(), GNUNET_CRYPTO_public_key_get_length(), GNUNET_CRYPTO_write_public_key_to_buffer(), 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_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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_REVOCATION_query_cancel()

void GNUNET_REVOCATION_query_cancel ( struct GNUNET_REVOCATION_Query q)

Cancel key revocation check.

Parameters
qquery to cancel

Definition at line 155 of file revocation_api.c.

156{
157 if (NULL != q->mq)
158 {
160 q->mq = NULL;
161 }
162 GNUNET_free (q);
163}
void GNUNET_MQ_destroy(struct GNUNET_MQ_Handle *mq)
Destroy the message queue.
Definition: mq.c:700

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_REVOCATION_revoke()

struct GNUNET_REVOCATION_Handle * GNUNET_REVOCATION_revoke ( const struct GNUNET_CONFIGURATION_Handle cfg,
const struct GNUNET_GNSRECORD_PowP pow,
GNUNET_REVOCATION_Callback  func,
void *  func_cls 
)

Perform key revocation.

Parameters
cfgthe configuration to use
powproof of work to use (should have been created by iteratively calling #GNUNET_CRYPTO_pow_round)
funcfunction to call with the result of the check (called with is_valid being GNUNET_NO if the revocation worked).
func_clsclosure to pass to func
Returns
handle to use in GNUNET_REVOCATION_revoke_cancel to stop REVOCATION from invoking the callback
Parameters
cfgthe configuration to use
keypublic key of the key to revoke
sigsignature to use on the revocation (should have been created using #GNUNET_REVOCATION_sign_revocation).
tsrevocation timestamp
powproof of work to use (should have been created by iteratively calling #GNUNET_REVOCATION_check_pow)
funcfunction to call with the result of the check (called with is_valid being GNUNET_NO if the revocation worked).
func_clsclosure to pass to func
Returns
handle to use in GNUNET_REVOCATION_revoke_cancel to stop REVOCATION from invoking the callback

Definition at line 249 of file revocation_api.c.

253{
257 GNUNET_MQ_hd_fixed_size (revocation_response,
260 h),
262 };
263 unsigned long long matching_bits;
265 struct RevokeMessage *rm;
266 struct GNUNET_MQ_Envelope *env;
267
268 if ((GNUNET_OK !=
270 "REVOCATION",
271 "WORKBITS",
272 &matching_bits)))
273 {
274 GNUNET_break (0);
275 GNUNET_free (h);
276 return NULL;
277 }
278 if ((GNUNET_OK !=
280 "REVOCATION",
281 "EPOCH_DURATION",
283 {
284 GNUNET_break (0);
285 GNUNET_free (h);
286 return NULL;
287 }
289 (unsigned int) matching_bits,
291 {
292 GNUNET_break (0);
293 GNUNET_free (h);
294 return NULL;
295 }
296
297
299 "revocation",
300 handlers,
302 h);
303 if (NULL == h->mq)
304 {
305 GNUNET_free (h);
306 return NULL;
307 }
308 h->func = func;
309 h->func_cls = func_cls;
310 {
311 size_t extra_len = GNUNET_GNSRECORD_proof_get_size (pow);
313 extra_len,
315 rm->pow_size = htonl (extra_len);
316 memcpy (&rm[1], pow, extra_len);
317 }
319 env);
320 return h;
321}
static struct GNUNET_ARM_Handle * h
Connection with ARM.
Definition: gnunet-arm.c:98
static struct GNUNET_TIME_Relative epoch_duration
Epoch length.
static unsigned long long matching_bits
Number of matching bits required for revocation.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_number(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, unsigned long long *number)
Get a configuration value that should be a number.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_time(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, struct GNUNET_TIME_Relative *time)
Get a configuration value that should be a relative time.
size_t GNUNET_GNSRECORD_proof_get_size(const struct GNUNET_GNSRECORD_PowP *pow)
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.
@ GNUNET_OK
@ GNUNET_YES
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
#define GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE
Client to service OR peer-to-peer: revoke this key!
#define GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE_RESPONSE
Service to client: revocation confirmed.
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 c...
struct GNUNET_MQ_Handle * mq
Our connection to the ARM service.
Definition: arm_api.c:107
Handle for the key revocation operation.
Time for relative time used by GNUnet, in microseconds.
Key revocation response.
Definition: revocation.h:99
Revoke key.
Definition: revocation.h:80
uint32_t pow_size
Length of PoW with signature.
Definition: revocation.h:89

References cfg, env, epoch_duration, GNUNET_break, GNUNET_CLIENT_connect(), GNUNET_CONFIGURATION_get_value_number(), GNUNET_CONFIGURATION_get_value_time(), GNUNET_free, GNUNET_GNSRECORD_check_pow(), GNUNET_GNSRECORD_proof_get_size(), 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_YES, h, handlers, matching_bits, GNUNET_ARM_Handle::mq, RevokeMessage::pow_size, and revocation_mq_error_handler().

Referenced by perform_revocation().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_REVOCATION_revoke_cancel()

void GNUNET_REVOCATION_revoke_cancel ( struct GNUNET_REVOCATION_Handle h)

Cancel key revocation.

Parameters
hoperation to cancel

Definition at line 325 of file revocation_api.c.

326{
327 if (NULL != h->mq)
328 {
330 h->mq = NULL;
331 }
332 GNUNET_free (h);
333}

References GNUNET_free, GNUNET_MQ_destroy(), h, and GNUNET_ARM_Handle::mq.

Referenced by do_shutdown(), handle_revocation_response(), and revocation_mq_error_handler().

Here is the call graph for this function:
Here is the caller graph for this function: