GNUnet  0.20.0

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 Credentail service. More...
 
struct GNUNET_ABD_RequestGNUNET_ABD_verify (struct GNUNET_ABD_Handle *handle, const struct GNUNET_IDENTITY_PublicKey *issuer_key, const char *issuer_attribute, const struct GNUNET_IDENTITY_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_IDENTITY_PublicKey *issuer_key, const char *issuer_attribute, const struct GNUNET_IDENTITY_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_IDENTITY_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_IDENTITY_PrivateKey *issuer, struct GNUNET_IDENTITY_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 355 of file abd_api.c.

356 {
357  struct GNUNET_ABD_Handle *handle;
358 
360  handle->cfg = cfg;
361  reconnect (handle);
362  if (NULL == handle->mq)
363  {
365  return NULL;
366  }
367  return handle;
368 }
static void reconnect(struct GNUNET_ABD_Handle *handle)
Reconnect to ABD service.
Definition: abd_api.c:316
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
#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:97
const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration to use.
Definition: dns_api.c:66
struct GNUNET_MQ_Handle * mq
Connection to DNS service, or NULL.
Definition: dns_api.c:61

References cfg, GNUNET_DNS_Handle::cfg, GNUNET_free, GNUNET_new, handle, GNUNET_DNS_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 Credentail service.

Parameters
handleconnection to shut down

Shutdown connection with the Credentail service.

Parameters
handlehandle of the ABD connection to stop

Definition at line 377 of file abd_api.c.

378 {
379  if (NULL != handle->mq)
380  {
382  handle->mq = NULL;
383  }
384  if (NULL != handle->reconnect_task)
385  {
387  handle->reconnect_task = NULL;
388  }
389  GNUNET_assert (NULL == handle->request_head);
391 }
#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:683
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:975
struct GNUNET_SCHEDULER_Task * reconnect_task
Task to reconnect to the service.
Definition: dns_api.c:81

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

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_IDENTITY_PublicKey issuer_key,
const char *  issuer_attribute,
const struct GNUNET_IDENTITY_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 498 of file abd_api.c.

510 {
511  /* IPC to shorten abd names, return shorten_handle */
512  struct VerifyMessage *v_msg;
513  struct GNUNET_ABD_Request *vr;
514  size_t nlen;
515  size_t clen;
516 
517  if ((NULL == issuer_attribute) || (NULL == delegates))
518  {
519  GNUNET_break (0);
520  return NULL;
521  }
522 
523  clen = GNUNET_ABD_delegates_get_size (delegate_count, delegates);
524 
525  // DEBUG LOG
527  "Trying to verify `%s' in ABD\n",
528  issuer_attribute);
529  nlen = strlen (issuer_attribute) + 1 + clen;
530  if (nlen >= GNUNET_MAX_MESSAGE_SIZE - sizeof (*vr))
531  {
532  GNUNET_break (0);
533  return NULL;
534  }
535  vr = GNUNET_new (struct GNUNET_ABD_Request);
536  vr->abd_handle = handle;
537  vr->verify_proc = proc;
538  vr->proc_cls = proc_cls;
539  vr->int_proc = proc2;
540  vr->proc2_cls = proc2_cls;
541  vr->r_id = handle->r_id_gen++;
542  vr->env =
544  v_msg->id = htonl (vr->r_id);
545  v_msg->subject_key = *subject_key;
546  v_msg->d_count = htonl (delegate_count);
547  v_msg->issuer_key = *issuer_key;
548  v_msg->issuer_attribute_len = htons (strlen (issuer_attribute));
549  v_msg->resolution_algo = htons (direction);
550 
551  GNUNET_memcpy (&v_msg[1], issuer_attribute, strlen (issuer_attribute));
552  GNUNET_ABD_delegates_serialize (delegate_count,
553  delegates,
554  clen,
555  ((char *) &v_msg[1])
556  + strlen (issuer_attribute) + 1);
557  GNUNET_CONTAINER_DLL_insert (handle->request_head, handle->request_tail, vr);
558  if (NULL != handle->mq)
560  return vr;
561 }
#define LOG(kind,...)
Definition: abd_api.c:38
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:112
enum GNUNET_ABD_AlgoDirectionFlags direction
API enum, filled and passed for collect/verify.
Definition: gnunet-abd.c:172
#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:370
#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:63
#define GNUNET_MESSAGE_TYPE_ABD_VERIFY
Handle to a verify request.
Definition: abd_api.c:44
void * proc_cls
verify_proc closure
Definition: abd_api.c:69
GNUNET_ABD_CredentialResultProcessor verify_proc
processor to call on verify result
Definition: abd_api.c:64
struct GNUNET_ABD_Handle * abd_handle
handle to abd service
Definition: abd_api.c:59
GNUNET_ABD_IntermediateResultProcessor int_proc
processor to call on intermediate result
Definition: abd_api.c:74
void * proc2_cls
verify_proc2 closure
Definition: abd_api.c:79
struct GNUNET_MQ_Envelope * env
Envelope with the message for this queue entry.
Definition: abd_api.c:84
uint32_t r_id
request id
Definition: abd_api.c:89
Message from client to Credential service to verify attributes.
Definition: abd.h:75
struct GNUNET_IDENTITY_PublicKey issuer_key
Trust anchor.
Definition: abd.h:89
uint16_t resolution_algo
Direction of the resolution algo.
Definition: abd.h:104
struct GNUNET_IDENTITY_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

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_DNS_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_IDENTITY_PublicKey issuer_key,
const char *  issuer_attribute,
const struct GNUNET_IDENTITY_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 424 of file abd_api.c.

434 {
435  /* IPC to shorten abd names, return shorten_handle */
436  struct CollectMessage *c_msg;
437  struct GNUNET_ABD_Request *vr;
438  size_t nlen;
439 
440  if (NULL == issuer_attribute)
441  {
442  GNUNET_break (0);
443  return NULL;
444  }
445 
446  // DEBUG LOG
448  "Trying to collect `%s' in ABD\n",
449  issuer_attribute);
450  nlen = strlen (issuer_attribute) + 1;
451  if (nlen >= GNUNET_MAX_MESSAGE_SIZE - sizeof (*vr))
452  {
453  GNUNET_break (0);
454  return NULL;
455  }
456  vr = GNUNET_new (struct GNUNET_ABD_Request);
457  vr->abd_handle = handle;
458  vr->verify_proc = proc;
459  vr->proc_cls = proc_cls;
460  vr->int_proc = proc2;
461  vr->proc2_cls = proc2_cls;
462  vr->r_id = handle->r_id_gen++;
463  vr->env =
465  c_msg->id = htonl (vr->r_id);
466  c_msg->subject_key = *subject_key;
467  c_msg->issuer_key = *issuer_key;
468  c_msg->issuer_attribute_len = htons (strlen (issuer_attribute));
469  c_msg->resolution_algo = htons (direction);
470 
471  GNUNET_memcpy (&c_msg[1], issuer_attribute, strlen (issuer_attribute));
472  GNUNET_CONTAINER_DLL_insert (handle->request_head, handle->request_tail, vr);
473  if (NULL != handle->mq)
475  return vr;
476 }
#define GNUNET_MESSAGE_TYPE_ABD_COLLECT
Message from client to Credential service to collect credentials.
Definition: abd.h:36
struct GNUNET_IDENTITY_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_IDENTITY_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_DNS_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_IDENTITY_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_IDENTITY_PrivateKey issuer,
struct GNUNET_IDENTITY_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 198 of file delegate_misc.c.

204 {
205  struct DelegateEntry *del;
206  struct GNUNET_ABD_Delegate *dele;
207  size_t size;
208  int attr_len;
209 
210  if (NULL == sub_attr)
211  {
212  // +1 for \0
213  attr_len = strlen (iss_attr) + 1;
214  }
215  else
216  {
217  // +2 for both strings need to be terminated with \0
218  attr_len = strlen (iss_attr) + strlen (sub_attr) + 2;
219  }
220  size = sizeof (struct DelegateEntry) + attr_len;
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 
233  del = GNUNET_malloc (size);
234  del->purpose.size =
235  htonl (size - sizeof (struct GNUNET_IDENTITY_Signature));
236  del->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_DELEGATE);
237  GNUNET_IDENTITY_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 
252  GNUNET_IDENTITY_sign_ (issuer, &del->purpose, &del->signature);
253 
254  dele = GNUNET_malloc (sizeof (struct GNUNET_ABD_Delegate) + attr_len);
255  dele->signature = del->signature;
256  dele->expiration = *expiration;
258 
259  dele->subject_key = *subject;
260 
261  // Copy the combined string at the part in the memory where the struct ends
262  GNUNET_memcpy (&dele[1], tmp_str, attr_len);
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 
277  GNUNET_free (del);
278  return dele;
279 }
#define GNUNET_SIGNATURE_PURPOSE_DELEGATE
Signature for a GNUnet credential (Reclaim)
static char * expiration
Credential TTL.
Definition: gnunet-abd.c:96
static char * subject
Subject pubkey string.
Definition: gnunet-abd.c:86
static int del
Desired action is to remove a record.
enum GNUNET_GenericReturnValue GNUNET_IDENTITY_sign_(const struct GNUNET_IDENTITY_PrivateKey *priv, const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, struct GNUNET_IDENTITY_Signature *sig)
Sign a given block.
enum GNUNET_GenericReturnValue GNUNET_IDENTITY_key_get_public(const struct GNUNET_IDENTITY_PrivateKey *privkey, struct GNUNET_IDENTITY_PublicKey *key)
Retrieves the public key representation of a private key.
Definition: identity_api.c:179
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
const char * subject_attribute
The subject attribute.
const char * issuer_attribute
The issuer attribute.
struct GNUNET_IDENTITY_Signature signature
Signature of this credential.
uint32_t issuer_attribute_len
Length of the issuer attribute.
uint32_t subject_attribute_len
Length of the subject attribute.
struct GNUNET_IDENTITY_PublicKey subject_key
Public key of the subject this credential was issued to.
struct GNUNET_TIME_Absolute expiration
Expiration of this credential.
struct GNUNET_IDENTITY_PublicKey issuer_key
The issuer of the credential.
An identity signature as per LSD0001.

References del, expiration, GNUNET_ABD_Delegate::expiration, GNUNET_free, GNUNET_htonll(), GNUNET_IDENTITY_key_get_public(), GNUNET_IDENTITY_sign_(), 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 400 of file abd_api.c.

401 {
402  struct GNUNET_ABD_Handle *handle = lr->abd_handle;
403 
404  GNUNET_CONTAINER_DLL_remove (handle->request_head, handle->request_tail, lr);
405  GNUNET_MQ_discard (lr->env);
406  GNUNET_free (lr);
407 }
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: