GNUnet 0.22.2

Credential service for Attribute-Based Decryption. More...

Collaboration diagram for Credential service:

Data Structures

struct  GNUNET_ABD_DelegationRecord
 The attribute delegation record. More...
 
struct  GNUNET_ABD_DelegationRecordSet
 The attribute delegation record. More...
 
struct  GNUNET_ABD_DelegationSet
 The attribute delegation record. More...
 
struct  GNUNET_ABD_Delegation
 A delegation. More...
 
struct  GNUNET_ABD_Delegate
 A delegate. More...
 

Typedefs

typedef void(* GNUNET_ABD_CredentialResultProcessor) (void *cls, unsigned int d_count, struct GNUNET_ABD_Delegation *delegation_chain, unsigned int c_count, struct GNUNET_ABD_Delegate *delegte)
 Iterator called on obtained result for an attribute verification. More...
 
typedef void(* GNUNET_ABD_IntermediateResultProcessor) (void *cls, struct GNUNET_ABD_Delegation *delegation, bool is_bw)
 
typedef void(* GNUNET_ABD_DelegateResultProcessor) (void *cls, uint32_t success)
 Iterator called on obtained result for an attribute delegation. More...
 
typedef void(* GNUNET_ABD_RemoveDelegateResultProcessor) (void *cls, uint32_t success)
 Iterator called on obtained result for an attribute delegation removal. More...
 

Enumerations

enum  GNUNET_ABD_CredentialFlags { GNUNET_ABD_FLAG_REVOKED =0 , GNUNET_ABD_FLAG_SUBJECT =1 , GNUNET_ABD_FLAG_ISSUER =2 }
 
enum  GNUNET_ABD_AlgoDirectionFlags { GNUNET_ABD_FLAG_FORWARD =1 << 0 , GNUNET_ABD_FLAG_BACKWARD =1 << 1 }
 

Functions

struct GNUNET_ABD_HandleGNUNET_ABD_connect (const struct GNUNET_CONFIGURATION_Handle *cfg)
 Initialize the connection with the Credential service. More...
 
void GNUNET_ABD_disconnect (struct GNUNET_ABD_Handle *handle)
 Shutdown connection with the Credential service. More...
 
struct GNUNET_ABD_RequestGNUNET_ABD_verify (struct GNUNET_ABD_Handle *handle, const struct GNUNET_CRYPTO_PublicKey *issuer_key, const char *issuer_attribute, const struct GNUNET_CRYPTO_PublicKey *subject_key, uint32_t delegate_count, const struct GNUNET_ABD_Delegate *delegates, enum GNUNET_ABD_AlgoDirectionFlags direction, GNUNET_ABD_CredentialResultProcessor proc, void *proc_cls, GNUNET_ABD_IntermediateResultProcessor, void *proc2_cls)
 Performs attribute verification. More...
 
struct GNUNET_ABD_RequestGNUNET_ABD_collect (struct GNUNET_ABD_Handle *handle, const struct GNUNET_CRYPTO_PublicKey *issuer_key, const char *issuer_attribute, const struct GNUNET_CRYPTO_PrivateKey *subject_key, enum GNUNET_ABD_AlgoDirectionFlags direction, GNUNET_ABD_CredentialResultProcessor proc, void *proc_cls, GNUNET_ABD_IntermediateResultProcessor, void *proc2_cls)
 Performs attribute collection. More...
 
struct GNUNET_ABD_RequestGNUNET_ABD_add_delegation (struct GNUNET_ABD_Handle *handle, struct GNUNET_IDENTITY_Ego *issuer, const char *attribute, struct GNUNET_CRYPTO_PublicKey *subject, const char *delegated_attribute, GNUNET_ABD_DelegateResultProcessor proc, void *proc_cls)
 Delegate an attribute. More...
 
struct GNUNET_ABD_RequestGNUNET_ABD_remove_delegation (struct GNUNET_ABD_Handle *handle, struct GNUNET_IDENTITY_Ego *issuer, const char *attribute, GNUNET_ABD_RemoveDelegateResultProcessor proc, void *proc_cls)
 Remove a delegation. More...
 
struct GNUNET_ABD_DelegateGNUNET_ABD_delegate_issue (const struct GNUNET_CRYPTO_PrivateKey *issuer, struct GNUNET_CRYPTO_PublicKey *subject, const char *iss_attr, const char *sub_attr, struct GNUNET_TIME_Absolute *expiration)
 Issue an attribute to a subject. More...
 
void GNUNET_ABD_request_cancel (struct GNUNET_ABD_Request *lr)
 Cancel pending lookup request. More...
 

Detailed Description

Credential service for Attribute-Based Decryption.

Typedef Documentation

◆ GNUNET_ABD_CredentialResultProcessor

typedef void(* GNUNET_ABD_CredentialResultProcessor) (void *cls, unsigned int d_count, struct GNUNET_ABD_Delegation *delegation_chain, unsigned int c_count, struct GNUNET_ABD_Delegate *delegte)

Iterator called on obtained result for an attribute verification.

Parameters
clsclosure
d_countthe number of delegations processed
delegation_chainthe delegations processed
c_countthe number of delegates found
delegatethe delegates

Definition at line 269 of file gnunet_abd_service.h.

◆ GNUNET_ABD_IntermediateResultProcessor

typedef void(* GNUNET_ABD_IntermediateResultProcessor) (void *cls, struct GNUNET_ABD_Delegation *delegation, bool is_bw)

Definition at line 278 of file gnunet_abd_service.h.

◆ GNUNET_ABD_DelegateResultProcessor

typedef void(* GNUNET_ABD_DelegateResultProcessor) (void *cls, uint32_t success)

Iterator called on obtained result for an attribute delegation.

Parameters
clsclosure
successGNUNET_YES if successful
resultthe record data that can be handed to the subject

Definition at line 291 of file gnunet_abd_service.h.

◆ GNUNET_ABD_RemoveDelegateResultProcessor

typedef void(* GNUNET_ABD_RemoveDelegateResultProcessor) (void *cls, uint32_t success)

Iterator called on obtained result for an attribute delegation removal.

Parameters
clsclosure
successGNUNET_YES if successful
resultthe record data that can be handed to the subject

Definition at line 301 of file gnunet_abd_service.h.

Enumeration Type Documentation

◆ GNUNET_ABD_CredentialFlags

Enumerator
GNUNET_ABD_FLAG_REVOKED 
GNUNET_ABD_FLAG_SUBJECT 
GNUNET_ABD_FLAG_ISSUER 

Definition at line 65 of file gnunet_abd_service.h.

66{
67
68 // Subject had credentials before, but have been revoked now
70
71 // Subject flag indicates that the subject is a holder of this credential and may present it as such
73
74 // Issuer flag is used to signify that the subject is allowed to issue this credential and delegate issuance
76
77};
@ GNUNET_ABD_FLAG_SUBJECT
@ GNUNET_ABD_FLAG_REVOKED
@ GNUNET_ABD_FLAG_ISSUER

◆ GNUNET_ABD_AlgoDirectionFlags

Enumerator
GNUNET_ABD_FLAG_FORWARD 
GNUNET_ABD_FLAG_BACKWARD 

Definition at line 230 of file gnunet_abd_service.h.

231{
232
233 // Subject had credentials before, but have been revoked now
235
236 // Subject flag indicates that the subject is a holder of this credential and may present it as such
238
239};
@ GNUNET_ABD_FLAG_BACKWARD
@ GNUNET_ABD_FLAG_FORWARD

Function Documentation

◆ GNUNET_ABD_connect()

struct GNUNET_ABD_Handle * GNUNET_ABD_connect ( const struct GNUNET_CONFIGURATION_Handle cfg)

Initialize the connection with the Credential service.

Parameters
cfgconfiguration to use
Returns
handle to the Credential service, or NULL on error

Initialize the connection with the Credential service.

Parameters
cfgconfiguration to use
Returns
handle to the ABD service, or NULL on error

Definition at line 354 of file abd_api.c.

355{
357
359 handle->cfg = cfg;
361 if (NULL == handle->mq)
362 {
364 return NULL;
365 }
366 return handle;
367}
static void reconnect(struct GNUNET_ABD_Handle *handle)
Reconnect to ABD service.
Definition: abd_api.c:315
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:108
static struct GNUNET_VPN_Handle * handle
Handle to vpn service.
Definition: gnunet-vpn.c:35
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
Connection to the ABD service.
Definition: abd_api.c:96
const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we use.
Definition: vpn_api.c:39
struct GNUNET_MQ_Handle * mq
Connection to VPN service.
Definition: vpn_api.c:44

References cfg, GNUNET_VPN_Handle::cfg, GNUNET_free, GNUNET_new, handle, GNUNET_VPN_Handle::mq, and reconnect().

Referenced by run().

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

◆ GNUNET_ABD_disconnect()

void GNUNET_ABD_disconnect ( struct GNUNET_ABD_Handle handle)

Shutdown connection with the Credential service.

Parameters
handleconnection to shut down

Shutdown connection with the Credential service.

Parameters
handlehandle of the ABD connection to stop

Definition at line 376 of file abd_api.c.

377{
378 if (NULL != handle->mq)
379 {
381 handle->mq = NULL;
382 }
383 if (NULL != handle->reconnect_task)
384 {
385 GNUNET_SCHEDULER_cancel (handle->reconnect_task);
386 handle->reconnect_task = NULL;
387 }
388 GNUNET_assert (NULL == handle->request_head);
390}
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
void GNUNET_MQ_destroy(struct GNUNET_MQ_Handle *mq)
Destroy the message queue.
Definition: mq.c:700
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:980

References GNUNET_assert, GNUNET_free, GNUNET_MQ_destroy(), GNUNET_SCHEDULER_cancel(), handle, and GNUNET_VPN_Handle::mq.

Referenced by do_shutdown().

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

◆ GNUNET_ABD_verify()

struct GNUNET_ABD_Request * GNUNET_ABD_verify ( struct GNUNET_ABD_Handle handle,
const struct GNUNET_CRYPTO_PublicKey issuer_key,
const char *  issuer_attribute,
const struct GNUNET_CRYPTO_PublicKey subject_key,
uint32_t  delegate_count,
const struct GNUNET_ABD_Delegate delegates,
enum GNUNET_ABD_AlgoDirectionFlags  direction,
GNUNET_ABD_CredentialResultProcessor  proc,
void *  proc_cls,
GNUNET_ABD_IntermediateResultProcessor  proc2,
void *  proc2_cls 
)

Performs attribute verification.

Checks if there is a delegation chain from attribute issuer_attribute'' issued by the issuer with public keyissuer_key'' maps to the attribute subject_attribute'' claimed by the subject with key subject_key''

Parameters
handlehandle to the Credential service
issuer_keythe issuer public key
issuer_attributethe issuer attribute
subject_keythe subject public key
delegate_countnumber of delegates
delegatesthe subject delegates
procfunction to call on result
proc_clsclosure for processor
Returns
handle to the queued request

Checks if there is a delegation chain from attribute issuer_attribute'' issued by the issuer with public keyissuer_key'' maps to the attribute subject_attribute'' claimed by the subject with key subject_key''

Parameters
handlehandle to the Credential service
issuer_keythe issuer public key
issuer_attributethe issuer attribute
subject_keythe subject public key
delegate_countnumber of delegates provided
delegatessubject delegates
procfunction to call on result
proc_clsclosure for processor
Returns
handle to the queued request

Definition at line 497 of file abd_api.c.

509{
510 /* IPC to shorten abd names, return shorten_handle */
511 struct VerifyMessage *v_msg;
512 struct GNUNET_ABD_Request *vr;
513 size_t nlen;
514 size_t clen;
515
516 if ((NULL == issuer_attribute) || (NULL == delegates))
517 {
518 GNUNET_break (0);
519 return NULL;
520 }
521
522 clen = GNUNET_ABD_delegates_get_size (delegate_count, delegates);
523
524 // DEBUG LOG
526 "Trying to verify `%s' in ABD\n",
527 issuer_attribute);
528 nlen = strlen (issuer_attribute) + 1 + clen;
529 if (nlen >= GNUNET_MAX_MESSAGE_SIZE - sizeof (*vr))
530 {
531 GNUNET_break (0);
532 return NULL;
533 }
534 vr = GNUNET_new (struct GNUNET_ABD_Request);
535 vr->abd_handle = handle;
536 vr->verify_proc = proc;
537 vr->proc_cls = proc_cls;
538 vr->int_proc = proc2;
539 vr->proc2_cls = proc2_cls;
540 vr->r_id = handle->r_id_gen++;
541 vr->env =
543 v_msg->id = htonl (vr->r_id);
544 v_msg->subject_key = *subject_key;
545 v_msg->d_count = htonl (delegate_count);
546 v_msg->issuer_key = *issuer_key;
547 v_msg->issuer_attribute_len = htons (strlen (issuer_attribute));
548 v_msg->resolution_algo = htons (direction);
549
550 GNUNET_memcpy (&v_msg[1], issuer_attribute, strlen (issuer_attribute));
551 GNUNET_ABD_delegates_serialize (delegate_count,
552 delegates,
553 clen,
554 ((char *) &v_msg[1])
555 + strlen (issuer_attribute) + 1);
556 GNUNET_CONTAINER_DLL_insert (handle->request_head, handle->request_tail, vr);
557 if (NULL != handle->mq)
559 return vr;
560}
#define LOG(kind,...)
Definition: abd_api.c:37
ssize_t GNUNET_ABD_delegates_serialize(unsigned int c_count, const struct GNUNET_ABD_Delegate *cd, size_t dest_size, char *dest)
Serizalize the given abds.
size_t GNUNET_ABD_delegates_get_size(unsigned int c_count, const struct GNUNET_ABD_Delegate *cd)
Calculate how many bytes we will need to serialize the abds.
static char * issuer_key
Issuer pubkey string.
Definition: gnunet-abd.c:113
enum GNUNET_ABD_AlgoDirectionFlags direction
API enum, filled and passed for collect/verify.
Definition: gnunet-abd.c:173
#define GNUNET_MAX_MESSAGE_SIZE
Largest supported message (to be precise, one byte more than the largest possible message,...
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
@ GNUNET_ERROR_TYPE_DEBUG
void GNUNET_MQ_send_copy(struct GNUNET_MQ_Handle *mq, const struct GNUNET_MQ_Envelope *ev)
Send a copy of a message with the given message queue.
Definition: mq.c:384
#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_MESSAGE_TYPE_ABD_VERIFY
Handle to a verify request.
Definition: abd_api.c:43
void * proc_cls
verify_proc closure
Definition: abd_api.c:68
GNUNET_ABD_CredentialResultProcessor verify_proc
processor to call on verify result
Definition: abd_api.c:63
struct GNUNET_ABD_Handle * abd_handle
handle to abd service
Definition: abd_api.c:58
GNUNET_ABD_IntermediateResultProcessor int_proc
processor to call on intermediate result
Definition: abd_api.c:73
void * proc2_cls
verify_proc2 closure
Definition: abd_api.c:78
struct GNUNET_MQ_Envelope * env
Envelope with the message for this queue entry.
Definition: abd_api.c:83
uint32_t r_id
request id
Definition: abd_api.c:88
Message from client to Credential service to verify attributes.
Definition: abd.h:75
uint16_t resolution_algo
Direction of the resolution algo.
Definition: abd.h:104
struct GNUNET_CRYPTO_PublicKey subject_key
Subject public key.
Definition: abd.h:84
uint32_t id
Unique identifier for this request (for key collisions).
Definition: abd.h:109
uint32_t d_count
Number of delegates.
Definition: abd.h:94
uint16_t issuer_attribute_len
Length of the issuer attribute.
Definition: abd.h:99
struct GNUNET_CRYPTO_PublicKey issuer_key
Trust anchor.
Definition: abd.h:89

References GNUNET_ABD_Request::abd_handle, VerifyMessage::d_count, direction, GNUNET_ABD_Request::env, GNUNET_ABD_delegates_get_size(), GNUNET_ABD_delegates_serialize(), GNUNET_break, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_MAX_MESSAGE_SIZE, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_ABD_VERIFY, GNUNET_MQ_msg_extra, GNUNET_MQ_send_copy(), GNUNET_new, handle, VerifyMessage::id, GNUNET_ABD_Request::int_proc, VerifyMessage::issuer_attribute_len, VerifyMessage::issuer_key, issuer_key, LOG, GNUNET_VPN_Handle::mq, GNUNET_ABD_Request::proc2_cls, GNUNET_ABD_Request::proc_cls, GNUNET_ABD_Request::r_id, VerifyMessage::resolution_algo, VerifyMessage::subject_key, and GNUNET_ABD_Request::verify_proc.

Referenced by run().

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

◆ GNUNET_ABD_collect()

struct GNUNET_ABD_Request * GNUNET_ABD_collect ( struct GNUNET_ABD_Handle handle,
const struct GNUNET_CRYPTO_PublicKey issuer_key,
const char *  issuer_attribute,
const struct GNUNET_CRYPTO_PrivateKey subject_key,
enum GNUNET_ABD_AlgoDirectionFlags  direction,
GNUNET_ABD_CredentialResultProcessor  proc,
void *  proc_cls,
GNUNET_ABD_IntermediateResultProcessor  proc2,
void *  proc2_cls 
)

Performs attribute collection.

Collects all abds of subject to fulfill the attribute, if possible

Parameters
handlehandle to the Credential service
issuer_keythe issuer public key
issuer_attributethe issuer attribute
subject_keythe subject public key
procfunction to call on result
proc_clsclosure for processor
Returns
handle to the queued request

Definition at line 423 of file abd_api.c.

433{
434 /* IPC to shorten abd names, return shorten_handle */
435 struct CollectMessage *c_msg;
436 struct GNUNET_ABD_Request *vr;
437 size_t nlen;
438
439 if (NULL == issuer_attribute)
440 {
441 GNUNET_break (0);
442 return NULL;
443 }
444
445 // DEBUG LOG
447 "Trying to collect `%s' in ABD\n",
448 issuer_attribute);
449 nlen = strlen (issuer_attribute) + 1;
450 if (nlen >= GNUNET_MAX_MESSAGE_SIZE - sizeof (*vr))
451 {
452 GNUNET_break (0);
453 return NULL;
454 }
455 vr = GNUNET_new (struct GNUNET_ABD_Request);
456 vr->abd_handle = handle;
457 vr->verify_proc = proc;
458 vr->proc_cls = proc_cls;
459 vr->int_proc = proc2;
460 vr->proc2_cls = proc2_cls;
461 vr->r_id = handle->r_id_gen++;
462 vr->env =
464 c_msg->id = htonl (vr->r_id);
465 c_msg->subject_key = *subject_key;
466 c_msg->issuer_key = *issuer_key;
467 c_msg->issuer_attribute_len = htons (strlen (issuer_attribute));
468 c_msg->resolution_algo = htons (direction);
469
470 GNUNET_memcpy (&c_msg[1], issuer_attribute, strlen (issuer_attribute));
471 GNUNET_CONTAINER_DLL_insert (handle->request_head, handle->request_tail, vr);
472 if (NULL != handle->mq)
474 return vr;
475}
#define GNUNET_MESSAGE_TYPE_ABD_COLLECT
Message from client to Credential service to collect credentials.
Definition: abd.h:36
struct GNUNET_CRYPTO_PublicKey issuer_key
Trust anchor.
Definition: abd.h:50
uint16_t resolution_algo
Direction of the resolution algo.
Definition: abd.h:60
uint16_t issuer_attribute_len
Length of the issuer attribute.
Definition: abd.h:55
struct GNUNET_CRYPTO_PrivateKey subject_key
Subject public key.
Definition: abd.h:45
uint32_t id
Unique identifier for this request (for key collisions).
Definition: abd.h:65

References GNUNET_ABD_Request::abd_handle, direction, GNUNET_ABD_Request::env, GNUNET_break, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_MAX_MESSAGE_SIZE, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_ABD_COLLECT, GNUNET_MQ_msg_extra, GNUNET_MQ_send_copy(), GNUNET_new, handle, CollectMessage::id, GNUNET_ABD_Request::int_proc, CollectMessage::issuer_attribute_len, CollectMessage::issuer_key, issuer_key, LOG, GNUNET_VPN_Handle::mq, GNUNET_ABD_Request::proc2_cls, GNUNET_ABD_Request::proc_cls, GNUNET_ABD_Request::r_id, CollectMessage::resolution_algo, CollectMessage::subject_key, and GNUNET_ABD_Request::verify_proc.

Referenced by identity_cb().

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

◆ GNUNET_ABD_add_delegation()

struct GNUNET_ABD_Request * GNUNET_ABD_add_delegation ( struct GNUNET_ABD_Handle handle,
struct GNUNET_IDENTITY_Ego issuer,
const char *  attribute,
struct GNUNET_CRYPTO_PublicKey subject,
const char *  delegated_attribute,
GNUNET_ABD_DelegateResultProcessor  proc,
void *  proc_cls 
)

Delegate an attribute.

Parameters
handlehandle to the Credential service
issuerthe ego that should be used to delegate the attribute
attributethe name of the attribute to delegate
subjectthe subject of the delegation
delegated_attributethe name of the attribute that is delegated to
procthe result callback
proc_clsthe result closure context
Returns
handle to the queued request

◆ GNUNET_ABD_remove_delegation()

struct GNUNET_ABD_Request * GNUNET_ABD_remove_delegation ( struct GNUNET_ABD_Handle handle,
struct GNUNET_IDENTITY_Ego issuer,
const char *  attribute,
GNUNET_ABD_RemoveDelegateResultProcessor  proc,
void *  proc_cls 
)

Remove a delegation.

Parameters
handlehandle to the Credential service
issuerthe ego that was used to delegate the attribute
attributethe name of the attribute that is delegated
procthe callback
proc_clscallback closure
Returns
handle to the queued request

◆ GNUNET_ABD_delegate_issue()

struct GNUNET_ABD_Delegate * GNUNET_ABD_delegate_issue ( const struct GNUNET_CRYPTO_PrivateKey issuer,
struct GNUNET_CRYPTO_PublicKey subject,
const char *  iss_attr,
const char *  sub_attr,
struct GNUNET_TIME_Absolute expiration 
)

Issue an attribute to a subject.

Parameters
issuerthe ego that should be used to issue the attribute
subjectthe subject of the attribute
iss_attrthe name of the attribute
expirationthe TTL of the credential
Returns
handle to the queued request

Definition at line 197 of file delegate_misc.c.

203{
204 struct DelegateEntry *del;
205 struct GNUNET_ABD_Delegate *dele;
206 size_t size;
207 int attr_len;
208
209 if (NULL == sub_attr)
210 {
211 // +1 for \0
212 attr_len = strlen (iss_attr) + 1;
213 }
214 else
215 {
216 // +2 for both strings need to be terminated with \0
217 attr_len = strlen (iss_attr) + strlen (sub_attr) + 2;
218 }
219 size = sizeof (struct DelegateEntry) + attr_len;
220
221 {
222 char tmp_str[attr_len];
223 GNUNET_memcpy (tmp_str, iss_attr, strlen (iss_attr));
224 if (NULL != sub_attr)
225 {
226 tmp_str[strlen (iss_attr)] = '\0';
227 GNUNET_memcpy (tmp_str + strlen (iss_attr) + 1,
228 sub_attr,
229 strlen (sub_attr));
230 }
231 tmp_str[attr_len - 1] = '\0';
232
234 del->purpose.size =
235 htonl (size - sizeof (struct GNUNET_CRYPTO_Signature));
236 del->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_DELEGATE);
237 GNUNET_CRYPTO_key_get_public (issuer, &del->issuer_key);
238 del->subject_key = *subject;
239 del->expiration = GNUNET_htonll (expiration->abs_value_us);
240 del->issuer_attribute_len = htonl (strlen (iss_attr) + 1);
241 if (NULL == sub_attr)
242 {
243 del->subject_attribute_len = htonl (0);
244 }
245 else
246 {
247 del->subject_attribute_len = htonl (strlen (sub_attr) + 1);
248 }
249
250 GNUNET_memcpy (&del[1], tmp_str, attr_len);
251 GNUNET_CRYPTO_sign_ (issuer, &del->purpose, &del->signature);
252
253 dele = GNUNET_malloc (sizeof (struct GNUNET_ABD_Delegate) + attr_len);
254 dele->signature = del->signature;
255 dele->expiration = *expiration;
257
258 dele->subject_key = *subject;
259
260 // Copy the combined string at the part in the memory where the struct ends
261 GNUNET_memcpy (&dele[1], tmp_str, attr_len);
262 }
263
264 dele->issuer_attribute = (char *) &dele[1];
265 dele->issuer_attribute_len = strlen (iss_attr);
266 if (NULL == sub_attr)
267 {
268 dele->subject_attribute = NULL;
269 dele->subject_attribute_len = 0;
270 }
271 else
272 {
273 dele->subject_attribute = (char *) &dele[1] + strlen (iss_attr) + 1;
274 dele->subject_attribute_len = strlen (sub_attr);
275 }
276
278 return dele;
279}
static char * subject
Subject pubkey string.
Definition: gnunet-abd.c:87
static struct GNUNET_TIME_Relative expiration
User supplied expiration value.
static int del
Desired action is to remove a record.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_key_get_public(const struct GNUNET_CRYPTO_PrivateKey *privkey, struct GNUNET_CRYPTO_PublicKey *key)
Retrieves the public key representation of a private key.
Definition: crypto_pkey.c:430
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_sign_(const struct GNUNET_CRYPTO_PrivateKey *priv, const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, struct GNUNET_CRYPTO_Signature *sig)
Sign a given block.
Definition: crypto_pkey.c:293
uint64_t GNUNET_htonll(uint64_t n)
Convert unsigned 64-bit integer to network byte order.
Definition: common_endian.c:37
#define GNUNET_malloc(size)
Wrapper around malloc.
static unsigned int size
Size of the "table".
Definition: peer.c:68
#define GNUNET_SIGNATURE_PURPOSE_DELEGATE
Signature for a GNUnet credential (Reclaim)
const char * subject_attribute
The subject attribute.
const char * issuer_attribute
The issuer attribute.
uint32_t issuer_attribute_len
Length of the issuer attribute.
uint32_t subject_attribute_len
Length of the subject attribute.
struct GNUNET_CRYPTO_Signature signature
Signature of this credential.
struct GNUNET_CRYPTO_PublicKey issuer_key
The issuer of the credential.
struct GNUNET_TIME_Absolute expiration
Expiration of this credential.
struct GNUNET_CRYPTO_PublicKey subject_key
Public key of the subject this credential was issued to.
An identity signature as per LSD0001.

References del, expiration, GNUNET_ABD_Delegate::expiration, GNUNET_CRYPTO_key_get_public(), GNUNET_CRYPTO_sign_(), GNUNET_free, GNUNET_htonll(), GNUNET_malloc, GNUNET_memcpy, GNUNET_SIGNATURE_PURPOSE_DELEGATE, GNUNET_ABD_Delegate::issuer_attribute, GNUNET_ABD_Delegate::issuer_attribute_len, GNUNET_ABD_Delegate::issuer_key, GNUNET_ABD_Delegate::signature, size, subject, GNUNET_ABD_Delegate::subject_attribute, GNUNET_ABD_Delegate::subject_attribute_len, and GNUNET_ABD_Delegate::subject_key.

Referenced by sign_cb().

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

◆ GNUNET_ABD_request_cancel()

void GNUNET_ABD_request_cancel ( struct GNUNET_ABD_Request lr)

Cancel pending lookup request.

Parameters
lrthe lookup request to cancel

Cancel pending lookup request.

Parameters
lrthe verify request to cancel

Definition at line 399 of file abd_api.c.

400{
401 struct GNUNET_ABD_Handle *handle = lr->abd_handle;
402
403 GNUNET_CONTAINER_DLL_remove (handle->request_head, handle->request_tail, lr);
404 GNUNET_MQ_discard (lr->env);
405 GNUNET_free (lr);
406}
static struct GNUNET_GNS_LookupWithTldRequest * lr
Handle to lookup request.
Definition: gnunet-gns.c:98
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
void GNUNET_MQ_discard(struct GNUNET_MQ_Envelope *mqm)
Discard the message queue message, free all allocated resources.
Definition: mq.c:285

References GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_MQ_discard(), handle, and lr.

Referenced by do_shutdown().

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