[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] 51/171: -towards type4
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] 51/171: -towards type4 |
Date: |
Thu, 04 Jan 2018 16:09:19 +0100 |
This is an automated email from the git hooks/post-receive script.
martin-schanzenbach pushed a commit to branch master
in repository gnunet.
commit 02066879bd7eb841d01e1359021de3bc3aca11e0
Author: Schanzenbach, Martin <address@hidden>
AuthorDate: Wed Dec 14 16:20:54 2016 +0100
-towards type4
---
src/credential/Makefile.am | 1 +
src/credential/credential_serialization.c | 129 ++++++-
src/credential/credential_serialization.h | 91 +++--
src/credential/gnunet-service-credential.c | 520 ++++++++++++++++-----------
src/credential/plugin_gnsrecord_credential.c | 168 +++++++--
src/credential/test_credential_verify.sh | 4 +-
src/include/gnunet_credential_service.h | 40 +++
7 files changed, 685 insertions(+), 268 deletions(-)
diff --git a/src/credential/Makefile.am b/src/credential/Makefile.am
index 51dbb34d7..5852bd0a0 100644
--- a/src/credential/Makefile.am
+++ b/src/credential/Makefile.am
@@ -55,6 +55,7 @@ gnunet_credential_LDADD = \
libgnunet_plugin_gnsrecord_credential_la_SOURCES = \
plugin_gnsrecord_credential.c
libgnunet_plugin_gnsrecord_credential_la_LIBADD = \
+ libgnunetcredential.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(LTLIBINTL)
libgnunet_plugin_gnsrecord_credential_la_LDFLAGS = \
diff --git a/src/credential/credential_serialization.c
b/src/credential/credential_serialization.c
index 2fbcebd9f..99138441e 100644
--- a/src/credential/credential_serialization.c
+++ b/src/credential/credential_serialization.c
@@ -32,7 +32,21 @@
GNUNET_NETWORK_STRUCT_BEGIN
-struct NetworkRecord
+struct DelegationRecordData
+{
+ /**
+ * Subject key
+ */
+ struct GNUNET_CRYPTO_EcdsaPublicKey subject_key;
+
+ /**
+ * Subject attributes
+ */
+ uint32_t subject_attribute_len GNUNET_PACKED;
+};
+
+
+struct ChainEntry
{
/**
* Issuer key
@@ -57,6 +71,113 @@ struct NetworkRecord
GNUNET_NETWORK_STRUCT_END
+
+/**
+ * Calculate how many bytes we will need to serialize
+ * the given delegation chain and credential
+ *
+ * @param d_count number of delegation chain entries
+ * @param dd array of #GNUNET_CREDENTIAL_Delegation
+ * @param cd a #GNUNET_CREDENTIAL_Credential
+ * @return the required size to serialize
+ */
+size_t
+GNUNET_CREDENTIAL_delegation_set_get_size (unsigned int ds_count,
+ const struct
GNUNET_CREDENTIAL_DelegationSetRecord *dsr)
+{
+ unsigned int i;
+ size_t ret;
+
+ ret = sizeof (struct DelegationRecordData) * (ds_count);
+
+ for (i=0; i<ds_count;i++)
+ {
+ GNUNET_assert ((ret + dsr[i].subject_attribute_len) >= ret);
+ ret += dsr[i].subject_attribute_len;
+ }
+ return ret;
+}
+
+/**
+ * Serizalize the given delegation chain entries and credential
+ *
+ * @param d_count number of delegation chain entries
+ * @param dd array of #GNUNET_CREDENTIAL_Delegation
+ * @param cd a #GNUNET_CREDENTIAL_Credential
+ * @param dest_size size of the destination
+ * @param dest where to store the result
+ * @return the size of the data, -1 on failure
+ */
+ssize_t
+GNUNET_CREDENTIAL_delegation_set_serialize (unsigned int d_count,
+ const struct
GNUNET_CREDENTIAL_DelegationSetRecord *dsr,
+ size_t dest_size,
+ char *dest)
+{
+ struct DelegationRecordData rec;
+ unsigned int i;
+ size_t off;
+
+ off = 0;
+ for (i=0;i<d_count;i++)
+ {
+ rec.subject_attribute_len = htonl ((uint32_t)
dsr[i].subject_attribute_len);
+ rec.subject_key = dsr[i].subject_key;
+ if (off + sizeof (rec) > dest_size)
+ return -1;
+ GNUNET_memcpy (&dest[off],
+ &rec,
+ sizeof (rec));
+ off += sizeof (rec);
+ if (0 == dsr[i].subject_attribute_len)
+ continue;
+ if (off + dsr[i].subject_attribute_len > dest_size)
+ return -1;
+ GNUNET_memcpy (&dest[off],
+ dsr[i].subject_attribute,
+ dsr[i].subject_attribute_len);
+ off += dsr[i].subject_attribute_len;
+ }
+ return off;
+}
+
+
+/**
+ * Deserialize the given destination
+ *
+ * @param len size of the serialized delegation chain and cred
+ * @param src the serialized data
+ * @param d_count the number of delegation chain entries
+ * @param dd where to put the delegation chain entries
+ * @param cd where to put the credential data
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
+ */
+int
+GNUNET_CREDENTIAL_delegation_set_deserialize (size_t len,
+ const char *src,
+ unsigned int d_count,
+ struct
GNUNET_CREDENTIAL_DelegationSetRecord *dsr)
+{
+ struct DelegationRecordData rec;
+ unsigned int i;
+ size_t off;
+
+ off = 0;
+ for (i=0;i<d_count;i++)
+ {
+ if (off + sizeof (rec) > len)
+ return GNUNET_SYSERR;
+ GNUNET_memcpy (&rec, &src[off], sizeof (rec));
+ dsr[i].subject_key = rec.subject_key;
+ off += sizeof (rec);
+ dsr[i].subject_attribute_len = ntohl ((uint32_t)
rec.subject_attribute_len);
+ if (off + dsr[i].subject_attribute_len > len)
+ return GNUNET_SYSERR;
+ dsr[i].subject_attribute = &src[off];
+ off += dsr[i].subject_attribute_len;
+ }
+ return GNUNET_OK;
+}
/**
* Calculate how many bytes we will need to serialize
* the given delegation chain and credential
@@ -74,7 +195,7 @@ GNUNET_CREDENTIAL_delegation_chain_get_size (unsigned int
d_count,
unsigned int i;
size_t ret;
- ret = sizeof (struct NetworkRecord) * (d_count + 1);
+ ret = sizeof (struct ChainEntry) * (d_count + 1);
for (i=0; i<d_count;i++)
{
@@ -105,7 +226,7 @@ GNUNET_CREDENTIAL_delegation_chain_serialize (unsigned int
d_count,
size_t dest_size,
char *dest)
{
- struct NetworkRecord rec;
+ struct ChainEntry rec;
unsigned int i;
size_t off;
@@ -174,7 +295,7 @@ GNUNET_CREDENTIAL_delegation_chain_deserialize (size_t len,
struct
GNUNET_CREDENTIAL_Delegation *dd,
struct
GNUNET_CREDENTIAL_Credential *cd)
{
- struct NetworkRecord rec;
+ struct ChainEntry rec;
unsigned int i;
size_t off;
diff --git a/src/credential/credential_serialization.h
b/src/credential/credential_serialization.h
index 7e984ce0a..7f6d0dda9 100644
--- a/src/credential/credential_serialization.h
+++ b/src/credential/credential_serialization.h
@@ -32,50 +32,93 @@
/**
* Calculate how many bytes we will need to serialize
- * the given delegation chain and credential
+ * the given delegation record
*
- * @param d_count number of delegation chain entries
- * @param dd array of #GNUNET_CREDENTIAL_Delegation
- * @param cd a #GNUNET_CREDENTIAL_Credential
+ * @param ds_count number of delegation chain entries
+ * @param dsr array of #GNUNET_CREDENTIAL_Delegation
* @return the required size to serialize
*/
size_t
-GNUNET_CREDENTIAL_delegation_chain_get_size (unsigned int d_count,
- const struct
GNUNET_CREDENTIAL_Delegation *dd,
- const struct
GNUNET_CREDENTIAL_Credential *cd);
+GNUNET_CREDENTIAL_delegation_set_get_size (unsigned int ds_count,
+ const struct
GNUNET_CREDENTIAL_DelegationSetRecord *dsr);
/**
- * Serizalize the given delegation chain entries and credential
+ * Serizalize the given delegation record entries
*
* @param d_count number of delegation chain entries
- * @param dd array of #GNUNET_CREDENTIAL_Delegation
- * @param cd a #GNUNET_CREDENTIAL_Credential
+ * @param dsr array of #GNUNET_CREDENTIAL_Delegation
* @param dest_size size of the destination
* @param dest where to store the result
* @return the size of the data, -1 on failure
*/
ssize_t
-GNUNET_CREDENTIAL_delegation_chain_serialize (unsigned int d_count,
- const struct
GNUNET_CREDENTIAL_Delegation *dd,
- const struct
GNUNET_CREDENTIAL_Credential *cd,
- size_t dest_size,
- char *dest);
+GNUNET_CREDENTIAL_delegation_set_serialize (unsigned int d_count,
+ const struct
GNUNET_CREDENTIAL_DelegationSetRecord *dsr,
+ size_t dest_size,
+ char *dest);
/**
* Deserialize the given destination
*
- * @param len size of the serialized delegation chain and cred
+ * @param len size of the serialized delegation recird
* @param src the serialized data
* @param d_count the number of delegation chain entries
- * @param dd where to put the delegation chain entries
- * @param cd where to put the credential data
+ * @param dsr where to put the delegation chain entries
* @return #GNUNET_OK on success, #GNUNET_SYSERR on error
*/
int
-GNUNET_CREDENTIAL_delegation_chain_deserialize (size_t len,
- const char *src,
- unsigned int d_count,
- struct
GNUNET_CREDENTIAL_Delegation *dd,
- struct
GNUNET_CREDENTIAL_Credential *cd);
-/* end of credential_serialization.h */
+GNUNET_CREDENTIAL_delegation_set_deserialize (size_t len,
+ const char *src,
+ unsigned int d_count,
+ struct
GNUNET_CREDENTIAL_DelegationSetRecord *dsr);
+
+ /**
+ * Calculate how many bytes we will need to serialize
+ * the given delegation chain and credential
+ *
+ * @param d_count number of delegation chain entries
+ * @param dd array of #GNUNET_CREDENTIAL_Delegation
+ * @param cd a #GNUNET_CREDENTIAL_Credential
+ * @return the required size to serialize
+ */
+ size_t
+ GNUNET_CREDENTIAL_delegation_chain_get_size (unsigned int d_count,
+ const struct
GNUNET_CREDENTIAL_Delegation *dd,
+ const struct
GNUNET_CREDENTIAL_Credential *cd);
+
+ /**
+ * Serizalize the given delegation chain entries and credential
+ *
+ * @param d_count number of delegation chain entries
+ * @param dd array of #GNUNET_CREDENTIAL_Delegation
+ * @param cd a #GNUNET_CREDENTIAL_Credential
+ * @param dest_size size of the destination
+ * @param dest where to store the result
+ * @return the size of the data, -1 on failure
+ */
+ ssize_t
+ GNUNET_CREDENTIAL_delegation_chain_serialize (unsigned int d_count,
+ const struct
GNUNET_CREDENTIAL_Delegation *dd,
+ const struct
GNUNET_CREDENTIAL_Credential *cd,
+ size_t dest_size,
+ char *dest);
+
+
+ /**
+ * Deserialize the given destination
+ *
+ * @param len size of the serialized delegation chain and cred
+ * @param src the serialized data
+ * @param d_count the number of delegation chain entries
+ * @param dd where to put the delegation chain entries
+ * @param cd where to put the credential data
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
+ */
+ int
+ GNUNET_CREDENTIAL_delegation_chain_deserialize (size_t len,
+ const char *src,
+ unsigned int d_count,
+ struct
GNUNET_CREDENTIAL_Delegation *dd,
+ struct
GNUNET_CREDENTIAL_Credential *cd);
+ /* end of credential_serialization.h */
diff --git a/src/credential/gnunet-service-credential.c
b/src/credential/gnunet-service-credential.c
index 8f7d71b28..8843abfd6 100644
--- a/src/credential/gnunet-service-credential.c
+++ b/src/credential/gnunet-service-credential.c
@@ -46,9 +46,22 @@
struct VerifyRequestHandle;
-struct GNUNET_CREDENTIAL_DelegationChainEntry
+struct DelegationSetEntry;
+
+
+struct DelegationChainEntry
{
/**
+ * DLL
+ */
+ struct DelegationChainEntry *next;
+
+ /**
+ * DLL
+ */
+ struct DelegationChainEntry *prev;
+
+ /**
* The issuer
*/
struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key;
@@ -97,8 +110,8 @@ struct CredentialRecordEntry
};
/**
- * DLL for delegations - Used as a queue
- * Insert tail - Pop head
+ * DLL used for delegations
+ * Used for OR delegations
*/
struct DelegationQueueEntry
{
@@ -113,16 +126,43 @@ struct DelegationQueueEntry
struct DelegationQueueEntry *prev;
/**
- * Children of this attribute
+ * Sets under this Queue
*/
- struct DelegationQueueEntry *children_head;
+ struct DelegationSetEntry *set_entries_head;
/**
- * Children of this attribute
+ * Sets under this Queue
*/
- struct DelegationQueueEntry *children_tail;
+ struct DelegationSetEntry *set_entries_tail;
/**
+ * Parent set
+ */
+ struct DelegationSetEntry *parent_set;
+
+ /**
+ * Required solutions
+ */
+ uint32_t required_solutions;
+};
+
+/**
+ * DLL for delegation sets
+ * Used for AND delegation set
+ */
+struct DelegationSetEntry
+{
+ /**
+ * DLL
+ */
+ struct DelegationSetEntry *next;
+
+ /**
+ * DLL
+ */
+ struct DelegationSetEntry *prev;
+
+ /**
* GNS handle
*/
struct GNUNET_GNS_LookupRequest *lookup_request;
@@ -143,6 +183,21 @@ struct DelegationQueueEntry
struct GNUNET_CRYPTO_EcdsaPublicKey *issuer_key;
/**
+ * Queue entries of this set
+ */
+ struct DelegationQueueEntry *queue_entries_head;
+
+ /**
+ * Queue entries of this set
+ */
+ struct DelegationQueueEntry *queue_entries_tail;
+
+ /**
+ * Parent QueueEntry
+ */
+ struct DelegationQueueEntry *parent_queue_entry;
+
+ /**
* Issuer attribute delegated to
*/
char *issuer_attribute;
@@ -161,16 +216,12 @@ struct DelegationQueueEntry
* Still to resolve delegation as string
*/
char *unresolved_attribute_delegation;
-
+
/**
* The delegation chain entry
*/
- struct GNUNET_CREDENTIAL_DelegationChainEntry *delegation_chain_entry;
+ struct DelegationChainEntry *delegation_chain_entry;
- /**
- * Delegation chain length until now
- */
- uint32_t d_count;
};
@@ -194,18 +245,32 @@ struct VerifyRequestHandle
* Handle to the requesting client
*/
struct GNUNET_SERVICE_Client *client;
-
+
/**
* GNS handle
*/
struct GNUNET_GNS_LookupRequest *lookup_request;
+ /**
+ * Size of delegation tree
+ */
+ uint32_t delegation_chain_size;
+
+ /**
+ * Children of this attribute
+ */
+ struct DelegationChainEntry *delegation_chain_head;
+
+ /**
+ * Children of this attribute
+ */
+ struct DelegationChainEntry *delegation_chain_tail;
/**
* Issuer public key
*/
struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key;
-
+
/**
* Issuer attribute
*/
@@ -227,15 +292,10 @@ struct VerifyRequestHandle
struct CredentialRecordEntry *cred_chain_tail;
/**
- * Delegation Queue
+ * Root Delegation Set
*/
- struct DelegationQueueEntry *chain_start;
-
- /**
- * Delegation Queue
- */
- struct DelegationQueueEntry *chain_end;
-
+ struct DelegationSetEntry *root_set;
+
/**
* Current Delegation Pointer
*/
@@ -252,11 +312,6 @@ struct VerifyRequestHandle
uint32_t credential_size;
/**
- * Length of found delegation chain
- */
- uint32_t d_count;
-
- /**
* request id
*/
uint32_t request_id;
@@ -291,43 +346,56 @@ static struct GNUNET_GNS_Handle *gns;
static void
-cleanup_delegation_queue (struct DelegationQueueEntry *dq_entry)
+cleanup_delegation_set (struct DelegationSetEntry *ds_entry)
{
- struct DelegationQueueEntry *child;
- if (NULL == dq_entry)
+ struct DelegationQueueEntry *dq_entry;
+ struct DelegationSetEntry *child;
+
+ if (NULL == ds_entry)
return;
- for (child = dq_entry->children_head; NULL != child; child =
dq_entry->children_head)
+ for (dq_entry = ds_entry->queue_entries_head;
+ NULL != dq_entry;
+ dq_entry = ds_entry->queue_entries_head)
{
- GNUNET_CONTAINER_DLL_remove (dq_entry->children_head,
- dq_entry->children_tail,
- child);
- cleanup_delegation_queue (child);
+ GNUNET_CONTAINER_DLL_remove (ds_entry->queue_entries_head,
+ ds_entry->queue_entries_tail,
+ dq_entry);
+ for (child = dq_entry->set_entries_head;
+ NULL != child;
+ child = dq_entry->set_entries_head)
+ {
+ GNUNET_CONTAINER_DLL_remove (dq_entry->set_entries_head,
+ dq_entry->set_entries_tail,
+ child);
+ cleanup_delegation_set (child);
+ }
+ GNUNET_free (dq_entry);
}
- if (NULL != dq_entry->issuer_key)
- GNUNET_free (dq_entry->issuer_key);
- if (NULL != dq_entry->lookup_attribute)
- GNUNET_free (dq_entry->lookup_attribute);
- if (NULL != dq_entry->issuer_attribute)
- GNUNET_free (dq_entry->issuer_attribute);
- if (NULL != dq_entry->unresolved_attribute_delegation)
- GNUNET_free (dq_entry->unresolved_attribute_delegation);
- if (NULL != dq_entry->attr_trailer)
- GNUNET_free (dq_entry->attr_trailer);
- if (NULL != dq_entry->lookup_request)
+ if (NULL != ds_entry->issuer_key)
+ GNUNET_free (ds_entry->issuer_key);
+ if (NULL != ds_entry->lookup_attribute)
+ GNUNET_free (ds_entry->lookup_attribute);
+ if (NULL != ds_entry->issuer_attribute)
+ GNUNET_free (ds_entry->issuer_attribute);
+ if (NULL != ds_entry->unresolved_attribute_delegation)
+ GNUNET_free (ds_entry->unresolved_attribute_delegation);
+ if (NULL != ds_entry->attr_trailer)
+ GNUNET_free (ds_entry->attr_trailer);
+ if (NULL != ds_entry->lookup_request)
{
- GNUNET_GNS_lookup_cancel (dq_entry->lookup_request);
- dq_entry->lookup_request = NULL;
+ GNUNET_GNS_lookup_cancel (ds_entry->lookup_request);
+ ds_entry->lookup_request = NULL;
}
- if (NULL != dq_entry->delegation_chain_entry)
+ if (NULL != ds_entry->delegation_chain_entry)
{
- if (NULL != dq_entry->delegation_chain_entry->subject_attribute)
- GNUNET_free (dq_entry->delegation_chain_entry->subject_attribute);
- if (NULL != dq_entry->delegation_chain_entry->issuer_attribute)
- GNUNET_free (dq_entry->delegation_chain_entry->issuer_attribute);
- GNUNET_free (dq_entry->delegation_chain_entry);
+ if (NULL != ds_entry->delegation_chain_entry->subject_attribute)
+ GNUNET_free (ds_entry->delegation_chain_entry->subject_attribute);
+ if (NULL != ds_entry->delegation_chain_entry->issuer_attribute)
+ GNUNET_free (ds_entry->delegation_chain_entry->issuer_attribute);
+ GNUNET_free (ds_entry->delegation_chain_entry);
}
- GNUNET_free (dq_entry);
+ GNUNET_free (ds_entry);
}
static void
@@ -343,7 +411,7 @@ cleanup_handle (struct VerifyRequestHandle *vrh)
}
if (NULL != vrh->credential)
GNUNET_free (vrh->credential);
- cleanup_delegation_queue (vrh->chain_start);
+ cleanup_delegation_set (vrh->root_set);
if (NULL != vrh->issuer_attribute)
GNUNET_free (vrh->issuer_attribute);
for (cr_entry = vrh->cred_chain_head;
@@ -444,57 +512,63 @@ send_lookup_response (struct VerifyRequestHandle *vrh)
{
struct GNUNET_MQ_Envelope *env;
struct VerifyResultMessage *rmsg;
- struct DelegationQueueEntry *dq_entry;
+ struct DelegationChainEntry *dce;
size_t size = vrh->credential_size;
- struct GNUNET_CREDENTIAL_Delegation dd[vrh->d_count];
+ struct GNUNET_CREDENTIAL_Delegation dd[vrh->delegation_chain_size];
struct GNUNET_CREDENTIAL_Credential cred;
+ int i;
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Sending response\n");
- dq_entry = vrh->chain_end;
- for (int i=0; i<vrh->d_count; i++)
+ i = 0;
+ for (dce = vrh->delegation_chain_head;
+ NULL != dce;
+ dce = dce->next)
{
- dd[i].issuer_key = dq_entry->delegation_chain_entry->issuer_key;
- dd[i].subject_key = dq_entry->delegation_chain_entry->subject_key;
- dd[i].issuer_attribute =
dq_entry->delegation_chain_entry->issuer_attribute;
- dd[i].issuer_attribute_len = strlen
(dq_entry->delegation_chain_entry->issuer_attribute)+1;
+ dd[i].issuer_key = dce->issuer_key;
+ dd[i].subject_key = dce->subject_key;
+ dd[i].issuer_attribute = dce->issuer_attribute;
+ dd[i].issuer_attribute_len = strlen (dce->issuer_attribute)+1;
dd[i].subject_attribute_len = 0;
- if (NULL != dq_entry->delegation_chain_entry->subject_attribute)
+ if (NULL != dce->subject_attribute)
{
- dd[i].subject_attribute =
dq_entry->delegation_chain_entry->subject_attribute;
- dd[i].subject_attribute_len =
strlen(dq_entry->delegation_chain_entry->subject_attribute)+1;
+ dd[i].subject_attribute = dce->subject_attribute;
+ dd[i].subject_attribute_len = strlen(dce->subject_attribute)+1;
}
- dq_entry = dq_entry->parent;
+ i++;
}
- /**
+ /**
* Get serialized record data
* Append at the end of rmsg
*/
cred.issuer_key = vrh->credential->issuer_key;
cred.subject_key = vrh->credential->subject_key;
- cred.issuer_attribute_len = strlen((char*)&vrh->credential[1]);
+ cred.issuer_attribute_len = strlen((char*)&vrh->credential[1])+1;
cred.issuer_attribute = (char*)&vrh->credential[1];
- size = GNUNET_CREDENTIAL_delegation_chain_get_size (vrh->d_count,
+ size = GNUNET_CREDENTIAL_delegation_chain_get_size
(vrh->delegation_chain_size,
dd,
&cred);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "SIZE; %llu count: %d\n",size,vrh->delegation_chain_size);
env = GNUNET_MQ_msg_extra (rmsg,
size,
GNUNET_MESSAGE_TYPE_CREDENTIAL_VERIFY_RESULT);
//Assign id so that client can find associated request
rmsg->id = vrh->request_id;
- rmsg->d_count = htonl (vrh->d_count);
+ rmsg->d_count = htonl (vrh->delegation_chain_size);
if (NULL != vrh->credential)
rmsg->cred_found = htonl (GNUNET_YES);
else
rmsg->cred_found = htonl (GNUNET_NO);
- GNUNET_assert (-1 != GNUNET_CREDENTIAL_delegation_chain_serialize
(vrh->d_count,
- dd,
- &cred,
- size,
- (char*)&rmsg[1]));
+ GNUNET_assert (-1 !=
+ GNUNET_CREDENTIAL_delegation_chain_serialize
(vrh->delegation_chain_size,
+ dd,
+ &cred,
+ size,
+ (char*)&rmsg[1]));
GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq(vrh->client),
env);
@@ -515,146 +589,194 @@ backward_resolution (void* cls,
struct VerifyRequestHandle *vrh;
struct GNUNET_CREDENTIAL_CredentialRecordData *cred;
- const struct GNUNET_CREDENTIAL_AttributeRecordData *attr;
+ const struct GNUNET_CREDENTIAL_DelegationRecordData *sets;
struct CredentialRecordEntry *cred_pointer;
- struct DelegationQueueEntry *current_delegation;
+ struct DelegationSetEntry *current_set;
+ struct DelegationSetEntry *ds_entry;
+ struct DelegationSetEntry *tmp_set;
struct DelegationQueueEntry *dq_entry;
char *expanded_attr;
char *lookup_attribute;
int i;
+ int j;
- current_delegation = cls;
- current_delegation->lookup_request = NULL;
- vrh = current_delegation->handle;
+ current_set = cls;
+ current_set->lookup_request = NULL;
+ vrh = current_set->handle;
vrh->pending_lookups--;
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Got %d attrs\n", rd_count);
+ // Each OR
for (i=0; i < rd_count; i++)
{
if (GNUNET_GNSRECORD_TYPE_ATTRIBUTE != rd[i].record_type)
continue;
+ sets = rd[i].data;
+ struct GNUNET_CREDENTIAL_DelegationSetRecord set[ntohl(sets->set_count)];
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Found new attribute delegation. Creating new Job...\n");
- attr = rd[i].data;
+ "Found new attribute delegation with %d sets. Creating new
Job...\n",
+ ntohl (sets->set_count));
+
+ if (GNUNET_OK !=GNUNET_CREDENTIAL_delegation_set_deserialize
(GNUNET_ntohll(sets->data_size),
+ (const char*)&sets[1],
+ ntohl(sets->set_count),
+ set))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Failed to deserialize!\n");
+ continue;
+ }
dq_entry = GNUNET_new (struct DelegationQueueEntry);
- if (NULL != current_delegation->attr_trailer)
+ dq_entry->required_solutions = ntohl(sets->set_count);
+ dq_entry->parent_set = current_set;
+ GNUNET_CONTAINER_DLL_insert (current_set->queue_entries_head,
+ current_set->queue_entries_tail,
+ dq_entry);
+ // Each AND
+ for (j=0; j<ntohl(sets->set_count); j++)
{
- if (rd[i].data_size == sizeof (struct
GNUNET_CREDENTIAL_AttributeRecordData))
+ ds_entry = GNUNET_new (struct DelegationSetEntry);
+ if (NULL != current_set->attr_trailer)
{
- GNUNET_asprintf (&expanded_attr,
- "%s",
- current_delegation->attr_trailer);
-
+ if (0 == set[j].subject_attribute_len)
+ {
+ GNUNET_asprintf (&expanded_attr,
+ "%s",
+ current_set->attr_trailer);
+
+ } else {
+ GNUNET_asprintf (&expanded_attr,
+ "%s.%s",
+ set[j].subject_attribute,
+ current_set->attr_trailer);
+ }
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Expanded to %s\n", expanded_attr);
+ ds_entry->unresolved_attribute_delegation = expanded_attr;
} else {
- GNUNET_asprintf (&expanded_attr,
- "%s.%s",
- (char*)&attr[1],
- current_delegation->attr_trailer);
+ if (0 != set[j].subject_attribute_len)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Not Expanding %s\n", set[j].subject_attribute);
+ ds_entry->unresolved_attribute_delegation = GNUNET_strdup
(set[j].subject_attribute);
+ }
}
+
+ //Add a credential chain entry
+ ds_entry->delegation_chain_entry = GNUNET_new (struct
DelegationChainEntry);
+ ds_entry->delegation_chain_entry->subject_key = set[j].subject_key;
+ ds_entry->issuer_key = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPublicKey);
+ GNUNET_memcpy (ds_entry->issuer_key,
+ &set[j].subject_key,
+ sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
+ if (0 < set[j].subject_attribute_len)
+ ds_entry->delegation_chain_entry->subject_attribute = GNUNET_strdup
(set[j].subject_attribute);
+ ds_entry->delegation_chain_entry->issuer_key = *current_set->issuer_key;
+ ds_entry->delegation_chain_entry->issuer_attribute = GNUNET_strdup
(current_set->lookup_attribute);
+
+ ds_entry->parent_queue_entry = dq_entry; //current_delegation;
+ GNUNET_CONTAINER_DLL_insert (dq_entry->set_entries_head,
+ dq_entry->set_entries_tail,
+ ds_entry);
+
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Expanded to %s\n", expanded_attr);
- dq_entry->unresolved_attribute_delegation = expanded_attr;
- } else {
- if (rd[i].data_size > sizeof (struct
GNUNET_CREDENTIAL_AttributeRecordData))
+ "Checking for cred match\n");
+ /**
+ * Check if this delegation already matches one of our credentials
+ */
+ for(cred_pointer = vrh->cred_chain_head; cred_pointer != NULL;
+ cred_pointer = cred_pointer->next)
{
+ cred = cred_pointer->data;
+ if(0 != memcmp (&set->subject_key,
+ &cred_pointer->data->issuer_key,
+ sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)))
+ continue;
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Not Expanding %s\n", (char*)&attr[1]);
- dq_entry->unresolved_attribute_delegation = GNUNET_strdup
((char*)&attr[1]);
- }
- }
+ "Checking if %s matches %s\n",
+ ds_entry->unresolved_attribute_delegation,
(char*)&cred[1]);
- //Add a credential chain entry
- dq_entry->delegation_chain_entry = GNUNET_new (struct
GNUNET_CREDENTIAL_DelegationChainEntry);
- dq_entry->delegation_chain_entry->subject_key = attr->subject_key;
- dq_entry->issuer_key = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPublicKey);
- GNUNET_memcpy (dq_entry->issuer_key,
- &attr->subject_key,
- sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
- if (rd[i].data_size > sizeof (struct
GNUNET_CREDENTIAL_AttributeRecordData))
- dq_entry->delegation_chain_entry->subject_attribute = GNUNET_strdup
((char*)&attr[1]);
- dq_entry->delegation_chain_entry->issuer_key =
*current_delegation->issuer_key;
- dq_entry->delegation_chain_entry->issuer_attribute = GNUNET_strdup
(current_delegation->lookup_attribute);
-
- dq_entry->parent = current_delegation;
- dq_entry->d_count = current_delegation->d_count + 1;
- GNUNET_CONTAINER_DLL_insert (current_delegation->children_head,
- current_delegation->children_tail,
- dq_entry);
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Checking for cred match\n");
- /**
- * Check if this delegation already matches one of our credentials
- */
- for(cred_pointer = vrh->cred_chain_head; cred_pointer != NULL;
- cred_pointer = cred_pointer->next)
- {
- cred = cred_pointer->data;
- if(0 != memcmp (&attr->subject_key,
- &cred_pointer->data->issuer_key,
- sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)))
- continue;
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Checking if %s matches %s\n",
- dq_entry->unresolved_attribute_delegation, (char*)&cred[1]);
+ if (0 != strcmp (ds_entry->unresolved_attribute_delegation,
(char*)&cred[1]))
+ continue;
- if (0 != strcmp (dq_entry->unresolved_attribute_delegation,
(char*)&cred[1]))
- continue;
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Found issuer\n");
+
+ //Backtrack
+ for (tmp_set = ds_entry;
+ NULL != tmp_set->parent_queue_entry;
+ tmp_set = tmp_set->parent_queue_entry->parent_set)
+ {
+ tmp_set->parent_queue_entry->required_solutions--;
+ if (NULL != tmp_set->delegation_chain_entry)
+ {
+ vrh->delegation_chain_size++;
+ GNUNET_CONTAINER_DLL_insert (vrh->delegation_chain_head,
+ vrh->delegation_chain_tail,
+ tmp_set->delegation_chain_entry);
+ }
+ if (0 < tmp_set->parent_queue_entry->required_solutions)
+ break;
+ }
+
+ if (NULL == tmp_set->parent_queue_entry)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "All solutions found\n");
+ vrh->credential = GNUNET_malloc (cred_pointer->data_size);
+ memcpy (vrh->credential,
+ cred,
+ cred_pointer->data_size);
+ vrh->credential_size = cred_pointer->data_size;
+ //Found match
+ send_lookup_response (vrh);
+ return;
+ }
+ }
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Found issuer\n");
- vrh->credential = GNUNET_malloc (cred_pointer->data_size);
- memcpy (vrh->credential,
- cred,
- cred_pointer->data_size);
- vrh->credential_size = cred_pointer->data_size;
- vrh->chain_end = dq_entry;
- vrh->d_count = dq_entry->d_count;
- //Found match
- send_lookup_response (vrh);
- return;
-
- }
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Building new lookup request\n");
- //Continue with backward resolution
- char issuer_attribute_name[strlen
(dq_entry->unresolved_attribute_delegation)+1];
- strcpy (issuer_attribute_name,
- dq_entry->unresolved_attribute_delegation);
- char *next_attr = strtok (issuer_attribute_name, ".");
- GNUNET_asprintf (&lookup_attribute,
- "%s.gnu",
- next_attr);
- GNUNET_asprintf (&dq_entry->lookup_attribute,
- "%s",
- next_attr);
- if (strlen (next_attr) == strlen
(dq_entry->unresolved_attribute_delegation))
- {
- dq_entry->attr_trailer = NULL;
- } else {
- next_attr += strlen (next_attr) + 1;
- dq_entry->attr_trailer = GNUNET_strdup (next_attr);
- }
+ "Building new lookup request from %s\n",
+ ds_entry->unresolved_attribute_delegation);
+ //Continue with backward resolution
+ char issuer_attribute_name[strlen
(ds_entry->unresolved_attribute_delegation)+1];
+ strcpy (issuer_attribute_name,
+ ds_entry->unresolved_attribute_delegation);
+ char *next_attr = strtok (issuer_attribute_name, ".");
+ GNUNET_asprintf (&lookup_attribute,
+ "%s.gnu",
+ next_attr);
+ GNUNET_asprintf (&ds_entry->lookup_attribute,
+ "%s",
+ next_attr);
+ if (strlen (next_attr) == strlen
(ds_entry->unresolved_attribute_delegation))
+ {
+ ds_entry->attr_trailer = NULL;
+ } else {
+ next_attr += strlen (next_attr) + 1;
+ ds_entry->attr_trailer = GNUNET_strdup (next_attr);
+ }
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Looking up %s\n", dq_entry->lookup_attribute);
- if (NULL != dq_entry->attr_trailer)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%s still to go...\n", dq_entry->attr_trailer);
-
- vrh->pending_lookups++;
- dq_entry->handle = vrh;
- dq_entry->lookup_request = GNUNET_GNS_lookup (gns,
- lookup_attribute,
- dq_entry->issuer_key,
//issuer_key,
-
GNUNET_GNSRECORD_TYPE_ATTRIBUTE,
- GNUNET_GNS_LO_DEFAULT,
- NULL, //shorten_key, always
NULL
- &backward_resolution,
- dq_entry);
- GNUNET_free (lookup_attribute);
+ "Looking up %s\n", ds_entry->lookup_attribute);
+ if (NULL != ds_entry->attr_trailer)
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%s still to go...\n", ds_entry->attr_trailer);
+
+ vrh->pending_lookups++;
+ ds_entry->handle = vrh;
+ ds_entry->lookup_request = GNUNET_GNS_lookup (gns,
+ lookup_attribute,
+ ds_entry->issuer_key,
//issuer_key,
+
GNUNET_GNSRECORD_TYPE_ATTRIBUTE,
+ GNUNET_GNS_LO_DEFAULT,
+ NULL, //shorten_key,
always NULL
+ &backward_resolution,
+ ds_entry);
+ GNUNET_free (lookup_attribute);
+ }
}
if(0 == vrh->pending_lookups)
@@ -681,7 +803,7 @@ handle_credential_query (void* cls,
const struct GNUNET_GNSRECORD_Data *rd)
{
struct VerifyRequestHandle *vrh = cls;
- struct DelegationQueueEntry *dq_entry;
+ struct DelegationSetEntry *ds_entry;
const struct GNUNET_CREDENTIAL_CredentialRecordData *crd;
struct CredentialRecordEntry *cr_entry;
int cred_record_count;
@@ -725,7 +847,6 @@ handle_credential_query (void* cls,
rd[i].data,
rd[i].data_size);
vrh->credential_size = rd[i].data_size;
- vrh->chain_end = NULL;
//Found match prematurely
send_lookup_response (vrh);
return;
@@ -743,26 +864,25 @@ handle_credential_query (void* cls,
".gnu");
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Looking up %s\n", issuer_attribute_name);
- dq_entry = GNUNET_new (struct DelegationQueueEntry);
- dq_entry->issuer_key = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPublicKey);
- memcpy (dq_entry->issuer_key,
+ ds_entry = GNUNET_new (struct DelegationSetEntry);
+ ds_entry->issuer_key = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPublicKey);
+ memcpy (ds_entry->issuer_key,
&vrh->issuer_key,
sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
- dq_entry->issuer_attribute = GNUNET_strdup (vrh->issuer_attribute);
- dq_entry->handle = vrh;
- dq_entry->lookup_attribute = GNUNET_strdup (vrh->issuer_attribute);
- dq_entry->d_count = 0;
- vrh->chain_start = dq_entry;
+ ds_entry->issuer_attribute = GNUNET_strdup (vrh->issuer_attribute);
+ ds_entry->handle = vrh;
+ ds_entry->lookup_attribute = GNUNET_strdup (vrh->issuer_attribute);
+ vrh->root_set = ds_entry;
vrh->pending_lookups = 1;
//Start with backward resolution
- dq_entry->lookup_request = GNUNET_GNS_lookup (gns,
+ ds_entry->lookup_request = GNUNET_GNS_lookup (gns,
issuer_attribute_name,
&vrh->issuer_key, //issuer_key,
GNUNET_GNSRECORD_TYPE_ATTRIBUTE,
GNUNET_GNS_LO_DEFAULT,
NULL, //shorten_key, always
NULL
&backward_resolution,
- dq_entry);
+ ds_entry);
}
@@ -819,7 +939,7 @@ handle_verify (void *cls,
send_lookup_response (vrh);
return;
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Looking up %s\n",
subject_attribute);
/**
diff --git a/src/credential/plugin_gnsrecord_credential.c
b/src/credential/plugin_gnsrecord_credential.c
index 281113a34..d21185981 100644
--- a/src/credential/plugin_gnsrecord_credential.c
+++ b/src/credential/plugin_gnsrecord_credential.c
@@ -30,6 +30,7 @@
#include "gnunet_credential_service.h"
#include "gnunet_gnsrecord_plugin.h"
#include "gnunet_signatures.h"
+#include "credential_serialization.h"
/**
@@ -54,27 +55,69 @@ credential_value_to_string (void *cls,
{
case GNUNET_GNSRECORD_TYPE_ATTRIBUTE:
{
- struct GNUNET_CREDENTIAL_AttributeRecordData attr;
+ struct GNUNET_CREDENTIAL_DelegationRecordData sets;
char *attr_str;
char *subject_pkey;
-
- if (data_size < sizeof (struct GNUNET_CREDENTIAL_AttributeRecordData))
+ char *tmp_str;
+ int i;
+ if (data_size < sizeof (struct GNUNET_CREDENTIAL_DelegationRecordData))
return NULL; /* malformed */
- memcpy (&attr,
+ memcpy (&sets,
data,
- sizeof (attr));
+ sizeof (sets));
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "SIZE %llu needed: %llu + %llu\n",
+ data_size,
+ GNUNET_ntohll (sets.data_size),
+ sizeof (sets));
+
cdata = data;
- subject_pkey = GNUNET_CRYPTO_ecdsa_public_key_to_string
(&attr.subject_key);
- if (data_size == sizeof (struct GNUNET_CREDENTIAL_AttributeRecordData))
+ struct GNUNET_CREDENTIAL_DelegationSetRecord set[ntohl(sets.set_count)];
+ if (GNUNET_OK != GNUNET_CREDENTIAL_delegation_set_deserialize
(GNUNET_ntohll (sets.data_size),
+
&cdata[sizeof (sets)],
+ ntohl
(sets.set_count),
+ set))
+ return NULL;
+
+ for (i=0;i<ntohl(sets.set_count);i++)
{
- return subject_pkey;
- } else {
- GNUNET_asprintf (&attr_str,
- "%s %s",
- subject_pkey,
- &cdata[sizeof (attr)]);
+ subject_pkey = GNUNET_CRYPTO_ecdsa_public_key_to_string
(&set[i].subject_key);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "%d len attr\n", set[i].subject_attribute_len);
+ if (0 == set[i].subject_attribute_len)
+ {
+ if (0 == i)
+ {
+ GNUNET_asprintf (&attr_str,
+ "%s",
+ subject_pkey);
+ } else {
+ GNUNET_asprintf (&tmp_str,
+ "%s,%s",
+ attr_str,
+ subject_pkey);
+ GNUNET_free (attr_str);
+ attr_str = tmp_str;
+ }
+ } else {
+ if (0 == i)
+ {
+ GNUNET_asprintf (&attr_str,
+ "%s %s",
+ subject_pkey,
+ set[i].subject_attribute);
+ } else {
+ GNUNET_asprintf (&tmp_str,
+ "%s,%s %s",
+ attr_str,
+ subject_pkey,
+ set[i].subject_attribute);
+ GNUNET_free (attr_str);
+ attr_str = tmp_str;
+ }
+ }
+ GNUNET_free (subject_pkey);
}
- GNUNET_free (subject_pkey);
return attr_str;
}
case GNUNET_GNSRECORD_TYPE_CREDENTIAL:
@@ -143,37 +186,84 @@ credential_string_to_value (void *cls,
{
case GNUNET_GNSRECORD_TYPE_ATTRIBUTE:
{
- struct GNUNET_CREDENTIAL_AttributeRecordData *attr;
+ struct GNUNET_CREDENTIAL_DelegationRecordData *sets;
char attr_str[253 + 1];
char subject_pkey[52 + 1];
+ char *token;
+ char *tmp_str;
int matches = 0;
- matches = SSCANF (s,
- "%s %s",
- subject_pkey,
- attr_str);
- if (0 == matches)
+ int entries;
+ size_t tmp_data_size;
+ int i;
+
+ tmp_str = GNUNET_strdup (s);
+ token = strtok (tmp_str, ",");
+ entries = 0;
+ tmp_data_size = 0;
+ *data_size = sizeof (struct GNUNET_CREDENTIAL_DelegationRecordData);
+ while (NULL != token)
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Unable to parse ATTR record string `%s'\n"),
- s);
- return GNUNET_SYSERR;
-
+ matches = SSCANF (token,
+ "%s %s",
+ subject_pkey,
+ attr_str);
+ if (0 == matches)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("Unable to parse ATTR record string `%s'\n"),
+ s);
+ GNUNET_free (tmp_str);
+ return GNUNET_SYSERR;
+ }
+ if (1 == matches) {
+ tmp_data_size += sizeof (struct
GNUNET_CREDENTIAL_DelegationSetRecord);
+ } else if (2 == matches) {
+ tmp_data_size += sizeof (struct
GNUNET_CREDENTIAL_DelegationSetRecord) + strlen (attr_str) + 1;
+ }
+ entries++;
+ token = strtok (NULL, ",");
}
- if (1 == matches) {
- *data_size = sizeof (struct GNUNET_CREDENTIAL_AttributeRecordData);
- } else if (2 == matches) {
- *data_size = sizeof (struct GNUNET_CREDENTIAL_AttributeRecordData) +
strlen (attr_str) + 1;
+ GNUNET_free (tmp_str);
+ tmp_str = GNUNET_strdup (s);
+ token = strtok (tmp_str, ",");
+ struct GNUNET_CREDENTIAL_DelegationSetRecord *set;
+ set = GNUNET_malloc (entries * sizeof (struct
GNUNET_CREDENTIAL_DelegationSetRecord));
+ for (i=0;i<entries;i++)
+ {
+ matches = SSCANF (token,
+ "%s %s",
+ subject_pkey,
+ attr_str);
+ GNUNET_CRYPTO_ecdsa_public_key_from_string (subject_pkey,
+ strlen (subject_pkey),
+ &set[i].subject_key);
+ if (2 == matches) {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Adding %s (data size %llu)\n",
+ attr_str,
+ tmp_data_size);
+ /*GNUNET_memcpy (&set[1],
+ attr_str,
+ strlen (attr_str)+1);*/
+ set[i].subject_attribute_len = strlen (attr_str) + 1;
+ set[i].subject_attribute = GNUNET_strdup (attr_str);//(const
char*)&set[1];
+ }
+ token = strtok (NULL , ",");
}
- *data = attr = GNUNET_malloc (*data_size);
- GNUNET_CRYPTO_ecdsa_public_key_from_string (subject_pkey,
- strlen (subject_pkey),
- &attr->subject_key);
- if (NULL != attr_str)
- GNUNET_memcpy (&attr[1],
- attr_str,
- strlen (attr_str));
-
-
+ tmp_data_size = GNUNET_CREDENTIAL_delegation_set_get_size (entries,
+ set);
+ if (-1 == tmp_data_size)
+ return GNUNET_SYSERR;
+ *data_size += tmp_data_size;
+ *data = sets = GNUNET_malloc (*data_size);
+ GNUNET_CREDENTIAL_delegation_set_serialize (entries,
+ set,
+ tmp_data_size,
+ (char*)&sets[1]);
+ sets->set_count = htonl (entries);
+ sets->data_size = GNUNET_htonll (tmp_data_size);
+
+ GNUNET_free (tmp_str);
return GNUNET_OK;
}
case GNUNET_GNSRECORD_TYPE_CREDENTIAL:
diff --git a/src/credential/test_credential_verify.sh
b/src/credential/test_credential_verify.sh
index 6d69e337b..52a4fd2fc 100755
--- a/src/credential/test_credential_verify.sh
+++ b/src/credential/test_credential_verify.sh
@@ -23,7 +23,7 @@ rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS
-o GNUNET_HOME -f`
which timeout &> /dev/null && DO_TIMEOUT="timeout 30"
-gnunet-arm -s -c test_credential_lookup.conf
+#gnunet-arm -s -c test_credential_lookup.conf
gnunet-identity -C service -c test_credential_lookup.conf
gnunet-identity -C alice -c test_credential_lookup.conf
gnunet-identity -C gnu -c test_credential_lookup.conf
@@ -44,6 +44,8 @@ TEST_CREDENTIAL="mygnunetcreds"
# (1) A service assigns the attribute "user" to all entities that have been
assigned "member" by entities that werde assigned "project" from GNU
gnunet-namestore -p -z service -a -n $USER_ATTR -t ATTR -V "$GNU_KEY
$GNU_PROJECT_ATTR.$MEMBER_ATTR" -e 5m -c test_credential_lookup.conf
+valgrind gnunet-namestore -D -z service -c test_credential_lookup.conf
+
# (2) GNU recognized GNUnet as a GNU project and delegates the "project"
attribute
gnunet-namestore -p -z gnu -a -n $GNU_PROJECT_ATTR -t ATTR -V "$GNUNET_KEY" -e
5m -c test_credential_lookup.conf
diff --git a/src/include/gnunet_credential_service.h
b/src/include/gnunet_credential_service.h
index ba72b752b..b28d90140 100644
--- a/src/include/gnunet_credential_service.h
+++ b/src/include/gnunet_credential_service.h
@@ -126,6 +126,46 @@ struct GNUNET_CREDENTIAL_AttributeRecordData {
};
/**
+ * The attribute delegation record
+*/
+struct GNUNET_CREDENTIAL_DelegationRecordData {
+
+ uint32_t set_count;
+
+ uint64_t data_size;
+
+ char *data;
+
+ /**
+ * Followed by the attribute that was delegated to as string
+ * May be empty
+ */
+};
+
+
+
+/**
+ * The attribute delegation record
+*/
+struct GNUNET_CREDENTIAL_DelegationSetRecord {
+
+ /**
+ * Public key of the subject this attribute was delegated to
+ */
+ struct GNUNET_CRYPTO_EcdsaPublicKey subject_key;
+
+ uint32_t subject_attribute_len;
+
+ const char *subject_attribute;
+
+ /**
+ * Followed by the attribute that was delegated to as string
+ * May be empty
+ */
+};
+
+
+/**
* A delegation
*/
struct GNUNET_CREDENTIAL_Delegation {
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnunet] 65/171: -add tokens for credentials, (continued)
- [GNUnet-SVN] [gnunet] 65/171: -add tokens for credentials, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 73/171: -fix, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 52/171: -fixes, prettify, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 80/171: Merge remote-tracking branch 'origin/master' into credentials, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 48/171: -add serializer, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 84/171: Merge remote-tracking branch 'origin/master' into credentials, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 81/171: -fix 0-term, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 86/171: Merge branch 'abe' into identity_abe, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 74/171: -fix, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 83/171: -fix DEBUG output, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 51/171: -towards type4,
gnunet <=
- [GNUnet-SVN] [gnunet] 82/171: Merge remote-tracking branch 'origin/master' into credentials, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 71/171: Merge remote-tracking branch 'origin/master' into credentials, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 79/171: Merge remote-tracking branch 'origin/master' into credentials, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 78/171: -fix idp, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 72/171: -fix API changes, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 76/171: Merge remote-tracking branch 'origin/master' into credentials, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 89/171: Merge branch 'abe' into identity_abe, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 104/171: -fix, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 94/171: -add CLI, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 87/171: -towards IdP2, gnunet, 2018/01/04