GNUnet  0.11.x
Data Structures | Typedefs | Enumerations | Functions
Credential service

Credentials. More...

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_CRYPTO_EcdsaPublicKey *issuer_key, const char *issuer_attribute, const struct GNUNET_CRYPTO_EcdsaPublicKey *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_EcdsaPublicKey *issuer_key, const char *issuer_attribute, const struct GNUNET_CRYPTO_EcdsaPrivateKey *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_EcdsaPublicKey *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_EcdsaPrivateKey *issuer, struct GNUNET_CRYPTO_EcdsaPublicKey *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

Credentials.

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 265 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 274 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 287 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 297 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 61 of file gnunet_abd_service.h.

62 {
63 
64  // Subject had credentials before, but have been revoked now
66 
67  // Subject flag indicates that the subject is a holder of this credential and may present it as such
69 
70  // Issuer flag is used to signify that the subject is allowed to issue this credential and delegate issuance
72 
73 };

◆ GNUNET_ABD_AlgoDirectionFlags

Enumerator
GNUNET_ABD_FLAG_FORWARD 
GNUNET_ABD_FLAG_BACKWARD 

Definition at line 226 of file gnunet_abd_service.h.

227 {
228 
229  // Subject had credentials before, but have been revoked now
231 
232  // Subject flag indicates that the subject is a holder of this credential and may present it as such
234 
235 };

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.

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

Referenced by run().

356 {
357  struct GNUNET_ABD_Handle *handle;
358 
359  handle = GNUNET_new (struct GNUNET_ABD_Handle);
360  handle->cfg = cfg;
361  reconnect (handle);
362  if (NULL == handle->mq)
363  {
364  GNUNET_free (handle);
365  return NULL;
366  }
367  return handle;
368 }
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration to use.
Definition: abd_api.c:102
#define GNUNET_new(type)
Allocate a struct or union of the given type.
struct GNUNET_MQ_Handle * mq
Connection to service (if available).
Definition: abd_api.c:107
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
static void reconnect(struct GNUNET_ABD_Handle *handle)
Reconnect to ABD service.
Definition: abd_api.c:316
Connection to the ABD service.
Definition: abd_api.c:96
#define GNUNET_free(ptr)
Wrapper around free.
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.

References GNUNET_assert, GNUNET_free, GNUNET_MQ_destroy(), GNUNET_SCHEDULER_cancel(), GNUNET_ABD_Handle::mq, GNUNET_ABD_Handle::reconnect_task, and GNUNET_ABD_Handle::request_head.

Referenced by do_shutdown().

378 {
379  if (NULL != handle->mq)
380  {
381  GNUNET_MQ_destroy (handle->mq);
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);
390  GNUNET_free (handle);
391 }
struct GNUNET_ABD_Request * request_head
Head of linked list of active verify requests.
Definition: abd_api.c:112
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
struct GNUNET_MQ_Handle * mq
Connection to service (if available).
Definition: abd_api.c:107
struct GNUNET_SCHEDULER_Task * reconnect_task
Reconnect task.
Definition: abd_api.c:122
void GNUNET_MQ_destroy(struct GNUNET_MQ_Handle *mq)
Destroy the message queue.
Definition: mq.c:824
#define GNUNET_free(ptr)
Wrapper around free.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:966
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_EcdsaPublicKey issuer_key,
const char *  issuer_attribute,
const struct GNUNET_CRYPTO_EcdsaPublicKey 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.

References GNUNET_ABD_Request::abd_handle, VerifyMessage::d_count, 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_ABD_Handle::mq, GNUNET_ABD_Request::proc2_cls, GNUNET_ABD_Request::proc_cls, GNUNET_ABD_Request::r_id, GNUNET_ABD_Handle::r_id_gen, GNUNET_ABD_Handle::request_head, GNUNET_ABD_Handle::request_tail, VerifyMessage::resolution_algo, VerifyMessage::subject_key, and GNUNET_ABD_Request::verify_proc.

Referenced by run().

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);
558  if (NULL != handle->mq)
559  GNUNET_MQ_send_copy (handle->mq, vr->env);
560  return vr;
561 }
Message from client to Credential service to verify attributes.
Definition: abd.h:74
struct GNUNET_ABD_Handle * abd_handle
handle to abd service
Definition: abd_api.c:59
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
struct GNUNET_ABD_Request * request_head
Head of linked list of active verify requests.
Definition: abd_api.c:112
uint16_t issuer_attribute_len
Length of the issuer attribute.
Definition: abd.h:99
uint16_t resolution_algo
Direction of the resolution algo.
Definition: abd.h:104
uint32_t id
Unique identifier for this request (for key collisions).
Definition: abd.h:109
#define LOG(kind,...)
Definition: abd_api.c:38
void * proc2_cls
verify_proc2 closure
Definition: abd_api.c:79
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
struct GNUNET_CRYPTO_EcdsaPublicKey subject_key
Subject public key.
Definition: abd.h:84
#define GNUNET_new(type)
Allocate a struct or union of the given type.
GNUNET_ABD_IntermediateResultProcessor int_proc
processor to call on intermediate result
Definition: abd_api.c:74
Handle to a verify request.
Definition: abd_api.c:43
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
void * proc_cls
verify_proc closure
Definition: abd_api.c:69
enum GNUNET_ABD_AlgoDirectionFlags direction
API enum, filled and passed for collect/verify.
Definition: gnunet-abd.c:172
#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:52
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.
struct GNUNET_MQ_Handle * mq
Connection to service (if available).
Definition: abd_api.c:107
GNUNET_ABD_CredentialResultProcessor verify_proc
processor to call on verify result
Definition: abd_api.c:64
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
static char * issuer_key
Issuer pubkey string.
Definition: gnunet-abd.c:112
#define GNUNET_MESSAGE_TYPE_ABD_VERIFY
#define GNUNET_MAX_MESSAGE_SIZE
Largest supported message (to be precise, one byte more than the largest possible message...
uint32_t d_count
Number of delegates.
Definition: abd.h:94
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:432
struct GNUNET_ABD_Request * request_tail
Tail of linked list of active verify requests.
Definition: abd_api.c:117
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.
uint32_t r_id_gen
Request Id generator.
Definition: abd_api.c:132
struct GNUNET_MQ_Envelope * env
Envelope with the message for this queue entry.
Definition: abd_api.c:84
struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key
Trust anchor.
Definition: abd.h:89
uint32_t r_id
request id
Definition: abd_api.c:89
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_EcdsaPublicKey issuer_key,
const char *  issuer_attribute,
const struct GNUNET_CRYPTO_EcdsaPrivateKey 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.

References GNUNET_ABD_Request::abd_handle, 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, issuer_key, CollectMessage::issuer_key, LOG, GNUNET_ABD_Handle::mq, GNUNET_ABD_Request::proc2_cls, GNUNET_ABD_Request::proc_cls, GNUNET_ABD_Request::r_id, GNUNET_ABD_Handle::r_id_gen, GNUNET_ABD_Handle::request_head, GNUNET_ABD_Handle::request_tail, CollectMessage::resolution_algo, CollectMessage::subject_key, and GNUNET_ABD_Request::verify_proc.

Referenced by identity_cb().

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));
473  if (NULL != handle->mq)
474  GNUNET_MQ_send_copy (handle->mq, vr->env);
475  return vr;
476 }
struct GNUNET_ABD_Handle * abd_handle
handle to abd service
Definition: abd_api.c:59
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
struct GNUNET_ABD_Request * request_head
Head of linked list of active verify requests.
Definition: abd_api.c:112
#define LOG(kind,...)
Definition: abd_api.c:38
void * proc2_cls
verify_proc2 closure
Definition: abd_api.c:79
struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key
Trust anchor.
Definition: abd.h:50
Message from client to Credential service to collect credentials.
Definition: abd.h:35
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
GNUNET_ABD_IntermediateResultProcessor int_proc
processor to call on intermediate result
Definition: abd_api.c:74
Handle to a verify request.
Definition: abd_api.c:43
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
void * proc_cls
verify_proc closure
Definition: abd_api.c:69
enum GNUNET_ABD_AlgoDirectionFlags direction
API enum, filled and passed for collect/verify.
Definition: gnunet-abd.c:172
#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:52
struct GNUNET_MQ_Handle * mq
Connection to service (if available).
Definition: abd_api.c:107
uint16_t resolution_algo
Direction of the resolution algo.
Definition: abd.h:60
GNUNET_ABD_CredentialResultProcessor verify_proc
processor to call on verify result
Definition: abd_api.c:64
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
static char * issuer_key
Issuer pubkey string.
Definition: gnunet-abd.c:112
uint32_t id
Unique identifier for this request (for key collisions).
Definition: abd.h:65
#define GNUNET_MAX_MESSAGE_SIZE
Largest supported message (to be precise, one byte more than the largest possible message...
struct GNUNET_CRYPTO_EcdsaPrivateKey subject_key
Subject public key.
Definition: abd.h:45
#define GNUNET_MESSAGE_TYPE_ABD_COLLECT
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:432
struct GNUNET_ABD_Request * request_tail
Tail of linked list of active verify requests.
Definition: abd_api.c:117
uint32_t r_id_gen
Request Id generator.
Definition: abd_api.c:132
uint16_t issuer_attribute_len
Length of the issuer attribute.
Definition: abd.h:55
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
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_EcdsaPublicKey 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_EcdsaPrivateKey issuer,
struct GNUNET_CRYPTO_EcdsaPublicKey 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
attributethe name of the attribute
expirationthe TTL of the credential
Returns
handle to the queued request
Parameters
issuerthe ego that should be used to issue the attribute
subjectthe subject of the attribute
iss_attrthe name of the attribute
Returns
handle to the queued request

Definition at line 189 of file delegate_misc.c.

References GNUNET_TIME_Absolute::abs_value_us, del, expiration, GNUNET_ABD_Delegate::expiration, DelegateEntry::expiration, GNUNET_break, GNUNET_CRYPTO_ecdsa_key_get_public(), GNUNET_CRYPTO_ecdsa_sign(), GNUNET_free, GNUNET_htonll(), GNUNET_malloc, GNUNET_memcpy, GNUNET_OK, GNUNET_SIGNATURE_PURPOSE_DELEGATE, GNUNET_ABD_Delegate::issuer_attribute, GNUNET_ABD_Delegate::issuer_attribute_len, DelegateEntry::issuer_attribute_len, GNUNET_ABD_Delegate::issuer_key, DelegateEntry::issuer_key, GNUNET_CRYPTO_EccSignaturePurpose::purpose, DelegateEntry::purpose, GNUNET_ABD_Delegate::signature, DelegateEntry::signature, size, GNUNET_CRYPTO_EccSignaturePurpose::size, subject, GNUNET_ABD_Delegate::subject_attribute, GNUNET_ABD_Delegate::subject_attribute_len, DelegateEntry::subject_attribute_len, GNUNET_ABD_Delegate::subject_key, and DelegateEntry::subject_key.

Referenced by sign_cb().

195 {
196  struct DelegateEntry *del;
197  struct GNUNET_ABD_Delegate *dele;
198  size_t size;
199  int attr_len;
200 
201  if (NULL == sub_attr)
202  {
203  // +1 for \0
204  attr_len = strlen (iss_attr) + 1;
205  }
206  else
207  {
208  // +2 for both strings need to be terminated with \0
209  attr_len = strlen (iss_attr) + strlen (sub_attr) + 2;
210  }
211  size = sizeof (struct DelegateEntry) + attr_len;
212 
213  char tmp_str[attr_len];
214  GNUNET_memcpy (tmp_str, iss_attr, strlen (iss_attr));
215  if (NULL != sub_attr)
216  {
217  tmp_str[strlen (iss_attr)] = '\0';
218  GNUNET_memcpy (tmp_str + strlen (iss_attr) + 1,
219  sub_attr,
220  strlen (sub_attr));
221  }
222  tmp_str[attr_len - 1] = '\0';
223 
224  del = GNUNET_malloc (size);
225  del->purpose.size =
226  htonl (size - sizeof (struct GNUNET_CRYPTO_EcdsaSignature));
229  del->subject_key = *subject;
230  del->expiration = GNUNET_htonll (expiration->abs_value_us);
231  del->issuer_attribute_len = htonl (strlen (iss_attr) + 1);
232  if (NULL == sub_attr)
233  {
234  del->subject_attribute_len = htonl (0);
235  }
236  else
237  {
238  del->subject_attribute_len = htonl (strlen (sub_attr) + 1);
239  }
240 
241  GNUNET_memcpy (&del[1], tmp_str, attr_len);
242 
243  if (GNUNET_OK !=
244  GNUNET_CRYPTO_ecdsa_sign (issuer, &del->purpose, &del->signature))
245  {
246  GNUNET_break (0);
247  GNUNET_free (del);
248  return NULL;
249  }
250 
251  dele = GNUNET_malloc (sizeof (struct GNUNET_ABD_Delegate) + attr_len);
252  dele->signature = del->signature;
253  dele->expiration = *expiration;
255 
256  dele->subject_key = *subject;
257 
258  // Copy the combined string at the part in the memory where the struct ends
259  GNUNET_memcpy (&dele[1], tmp_str, attr_len);
260 
261  dele->issuer_attribute = (char *) &dele[1];
262  dele->issuer_attribute_len = strlen (iss_attr);
263  if (NULL == sub_attr)
264  {
265  dele->subject_attribute = NULL;
266  dele->subject_attribute_len = 0;
267  }
268  else
269  {
270  dele->subject_attribute = (char *) &dele[1] + strlen (iss_attr) + 1;
271  dele->subject_attribute_len = strlen (sub_attr);
272  }
273 
274  GNUNET_free (del);
275  return dele;
276 }
struct GNUNET_CRYPTO_EcdsaPublicKey subject_key
Public key of the subject this credential was issued to.
uint32_t purpose
What does this signature vouch for? This must contain a GNUNET_SIGNATURE_PURPOSE_XXX constant (from g...
struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key
Public key of the issuer.
Definition: abd.h:260
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
uint64_t expiration
Expiration time of this credential.
Definition: abd.h:270
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
struct GNUNET_CRYPTO_EcdsaSignature signature
Signature of this credential.
struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key
The issuer of the credential.
uint64_t abs_value_us
The actual value.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
struct GNUNET_CRYPTO_EcdsaPublicKey subject_key
Public key of the subject this credential was issued to.
Definition: abd.h:265
int GNUNET_CRYPTO_ecdsa_sign(const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, struct GNUNET_CRYPTO_EcdsaSignature *sig)
ECDSA Sign a given block.
Definition: crypto_ecc.c:701
static int del
Desired action is to remove a record.
uint32_t subject_attribute_len
Length of the subject attribute.
an ECC signature using ECDSA
uint32_t size
How many bytes does this signature sign? (including this purpose header); in network byte order (!)...
struct GNUNET_CRYPTO_EcdsaSignature signature
The signature for this credential by the issuer.
Definition: abd.h:250
static char * expiration
Credential TTL.
Definition: gnunet-abd.c:96
uint64_t GNUNET_htonll(uint64_t n)
Convert unsigned 64-bit integer to network byte order.
Definition: common_endian.c:35
uint32_t issuer_attribute_len
Length of the issuer attribute.
static unsigned int size
Size of the "table".
Definition: peer.c:67
void GNUNET_CRYPTO_ecdsa_key_get_public(const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, struct GNUNET_CRYPTO_EcdsaPublicKey *pub)
Extract the public key for the given private key.
Definition: crypto_ecc.c:172
const char * subject_attribute
The subject attribute.
static char * subject
Subject pubkey string.
Definition: gnunet-abd.c:86
uint32_t subject_attribute_len
Issuer attribute length.
Definition: abd.h:280
struct GNUNET_CRYPTO_EccSignaturePurpose purpose
Signature meta.
Definition: abd.h:255
struct GNUNET_TIME_Absolute expiration
Expiration of this credential.
uint32_t issuer_attribute_len
Issuer subject attribute length.
Definition: abd.h:275
const char * issuer_attribute
The issuer attribute.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
#define GNUNET_SIGNATURE_PURPOSE_DELEGATE
Signature for a GNUnet credential.
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.

References GNUNET_ABD_Request::abd_handle, GNUNET_ABD_Request::env, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_MQ_discard(), handle, GNUNET_ABD_Handle::request_head, and GNUNET_ABD_Handle::request_tail.

Referenced by do_shutdown().

401 {
402  struct GNUNET_ABD_Handle *handle = lr->abd_handle;
403 
405  GNUNET_MQ_discard (lr->env);
406  GNUNET_free (lr);
407 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
struct GNUNET_ABD_Handle * abd_handle
handle to abd service
Definition: abd_api.c:59
struct GNUNET_ABD_Request * request_head
Head of linked list of active verify requests.
Definition: abd_api.c:112
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
void GNUNET_MQ_discard(struct GNUNET_MQ_Envelope *mqm)
Discard the message queue message, free all allocated resources.
Definition: mq.c:321
Connection to the ABD service.
Definition: abd_api.c:96
struct GNUNET_ABD_Request * request_tail
Tail of linked list of active verify requests.
Definition: abd_api.c:117
struct GNUNET_MQ_Envelope * env
Envelope with the message for this queue entry.
Definition: abd_api.c:84
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function: