diff options
author | Adnan H <acednan@gmail.com> | 2016-12-02 15:38:33 +0100 |
---|---|---|
committer | Adnan H <acednan@gmail.com> | 2016-12-02 15:39:21 +0100 |
commit | 191fd80caf3288ff2a620541f4aa623647b589fa (patch) | |
tree | 0883f58c5f42286cc7a779ae236a129e14bffc4c /src/credential | |
parent | 6fb6ddb3cb9b4153033747ac42cbad66f9bc3268 (diff) | |
parent | 113150fb91211dc0cc0901c2373f148b8486d9c9 (diff) | |
download | gnunet-191fd80caf3288ff2a620541f4aa623647b589fa.tar.gz gnunet-191fd80caf3288ff2a620541f4aa623647b589fa.zip |
Merge branch 'credentials' of git+ssh://gnunet.org/gnunet into credentials
Diffstat (limited to 'src/credential')
-rw-r--r-- | src/credential/gnunet-service-credential.c | 11 | ||||
-rw-r--r-- | src/credential/plugin_gnsrecord_credential.c | 28 |
2 files changed, 35 insertions, 4 deletions
diff --git a/src/credential/gnunet-service-credential.c b/src/credential/gnunet-service-credential.c index 620256cd9..ed7d249e3 100644 --- a/src/credential/gnunet-service-credential.c +++ b/src/credential/gnunet-service-credential.c | |||
@@ -312,6 +312,17 @@ send_lookup_response (void* cls, | |||
312 | 312 | ||
313 | 313 | ||
314 | /** | 314 | /** |
315 | * TODO | ||
316 | * Start resolution of Attribute delegations from issuer | ||
317 | * | ||
318 | * - Build adequate data structures for attribute(s) to lookup | ||
319 | * - Use GNUNET_GNSRECORD_TYPE_XXX | ||
320 | * - recursively try to find match(es) with results found top | ||
321 | * - return one found credential chain | ||
322 | * | ||
323 | */ | ||
324 | |||
325 | /** | ||
315 | * Get serialized record data size | 326 | * Get serialized record data size |
316 | */ | 327 | */ |
317 | len = cred_record_count * sizeof (struct GNUNET_CREDENTIAL_CredentialRecordData); | 328 | len = cred_record_count * sizeof (struct GNUNET_CREDENTIAL_CredentialRecordData); |
diff --git a/src/credential/plugin_gnsrecord_credential.c b/src/credential/plugin_gnsrecord_credential.c index cc645468d..d321a43a4 100644 --- a/src/credential/plugin_gnsrecord_credential.c +++ b/src/credential/plugin_gnsrecord_credential.c | |||
@@ -51,14 +51,34 @@ credential_value_to_string (void *cls, | |||
51 | 51 | ||
52 | switch (type) | 52 | switch (type) |
53 | { | 53 | { |
54 | case GNUNET_GNSRECORD_TYPE_ATTRIBUTE: | ||
55 | { | ||
56 | struct GNUNET_CREDENTIAL_AttributeRecordData attr; | ||
57 | char *attr_str; | ||
58 | char *subject_pkey; | ||
59 | |||
60 | if (data_size < sizeof (struct GNUNET_CREDENTIAL_AttributeRecordData)) | ||
61 | return NULL; /* malformed */ | ||
62 | memcpy (&attr, | ||
63 | data, | ||
64 | sizeof (attr)); | ||
65 | cdata = data; | ||
66 | subject_pkey = GNUNET_CRYPTO_ecdsa_public_key_to_string (&attr.subject_key); | ||
67 | GNUNET_asprintf (&attr_str, | ||
68 | "%s.%s", | ||
69 | subject_pkey, | ||
70 | &cdata[sizeof (attr)]); | ||
71 | GNUNET_free (subject_pkey); | ||
72 | return attr_str; | ||
73 | } | ||
54 | case GNUNET_GNSRECORD_TYPE_CREDENTIAL: | 74 | case GNUNET_GNSRECORD_TYPE_CREDENTIAL: |
55 | { | 75 | { |
56 | struct GNUNET_CREDENTIAL_AttributeRecordData cred; | 76 | struct GNUNET_CREDENTIAL_CredentialRecordData cred; |
57 | char *cred_str; | 77 | char *cred_str; |
58 | char *subject_pkey; | 78 | char *subject_pkey; |
59 | char *issuer_pkey; | 79 | char *issuer_pkey; |
60 | uint32_t cf; // Credential flags | 80 | uint32_t cf; // Credential flags |
61 | if (data_size < sizeof (struct GNUNET_CREDENTIAL_AttributeRecordData)) | 81 | if (data_size < sizeof (struct GNUNET_CREDENTIAL_CredentialRecordData)) |
62 | return NULL; /* malformed */ | 82 | return NULL; /* malformed */ |
63 | memcpy (&cred, | 83 | memcpy (&cred, |
64 | data, | 84 | data, |
@@ -111,7 +131,7 @@ credential_string_to_value (void *cls, | |||
111 | { | 131 | { |
112 | case GNUNET_GNSRECORD_TYPE_CREDENTIAL: | 132 | case GNUNET_GNSRECORD_TYPE_CREDENTIAL: |
113 | { | 133 | { |
114 | struct GNUNET_CREDENTIAL_AttributeRecordData *cred; | 134 | struct GNUNET_CREDENTIAL_CredentialRecordData *cred; |
115 | unsigned int cf; // credential flags | 135 | unsigned int cf; // credential flags |
116 | 136 | ||
117 | size_t enclen = (sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)) * 8; | 137 | size_t enclen = (sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)) * 8; |
@@ -134,7 +154,7 @@ credential_string_to_value (void *cls, | |||
134 | s); | 154 | s); |
135 | return GNUNET_SYSERR; | 155 | return GNUNET_SYSERR; |
136 | } | 156 | } |
137 | *data_size = sizeof (struct GNUNET_CREDENTIAL_AttributeRecordData) + strlen (name) + 1; | 157 | *data_size = sizeof (struct GNUNET_CREDENTIAL_CredentialRecordData) + strlen (name) + 1; |
138 | *data = cred = GNUNET_malloc (*data_size); | 158 | *data = cred = GNUNET_malloc (*data_size); |
139 | GNUNET_CRYPTO_ecdsa_public_key_from_string (subject_pkey, | 159 | GNUNET_CRYPTO_ecdsa_public_key_from_string (subject_pkey, |
140 | strlen (subject_pkey), | 160 | strlen (subject_pkey), |