aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSchanzenbach, Martin <mschanzenbach@posteo.de>2019-04-11 20:25:11 +0200
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2019-04-14 10:01:23 +0200
commit94f8e5437da8cc1c5ee38a333da2e1c68b3289f1 (patch)
tree8f56950954baccbc7e1867f9ac01144b419a4798
parent61625d4834bc7a599446486c9d16f2451527f989 (diff)
downloadgnunet-94f8e5437da8cc1c5ee38a333da2e1c68b3289f1.tar.gz
gnunet-94f8e5437da8cc1c5ee38a333da2e1c68b3289f1.zip
RECLAIM: Start move to GNS encryption
-rw-r--r--src/include/gnunet_gnsrecord_lib.h22
-rw-r--r--src/include/gnunet_reclaim_attribute_lib.h44
-rw-r--r--src/reclaim-attribute/reclaim_attribute.c64
-rw-r--r--src/reclaim-attribute/reclaim_attribute.h9
-rw-r--r--src/reclaim/Makefile.am1
-rw-r--r--src/reclaim/gnunet-reclaim.c11
-rw-r--r--src/reclaim/gnunet-service-reclaim.c927
-rw-r--r--src/reclaim/plugin_gnsrecord_reclaim.c94
8 files changed, 344 insertions, 828 deletions
diff --git a/src/include/gnunet_gnsrecord_lib.h b/src/include/gnunet_gnsrecord_lib.h
index 7c25bdf15..c76e87d12 100644
--- a/src/include/gnunet_gnsrecord_lib.h
+++ b/src/include/gnunet_gnsrecord_lib.h
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
@@ -94,19 +94,13 @@ extern "C"
94#define GNUNET_GNSRECORD_TYPE_PHONE 65543 94#define GNUNET_GNSRECORD_TYPE_PHONE 65543
95 95
96/** 96/**
97 * Record type for identity attributes (of IDENTITY). 97 * Record type for identity attributes (of RECLAIM).
98 */
99#define GNUNET_GNSRECORD_TYPE_ID_ATTR 65544
100
101/**
102 * Record type for an identity token (of IDENTITY-TOKEN).
103 */ 98 */
104#define GNUNET_GNSRECORD_TYPE_ID_TOKEN 65545 99#define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR 65544
105 100
106/** 101/**
107 * Record type for the private metadata of an identity token (of IDENTITY-TOKEN). 102 * 65544-65547 deprecated
108 */ 103 */
109#define GNUNET_GNSRECORD_TYPE_ID_TOKEN_METADATA 65546
110 104
111/** 105/**
112 * Record type for credential 106 * Record type for credential
@@ -124,14 +118,14 @@ extern "C"
124#define GNUNET_GNSRECORD_TYPE_ATTRIBUTE 65549 118#define GNUNET_GNSRECORD_TYPE_ATTRIBUTE 65549
125 119
126/** 120/**
127 * Record type for ABE records 121 * Record type for reclaim records
128 */ 122 */
129#define GNUNET_GNSRECORD_TYPE_ABE_KEY 65550 123#define GNUNET_GNSRECORD_TYPE_RECLAIM_AUTHZ 65550
130 124
131/** 125/**
132 * Record type for ABE master keys 126 * Record type for RECLAIM master
133 */ 127 */
134#define GNUNET_GNSRECORD_TYPE_ABE_MASTER 65551 128#define GNUNET_GNSRECORD_TYPE_RECLAIM_MASTER 65551
135 129
136/** 130/**
137 * Record type for reclaim OIDC clients 131 * Record type for reclaim OIDC clients
diff --git a/src/include/gnunet_reclaim_attribute_lib.h b/src/include/gnunet_reclaim_attribute_lib.h
index 1f26927b2..db009da3f 100644
--- a/src/include/gnunet_reclaim_attribute_lib.h
+++ b/src/include/gnunet_reclaim_attribute_lib.h
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
@@ -59,10 +59,9 @@ extern "C"
59struct GNUNET_RECLAIM_ATTRIBUTE_Claim 59struct GNUNET_RECLAIM_ATTRIBUTE_Claim
60{ 60{
61 /** 61 /**
62 * The name of the attribute. Note "name" must never be individually 62 * ID
63 * free'd
64 */ 63 */
65 const char* name; 64 uint64_t id;
66 65
67 /** 66 /**
68 * Type of Claim 67 * Type of Claim
@@ -73,6 +72,11 @@ struct GNUNET_RECLAIM_ATTRIBUTE_Claim
73 * Version 72 * Version
74 */ 73 */
75 uint32_t version; 74 uint32_t version;
75 /**
76 * The name of the attribute. Note "name" must never be individually
77 * free'd
78 */
79 const char* name;
76 80
77 /** 81 /**
78 * Number of bytes in @e data. 82 * Number of bytes in @e data.
@@ -130,9 +134,9 @@ struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry
130 */ 134 */
131struct GNUNET_RECLAIM_ATTRIBUTE_Claim * 135struct GNUNET_RECLAIM_ATTRIBUTE_Claim *
132GNUNET_RECLAIM_ATTRIBUTE_claim_new (const char* attr_name, 136GNUNET_RECLAIM_ATTRIBUTE_claim_new (const char* attr_name,
133 uint32_t type, 137 uint32_t type,
134 const void* data, 138 const void* data,
135 size_t data_size); 139 size_t data_size);
136 140
137 141
138/** 142/**
@@ -150,10 +154,10 @@ GNUNET_RECLAIM_ATTRIBUTE_list_destroy (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList
150 154
151void 155void
152GNUNET_RECLAIM_ATTRIBUTE_list_add (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs, 156GNUNET_RECLAIM_ATTRIBUTE_list_add (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
153 const char* attr_name, 157 const char* attr_name,
154 uint32_t type, 158 uint32_t type,
155 const void* data, 159 const void* data,
156 size_t data_size); 160 size_t data_size);
157 161
158/** 162/**
159 * Serialize an attribute list 163 * Serialize an attribute list
@@ -165,7 +169,7 @@ GNUNET_RECLAIM_ATTRIBUTE_list_add (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *at
165 */ 169 */
166size_t 170size_t
167GNUNET_RECLAIM_ATTRIBUTE_list_serialize (const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs, 171GNUNET_RECLAIM_ATTRIBUTE_list_serialize (const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
168 char *result); 172 char *result);
169 173
170/** 174/**
171 * Deserialize an attribute list 175 * Deserialize an attribute list
@@ -177,7 +181,7 @@ GNUNET_RECLAIM_ATTRIBUTE_list_serialize (const struct GNUNET_RECLAIM_ATTRIBUTE_C
177 */ 181 */
178struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList * 182struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *
179GNUNET_RECLAIM_ATTRIBUTE_list_deserialize (const char* data, 183GNUNET_RECLAIM_ATTRIBUTE_list_deserialize (const char* data,
180 size_t data_size); 184 size_t data_size);
181 185
182 186
183/** 187/**
@@ -202,7 +206,7 @@ GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (const struct GNUNET_RECLAIM_ATTRIBU
202 */ 206 */
203size_t 207size_t
204GNUNET_RECLAIM_ATTRIBUTE_serialize (const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, 208GNUNET_RECLAIM_ATTRIBUTE_serialize (const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
205 char *result); 209 char *result);
206 210
207/** 211/**
208 * Deserialize an attribute 212 * Deserialize an attribute
@@ -214,7 +218,7 @@ GNUNET_RECLAIM_ATTRIBUTE_serialize (const struct GNUNET_RECLAIM_ATTRIBUTE_Claim
214 */ 218 */
215struct GNUNET_RECLAIM_ATTRIBUTE_Claim * 219struct GNUNET_RECLAIM_ATTRIBUTE_Claim *
216GNUNET_RECLAIM_ATTRIBUTE_deserialize (const char* data, 220GNUNET_RECLAIM_ATTRIBUTE_deserialize (const char* data,
217 size_t data_size); 221 size_t data_size);
218 222
219struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList* 223struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList*
220GNUNET_RECLAIM_ATTRIBUTE_list_dup (const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs); 224GNUNET_RECLAIM_ATTRIBUTE_list_dup (const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs);
@@ -240,9 +244,9 @@ GNUNET_RECLAIM_ATTRIBUTE_typename_to_number (const char *typename);
240 */ 244 */
241int 245int
242GNUNET_RECLAIM_ATTRIBUTE_string_to_value (uint32_t type, 246GNUNET_RECLAIM_ATTRIBUTE_string_to_value (uint32_t type,
243 const char *s, 247 const char *s,
244 void **data, 248 void **data,
245 size_t *data_size); 249 size_t *data_size);
246 250
247/** 251/**
248 * Convert the 'claim' of an attribute to a string 252 * Convert the 'claim' of an attribute to a string
@@ -254,8 +258,8 @@ GNUNET_RECLAIM_ATTRIBUTE_string_to_value (uint32_t type,
254 */ 258 */
255char * 259char *
256GNUNET_RECLAIM_ATTRIBUTE_value_to_string (uint32_t type, 260GNUNET_RECLAIM_ATTRIBUTE_value_to_string (uint32_t type,
257 const void* data, 261 const void* data,
258 size_t data_size); 262 size_t data_size);
259 263
260/** 264/**
261 * Convert a type number to the corresponding type string 265 * Convert a type number to the corresponding type string
diff --git a/src/reclaim-attribute/reclaim_attribute.c b/src/reclaim-attribute/reclaim_attribute.c
index a5520cbcf..3d260f15b 100644
--- a/src/reclaim-attribute/reclaim_attribute.c
+++ b/src/reclaim-attribute/reclaim_attribute.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
@@ -104,7 +104,7 @@ GNUNET_RECLAIM_ATTRIBUTE_typename_to_number (const char *typename)
104 unsigned int i; 104 unsigned int i;
105 struct Plugin *plugin; 105 struct Plugin *plugin;
106 uint32_t ret; 106 uint32_t ret;
107 107
108 init (); 108 init ();
109 for (i = 0; i < num_plugins; i++) 109 for (i = 0; i < num_plugins; i++)
110 { 110 {
@@ -152,9 +152,9 @@ GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (uint32_t type)
152 */ 152 */
153int 153int
154GNUNET_RECLAIM_ATTRIBUTE_string_to_value (uint32_t type, 154GNUNET_RECLAIM_ATTRIBUTE_string_to_value (uint32_t type,
155 const char *s, 155 const char *s,
156 void **data, 156 void **data,
157 size_t *data_size) 157 size_t *data_size)
158{ 158{
159 unsigned int i; 159 unsigned int i;
160 struct Plugin *plugin; 160 struct Plugin *plugin;
@@ -183,8 +183,8 @@ GNUNET_RECLAIM_ATTRIBUTE_string_to_value (uint32_t type,
183 */ 183 */
184char * 184char *
185GNUNET_RECLAIM_ATTRIBUTE_value_to_string (uint32_t type, 185GNUNET_RECLAIM_ATTRIBUTE_value_to_string (uint32_t type,
186 const void* data, 186 const void* data,
187 size_t data_size) 187 size_t data_size)
188{ 188{
189 unsigned int i; 189 unsigned int i;
190 struct Plugin *plugin; 190 struct Plugin *plugin;
@@ -214,9 +214,9 @@ GNUNET_RECLAIM_ATTRIBUTE_value_to_string (uint32_t type,
214 */ 214 */
215struct GNUNET_RECLAIM_ATTRIBUTE_Claim * 215struct GNUNET_RECLAIM_ATTRIBUTE_Claim *
216GNUNET_RECLAIM_ATTRIBUTE_claim_new (const char* attr_name, 216GNUNET_RECLAIM_ATTRIBUTE_claim_new (const char* attr_name,
217 uint32_t type, 217 uint32_t type,
218 const void* data, 218 const void* data,
219 size_t data_size) 219 size_t data_size)
220{ 220{
221 struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr; 221 struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr;
222 char *write_ptr; 222 char *write_ptr;
@@ -256,20 +256,20 @@ GNUNET_RECLAIM_ATTRIBUTE_claim_new (const char* attr_name,
256 */ 256 */
257void 257void
258GNUNET_RECLAIM_ATTRIBUTE_list_add (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *claim_list, 258GNUNET_RECLAIM_ATTRIBUTE_list_add (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *claim_list,
259 const char* attr_name, 259 const char* attr_name,
260 uint32_t type, 260 uint32_t type,
261 const void* data, 261 const void* data,
262 size_t data_size) 262 size_t data_size)
263{ 263{
264 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le; 264 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
265 le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry); 265 le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
266 le->claim = GNUNET_RECLAIM_ATTRIBUTE_claim_new (attr_name, 266 le->claim = GNUNET_RECLAIM_ATTRIBUTE_claim_new (attr_name,
267 type, 267 type,
268 data, 268 data,
269 data_size); 269 data_size);
270 GNUNET_CONTAINER_DLL_insert (claim_list->list_head, 270 GNUNET_CONTAINER_DLL_insert (claim_list->list_head,
271 claim_list->list_tail, 271 claim_list->list_tail,
272 le); 272 le);
273} 273}
274 274
275size_t 275size_t
@@ -279,12 +279,12 @@ GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size (const struct GNUNET_RECLAIM_AT
279 size_t len = 0; 279 size_t len = 0;
280 for (le = attrs->list_head; NULL != le; le = le->next) 280 for (le = attrs->list_head; NULL != le; le = le->next)
281 len += GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (le->claim); 281 len += GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (le->claim);
282 return len; 282 return len;
283} 283}
284 284
285size_t 285size_t
286GNUNET_RECLAIM_ATTRIBUTE_list_serialize (const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs, 286GNUNET_RECLAIM_ATTRIBUTE_list_serialize (const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
287 char *result) 287 char *result)
288{ 288{
289 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le; 289 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
290 size_t len; 290 size_t len;
@@ -296,7 +296,7 @@ GNUNET_RECLAIM_ATTRIBUTE_list_serialize (const struct GNUNET_RECLAIM_ATTRIBUTE_C
296 for (le = attrs->list_head; NULL != le; le = le->next) 296 for (le = attrs->list_head; NULL != le; le = le->next)
297 { 297 {
298 len = GNUNET_RECLAIM_ATTRIBUTE_serialize (le->claim, 298 len = GNUNET_RECLAIM_ATTRIBUTE_serialize (le->claim,
299 write_ptr); 299 write_ptr);
300 total_len += len; 300 total_len += len;
301 write_ptr += len; 301 write_ptr += len;
302 } 302 }
@@ -305,7 +305,7 @@ GNUNET_RECLAIM_ATTRIBUTE_list_serialize (const struct GNUNET_RECLAIM_ATTRIBUTE_C
305 305
306struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList * 306struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *
307GNUNET_RECLAIM_ATTRIBUTE_list_deserialize (const char* data, 307GNUNET_RECLAIM_ATTRIBUTE_list_deserialize (const char* data,
308 size_t data_size) 308 size_t data_size)
309{ 309{
310 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs; 310 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs;
311 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le; 311 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
@@ -314,7 +314,7 @@ GNUNET_RECLAIM_ATTRIBUTE_list_deserialize (const char* data,
314 314
315 if (data_size < sizeof (struct Attribute)) 315 if (data_size < sizeof (struct Attribute))
316 return NULL; 316 return NULL;
317 317
318 attrs = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList); 318 attrs = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList);
319 read_ptr = data; 319 read_ptr = data;
320 while (((data + data_size) - read_ptr) >= sizeof (struct Attribute)) 320 while (((data + data_size) - read_ptr) >= sizeof (struct Attribute))
@@ -322,7 +322,7 @@ GNUNET_RECLAIM_ATTRIBUTE_list_deserialize (const char* data,
322 322
323 le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry); 323 le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
324 le->claim = GNUNET_RECLAIM_ATTRIBUTE_deserialize (read_ptr, 324 le->claim = GNUNET_RECLAIM_ATTRIBUTE_deserialize (read_ptr,
325 data_size - (read_ptr - data)); 325 data_size - (read_ptr - data));
326 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 326 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
327 "Deserialized attribute %s\n", le->claim->name); 327 "Deserialized attribute %s\n", le->claim->name);
328 GNUNET_CONTAINER_DLL_insert (attrs->list_head, 328 GNUNET_CONTAINER_DLL_insert (attrs->list_head,
@@ -346,9 +346,9 @@ GNUNET_RECLAIM_ATTRIBUTE_list_dup (const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimLi
346 { 346 {
347 result_le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry); 347 result_le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
348 result_le->claim = GNUNET_RECLAIM_ATTRIBUTE_claim_new (le->claim->name, 348 result_le->claim = GNUNET_RECLAIM_ATTRIBUTE_claim_new (le->claim->name,
349 le->claim->type, 349 le->claim->type,
350 le->claim->data, 350 le->claim->data,
351 le->claim->data_size); 351 le->claim->data_size);
352 GNUNET_CONTAINER_DLL_insert (result->list_head, 352 GNUNET_CONTAINER_DLL_insert (result->list_head,
353 result->list_tail, 353 result->list_tail,
354 result_le); 354 result_le);
@@ -377,14 +377,14 @@ GNUNET_RECLAIM_ATTRIBUTE_list_destroy (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList
377size_t 377size_t
378GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr) 378GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr)
379{ 379{
380 return sizeof (struct Attribute) 380 return sizeof (struct Attribute)
381 + strlen (attr->name) 381 + strlen (attr->name)
382 + attr->data_size; 382 + attr->data_size;
383} 383}
384 384
385size_t 385size_t
386GNUNET_RECLAIM_ATTRIBUTE_serialize (const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, 386GNUNET_RECLAIM_ATTRIBUTE_serialize (const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
387 char *result) 387 char *result)
388{ 388{
389 size_t data_len_ser; 389 size_t data_len_ser;
390 size_t name_len; 390 size_t name_len;
@@ -394,6 +394,7 @@ GNUNET_RECLAIM_ATTRIBUTE_serialize (const struct GNUNET_RECLAIM_ATTRIBUTE_Claim
394 attr_ser = (struct Attribute*)result; 394 attr_ser = (struct Attribute*)result;
395 attr_ser->attribute_type = htons (attr->type); 395 attr_ser->attribute_type = htons (attr->type);
396 attr_ser->attribute_version = htonl (attr->version); 396 attr_ser->attribute_version = htonl (attr->version);
397 attr_ser->attribute_id = GNUNET_htonll (attr->id);
397 name_len = strlen (attr->name); 398 name_len = strlen (attr->name);
398 attr_ser->name_len = htons (name_len); 399 attr_ser->name_len = htons (name_len);
399 write_ptr = (char*)&attr_ser[1]; 400 write_ptr = (char*)&attr_ser[1];
@@ -411,7 +412,7 @@ GNUNET_RECLAIM_ATTRIBUTE_serialize (const struct GNUNET_RECLAIM_ATTRIBUTE_Claim
411 412
412struct GNUNET_RECLAIM_ATTRIBUTE_Claim * 413struct GNUNET_RECLAIM_ATTRIBUTE_Claim *
413GNUNET_RECLAIM_ATTRIBUTE_deserialize (const char* data, 414GNUNET_RECLAIM_ATTRIBUTE_deserialize (const char* data,
414 size_t data_size) 415 size_t data_size)
415{ 416{
416 struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr; 417 struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr;
417 struct Attribute *attr_ser; 418 struct Attribute *attr_ser;
@@ -429,6 +430,7 @@ GNUNET_RECLAIM_ATTRIBUTE_deserialize (const char* data,
429 + data_len + name_len + 1); 430 + data_len + name_len + 1);
430 attr->type = ntohs (attr_ser->attribute_type); 431 attr->type = ntohs (attr_ser->attribute_type);
431 attr->version = ntohl (attr_ser->attribute_version); 432 attr->version = ntohl (attr_ser->attribute_version);
433 attr->id = GNUNET_ntohll (attr_ser->attribute_id);
432 attr->data_size = ntohs (attr_ser->data_size); 434 attr->data_size = ntohs (attr_ser->data_size);
433 435
434 write_ptr = (char*)&attr[1]; 436 write_ptr = (char*)&attr[1];
diff --git a/src/reclaim-attribute/reclaim_attribute.h b/src/reclaim-attribute/reclaim_attribute.h
index 43228f5c3..773d39c5a 100644
--- a/src/reclaim-attribute/reclaim_attribute.h
+++ b/src/reclaim-attribute/reclaim_attribute.h
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
@@ -41,10 +41,15 @@ struct Attribute
41 uint32_t attribute_version; 41 uint32_t attribute_version;
42 42
43 /** 43 /**
44 * Attribute ID
45 */
46 uint64_t attribute_id;
47
48 /**
44 * Name length 49 * Name length
45 */ 50 */
46 uint32_t name_len; 51 uint32_t name_len;
47 52
48 /** 53 /**
49 * Data size 54 * Data size
50 */ 55 */
diff --git a/src/reclaim/Makefile.am b/src/reclaim/Makefile.am
index be50cce26..bea8cd38e 100644
--- a/src/reclaim/Makefile.am
+++ b/src/reclaim/Makefile.am
@@ -115,7 +115,6 @@ gnunet_service_reclaim_LDADD = \
115 $(top_builddir)/src/namestore/libgnunetnamestore.la \ 115 $(top_builddir)/src/namestore/libgnunetnamestore.la \
116 $(top_builddir)/src/identity/libgnunetidentity.la \ 116 $(top_builddir)/src/identity/libgnunetidentity.la \
117 $(top_builddir)/src/statistics/libgnunetstatistics.la \ 117 $(top_builddir)/src/statistics/libgnunetstatistics.la \
118 $(top_builddir)/src/abe/libgnunetabe.la \
119 $(top_builddir)/src/credential/libgnunetcredential.la \ 118 $(top_builddir)/src/credential/libgnunetcredential.la \
120 $(top_builddir)/src/reclaim-attribute/libgnunetreclaimattribute.la \ 119 $(top_builddir)/src/reclaim-attribute/libgnunetreclaimattribute.la \
121 libgnunetreclaim.la \ 120 libgnunetreclaim.la \
diff --git a/src/reclaim/gnunet-reclaim.c b/src/reclaim/gnunet-reclaim.c
index 177f505c6..b10586feb 100644
--- a/src/reclaim/gnunet-reclaim.c
+++ b/src/reclaim/gnunet-reclaim.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
@@ -219,7 +219,8 @@ process_attrs (void *cls,
219 attr->data_size); 219 attr->data_size);
220 attr_type = GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (attr->type); 220 attr_type = GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (attr->type);
221 fprintf (stdout, 221 fprintf (stdout,
222 "%s: %s [%s,v%u]\n", attr->name, value_str, attr_type, attr->version); 222 "%s: %s [%s,v%u,id=%lu]\n",
223 attr->name, value_str, attr_type, attr->version, attr->id);
223} 224}
224 225
225 226
@@ -373,13 +374,14 @@ iter_cb (void *cls,
373 attr->data, 374 attr->data,
374 attr->data_size); 375 attr->data_size);
375 le->claim->version = attr->version; 376 le->claim->version = attr->version;
377 le->claim->id = attr->id;
376 GNUNET_CONTAINER_DLL_insert (attr_list->list_head, 378 GNUNET_CONTAINER_DLL_insert (attr_list->list_head,
377 attr_list->list_tail, 379 attr_list->list_tail,
378 le); 380 le);
379 break; 381 break;
380 } 382 }
381 GNUNET_free (attrs_tmp); 383 GNUNET_free (attrs_tmp);
382 } 384 }
383 else if (list) 385 else if (list)
384 { 386 {
385 attr_str = GNUNET_RECLAIM_ATTRIBUTE_value_to_string (attr->type, 387 attr_str = GNUNET_RECLAIM_ATTRIBUTE_value_to_string (attr->type,
@@ -387,7 +389,8 @@ iter_cb (void *cls,
387 attr->data_size); 389 attr->data_size);
388 attr_type = GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (attr->type); 390 attr_type = GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (attr->type);
389 fprintf (stdout, 391 fprintf (stdout,
390 "%s: %s [%s,v%u]\n", attr->name, attr_str, attr_type, attr->version); 392 "%s: %s [%s,v%u,id=%lu]\n",
393 attr->name, attr_str, attr_type, attr->version, attr->id);
391 } 394 }
392 GNUNET_RECLAIM_get_attributes_next (attr_iterator); 395 GNUNET_RECLAIM_get_attributes_next (attr_iterator);
393} 396}
diff --git a/src/reclaim/gnunet-service-reclaim.c b/src/reclaim/gnunet-service-reclaim.c
index 97b8aa338..f3a6e2073 100644
--- a/src/reclaim/gnunet-service-reclaim.c
+++ b/src/reclaim/gnunet-service-reclaim.c
@@ -11,11 +11,11 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
18 SPDX-License-Identifier: AGPL3.0-or-later 18 SPDX-License-Identifier: AGPL3.0-or-later
19 */ 19 */
20/** 20/**
21 * @author Martin Schanzenbach 21 * @author Martin Schanzenbach
@@ -30,7 +30,6 @@
30#include "gnunet_identity_service.h" 30#include "gnunet_identity_service.h"
31#include "gnunet_gnsrecord_lib.h" 31#include "gnunet_gnsrecord_lib.h"
32#include "gnunet_namestore_service.h" 32#include "gnunet_namestore_service.h"
33#include "gnunet_abe_lib.h"
34#include "gnunet_credential_service.h" 33#include "gnunet_credential_service.h"
35#include "gnunet_statistics_service.h" 34#include "gnunet_statistics_service.h"
36#include "gnunet_gns_service.h" 35#include "gnunet_gns_service.h"
@@ -82,7 +81,7 @@ static struct GNUNET_TIME_Relative token_expiration_interval;
82/** 81/**
83 * Namestore handle 82 * Namestore handle
84 */ 83 */
85static struct GNUNET_NAMESTORE_Handle *ns_handle; 84static struct GNUNET_NAMESTORE_Handle *nsh;
86 85
87/** 86/**
88 * GNS handle 87 * GNS handle
@@ -116,21 +115,6 @@ static struct GNUNET_SCHEDULER_Task *update_task;
116 115
117 116
118/** 117/**
119 * Currently processed token
120 */
121static struct IdentityToken *token;
122
123/**
124 * Label for currently processed token
125 */
126static char* label;
127
128/**
129 * Scopes for processed token
130 */
131static char* scopes;
132
133/**
134 * Handle to the statistics service. 118 * Handle to the statistics service.
135 */ 119 */
136static struct GNUNET_STATISTICS_Handle *stats; 120static struct GNUNET_STATISTICS_Handle *stats;
@@ -181,7 +165,7 @@ struct TicketIteration
181 uint32_t r_id; 165 uint32_t r_id;
182 166
183 /** 167 /**
184 * Offset of the iteration used to address next result of the 168 * Offset of the iteration used to address next result of the
185 * iteration in the store 169 * iteration in the store
186 * 170 *
187 * Initialy set to 0 in handle_iteration_start 171 * Initialy set to 0 in handle_iteration_start
@@ -192,51 +176,6 @@ struct TicketIteration
192}; 176};
193 177
194 178
195
196/**
197 * Callback after an ABE bootstrap
198 *
199 * @param cls closure
200 * @param abe_key the ABE key that exists or was created
201 */
202typedef void
203(*AbeBootstrapResult) (void *cls,
204 struct GNUNET_ABE_AbeMasterKey *abe_key);
205
206
207struct AbeBootstrapHandle
208{
209 /**
210 * Function to call when finished
211 */
212 AbeBootstrapResult proc;
213
214 /**
215 * Callback closure
216 */
217 char *proc_cls;
218
219 /**
220 * Key of the zone we are iterating over.
221 */
222 struct GNUNET_CRYPTO_EcdsaPrivateKey identity;
223
224 /**
225 * Namestore Queue Entry
226 */
227 struct GNUNET_NAMESTORE_QueueEntry *ns_qe;
228
229 /**
230 * The issuer egos ABE master key
231 */
232 struct GNUNET_ABE_AbeMasterKey *abe_key;
233
234 /**
235 * Recreate master keys
236 */
237 int recreate;
238};
239
240/** 179/**
241 * An attribute iteration operation. 180 * An attribute iteration operation.
242 */ 181 */
@@ -263,11 +202,6 @@ struct AttributeIterator
263 struct GNUNET_CRYPTO_EcdsaPrivateKey identity; 202 struct GNUNET_CRYPTO_EcdsaPrivateKey identity;
264 203
265 /** 204 /**
266 * The issuer egos ABE master key
267 */
268 struct GNUNET_ABE_AbeMasterKey *abe_key;
269
270 /**
271 * Namestore iterator 205 * Namestore iterator
272 */ 206 */
273 struct GNUNET_NAMESTORE_ZoneIterator *ns_it; 207 struct GNUNET_NAMESTORE_ZoneIterator *ns_it;
@@ -296,17 +230,17 @@ struct IdpClient
296 * Message queue for transmission to @e client 230 * Message queue for transmission to @e client
297 */ 231 */
298 struct GNUNET_MQ_Handle *mq; 232 struct GNUNET_MQ_Handle *mq;
299 233
300 /** 234 /**
301 * Head of the DLL of 235 * Head of the DLL of
302 * Attribute iteration operations in 236 * Attribute iteration operations in
303 * progress initiated by this client 237 * progress initiated by this client
304 */ 238 */
305 struct AttributeIterator *attr_iter_head; 239 struct AttributeIterator *attr_iter_head;
306 240
307 /** 241 /**
308 * Tail of the DLL of 242 * Tail of the DLL of
309 * Attribute iteration operations 243 * Attribute iteration operations
310 * in progress initiated by this client 244 * in progress initiated by this client
311 */ 245 */
312 struct AttributeIterator *attr_iter_tail; 246 struct AttributeIterator *attr_iter_tail;
@@ -391,11 +325,6 @@ struct AttributeStoreHandle
391 struct GNUNET_CRYPTO_EcdsaPublicKey identity_pkey; 325 struct GNUNET_CRYPTO_EcdsaPublicKey identity_pkey;
392 326
393 /** 327 /**
394 * The issuer egos ABE master key
395 */
396 struct GNUNET_ABE_AbeMasterKey *abe_key;
397
398 /**
399 * QueueEntry 328 * QueueEntry
400 */ 329 */
401 struct GNUNET_NAMESTORE_QueueEntry *ns_qe; 330 struct GNUNET_NAMESTORE_QueueEntry *ns_qe;
@@ -466,27 +395,22 @@ struct ConsumeTicketHandle
466 * Lookup DLL 395 * Lookup DLL
467 */ 396 */
468 struct ParallelLookup *parallel_lookups_tail; 397 struct ParallelLookup *parallel_lookups_tail;
469 398
470 /** 399 /**
471 * Kill task 400 * Kill task
472 */ 401 */
473 struct GNUNET_SCHEDULER_Task *kill_task; 402 struct GNUNET_SCHEDULER_Task *kill_task;
474 403
475 /** 404 /**
476 * The ABE key
477 */
478 struct GNUNET_ABE_AbeKey *key;
479
480 /**
481 * Attributes 405 * Attributes
482 */ 406 */
483 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs; 407 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs;
484 408
485 /** 409 /**
486 * Lookup time 410 * Lookup time
487 */ 411 */
488 struct GNUNET_TIME_Absolute lookup_start_time; 412 struct GNUNET_TIME_Absolute lookup_start_time;
489 413
490 /** 414 /**
491 * request id 415 * request id
492 */ 416 */
@@ -520,6 +444,32 @@ struct ParallelLookup
520}; 444};
521 445
522/** 446/**
447 * Updated attribute IDs
448 */
449struct TicketAttributeUpdateEntry
450{
451 /**
452 * DLL
453 */
454 struct TicketAttributeUpdateEntry *next;
455
456 /**
457 * DLL
458 */
459 struct TicketAttributeUpdateEntry *prev;
460
461 /**
462 * The old ID
463 */
464 uint64_t old_id;
465
466 /**
467 * The new ID
468 */
469 uint64_t new_id;
470};
471
472/**
523 * Ticket revocation request handle 473 * Ticket revocation request handle
524 */ 474 */
525struct TicketRevocationHandle 475struct TicketRevocationHandle
@@ -535,6 +485,16 @@ struct TicketRevocationHandle
535 struct TicketRevocationHandle *next; 485 struct TicketRevocationHandle *next;
536 486
537 /** 487 /**
488 * Attribute updates
489 */
490 struct TicketAttributeUpdateEntry *attr_updates_head;
491
492 /**
493 * Attribute updates
494 */
495 struct TicketAttributeUpdateEntry *attr_updates_tail;
496
497 /**
538 * Client connection 498 * Client connection
539 */ 499 */
540 struct IdpClient *client; 500 struct IdpClient *client;
@@ -570,11 +530,6 @@ struct TicketRevocationHandle
570 struct GNUNET_NAMESTORE_ZoneIterator *ns_it; 530 struct GNUNET_NAMESTORE_ZoneIterator *ns_it;
571 531
572 /** 532 /**
573 * The ABE master key
574 */
575 struct GNUNET_ABE_AbeMasterKey *abe_key;
576
577 /**
578 * Offset 533 * Offset
579 */ 534 */
580 uint32_t offset; 535 uint32_t offset;
@@ -635,7 +590,8 @@ struct TicketIssueHandle
635 590
636 591
637/** 592/**
638 * DLL for ego handles to egos containing the ID_ATTRS in a map in json_t format 593 * DLL for ego handles to egos containing the RECLAIM_ATTRS in a
594 * map in json_t format
639 * 595 *
640 */ 596 */
641struct EgoEntry 597struct EgoEntry
@@ -677,7 +633,7 @@ cleanup()
677 stats = NULL; 633 stats = NULL;
678 } 634 }
679 GNUNET_break (NULL == GNUNET_PLUGIN_unload (db_lib_name, 635 GNUNET_break (NULL == GNUNET_PLUGIN_unload (db_lib_name,
680 TKT_database)); 636 TKT_database));
681 GNUNET_free (db_lib_name); 637 GNUNET_free (db_lib_name);
682 db_lib_name = NULL; 638 db_lib_name = NULL;
683 if (NULL != timeout_task) 639 if (NULL != timeout_task)
@@ -694,11 +650,8 @@ cleanup()
694 GNUNET_NAMESTORE_zone_iteration_stop (ns_it); 650 GNUNET_NAMESTORE_zone_iteration_stop (ns_it);
695 if (NULL != ns_qe) 651 if (NULL != ns_qe)
696 GNUNET_NAMESTORE_cancel (ns_qe); 652 GNUNET_NAMESTORE_cancel (ns_qe);
697 if (NULL != ns_handle) 653 if (NULL != nsh)
698 GNUNET_NAMESTORE_disconnect (ns_handle); 654 GNUNET_NAMESTORE_disconnect (nsh);
699 GNUNET_free_non_null (token);
700 GNUNET_free_non_null (label);
701
702} 655}
703 656
704/** 657/**
@@ -714,151 +667,11 @@ do_shutdown (void *cls)
714 cleanup(); 667 cleanup();
715} 668}
716 669
717/**
718 * Finished storing newly bootstrapped ABE key
719 */
720static void
721bootstrap_store_cont (void *cls,
722 int32_t success,
723 const char *emsg)
724{
725 struct AbeBootstrapHandle *abh = cls;
726 if (GNUNET_SYSERR == success)
727 {
728 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
729 "Failed to bootstrap ABE master %s\n",
730 emsg);
731 abh->proc (abh->proc_cls, NULL);
732 GNUNET_free (abh->abe_key);
733 GNUNET_free (abh);
734 return;
735 }
736 abh->proc (abh->proc_cls, abh->abe_key);
737 GNUNET_free (abh);
738}
739
740
741/**
742 * Error checking for ABE master
743 */
744static void
745bootstrap_abe_error (void *cls)
746{
747 struct AbeBootstrapHandle *abh = cls;
748 abh->proc (abh->proc_cls, NULL);
749 GNUNET_free (abh);
750}
751
752
753/**
754 * Handle ABE lookup in namestore
755 */
756static void
757bootstrap_abe_result (void *cls,
758 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
759 const char *label,
760 unsigned int rd_count,
761 const struct GNUNET_GNSRECORD_Data *rd)
762{
763 struct AbeBootstrapHandle *abh = cls;
764 struct GNUNET_ABE_AbeMasterKey *abe_key;
765
766 for (uint32_t i=0;i<rd_count;i++) {
767 if (GNUNET_GNSRECORD_TYPE_ABE_MASTER != rd[i].record_type)
768 continue;
769 if (GNUNET_YES == abh->recreate)
770 continue;
771 abe_key = GNUNET_ABE_cpabe_deserialize_master_key (rd[i].data,
772 rd[i].data_size);
773 abh->proc (abh->proc_cls, abe_key);
774 GNUNET_free (abh);
775 return;
776 }
777
778 //No ABE master found, bootstrapping...
779 abh->abe_key = GNUNET_ABE_cpabe_create_master_key ();
780
781 {
782 struct GNUNET_GNSRECORD_Data rdn[rd_count+1];
783 char *key;
784 unsigned int rd_count_new = rd_count + 1;
785
786 for (uint32_t i=0;i<rd_count;i++) {
787 if ((GNUNET_YES == abh->recreate) &&
788 (GNUNET_GNSRECORD_TYPE_ABE_MASTER == rd[i].record_type))
789 {
790 rdn[i].data_size = GNUNET_ABE_cpabe_serialize_master_key (abh->abe_key,
791 (void**)&key);
792 rdn[i].data = key;
793 rdn[i].record_type = GNUNET_GNSRECORD_TYPE_ABE_MASTER;
794 rdn[i].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION | GNUNET_GNSRECORD_RF_PRIVATE;
795 rdn[i].expiration_time = GNUNET_TIME_UNIT_HOURS.rel_value_us; //TODO sane?
796 rd_count_new = rd_count;
797 } else {
798 GNUNET_memcpy (&rdn[i],
799 &rd[i],
800 sizeof (struct GNUNET_GNSRECORD_Data));
801 }
802 }
803 if (rd_count < rd_count_new) {
804 rdn[rd_count].data_size = GNUNET_ABE_cpabe_serialize_master_key (abh->abe_key,
805 (void**)&key);
806 rdn[rd_count].data = key;
807 rdn[rd_count].record_type = GNUNET_GNSRECORD_TYPE_ABE_MASTER;
808 rdn[rd_count].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION | GNUNET_GNSRECORD_RF_PRIVATE;
809 rdn[rd_count].expiration_time = GNUNET_TIME_UNIT_HOURS.rel_value_us; //TODO sane?
810 }
811
812 abh->ns_qe = GNUNET_NAMESTORE_records_store (ns_handle,
813 &abh->identity,
814 GNUNET_GNS_EMPTY_LABEL_AT,
815 rd_count_new,
816 rdn,
817 &bootstrap_store_cont,
818 abh);
819 GNUNET_free (key);
820 }
821}
822
823/**
824 * Bootstrap ABE master if it does not yet exists.
825 * Will call the AbeBootstrapResult processor when done.
826 * will always recreate the ABE key of GNUNET_YES == recreate
827 */
828static void
829bootstrap_abe (const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
830 AbeBootstrapResult proc,
831 void* cls,
832 int recreate)
833{
834 struct AbeBootstrapHandle *abh;
835
836 abh = GNUNET_new (struct AbeBootstrapHandle);
837 abh->proc = proc;
838 abh->proc_cls = cls;
839 abh->identity = *identity;
840 if (GNUNET_YES == recreate)
841 {
842 abh->abe_key = GNUNET_ABE_cpabe_create_master_key ();
843 abh->recreate = GNUNET_YES;
844 } else {
845 abh->recreate = GNUNET_NO;
846 }
847 abh->ns_qe = GNUNET_NAMESTORE_records_lookup (ns_handle,
848 identity,
849 GNUNET_GNS_EMPTY_LABEL_AT,
850 &bootstrap_abe_error,
851 abh,
852 &bootstrap_abe_result,
853 abh);
854}
855
856
857 670
858static int 671static int
859create_sym_key_from_ecdh(const struct GNUNET_HashCode *new_key_hash, 672create_sym_key_from_ecdh (const struct GNUNET_HashCode *new_key_hash,
860 struct GNUNET_CRYPTO_SymmetricSessionKey *skey, 673 struct GNUNET_CRYPTO_SymmetricSessionKey *skey,
861 struct GNUNET_CRYPTO_SymmetricInitializationVector *iv) 674 struct GNUNET_CRYPTO_SymmetricInitializationVector *iv)
862{ 675{
863 struct GNUNET_CRYPTO_HashAsciiEncoded new_key_hash_str; 676 struct GNUNET_CRYPTO_HashAsciiEncoded new_key_hash_str;
864 677
@@ -950,68 +763,60 @@ store_ticket_issue_cont (void *cls,
950} 763}
951 764
952 765
953 766static int
954int 767serialize_authz_record (const struct GNUNET_RECLAIM_Ticket *ticket,
955serialize_abe_keyinfo2 (const struct GNUNET_RECLAIM_Ticket *ticket, 768 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
956 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs, 769 struct GNUNET_CRYPTO_EcdhePrivateKey **ecdh_privkey,
957 const struct GNUNET_ABE_AbeKey *rp_key, 770 char **result)
958 struct GNUNET_CRYPTO_EcdhePrivateKey **ecdh_privkey,
959 char **result)
960{ 771{
961 struct GNUNET_CRYPTO_EcdhePublicKey ecdh_pubkey; 772 struct GNUNET_CRYPTO_EcdhePublicKey ecdh_pubkey;
962 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le; 773 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
963 char *enc_keyinfo;
964 char *serialized_key;
965 char *buf;
966 char *write_ptr;
967 char attrs_str_len;
968 ssize_t size;
969
970 struct GNUNET_CRYPTO_SymmetricSessionKey skey; 774 struct GNUNET_CRYPTO_SymmetricSessionKey skey;
971 struct GNUNET_CRYPTO_SymmetricInitializationVector iv; 775 struct GNUNET_CRYPTO_SymmetricInitializationVector iv;
972 struct GNUNET_HashCode new_key_hash; 776 struct GNUNET_HashCode new_key_hash;
973 ssize_t enc_size; 777 ssize_t enc_size;
778 char *enc_keyinfo;
779 char *buf;
780 char *write_ptr;
781 char attrs_str_len;
782 char* label;
974 783
975 size = GNUNET_ABE_cpabe_serialize_key (rp_key, 784 GNUNET_assert (NULL != attrs->list_head);
976 (void**)&serialized_key);
977 attrs_str_len = 0; 785 attrs_str_len = 0;
978 for (le = attrs->list_head; NULL != le; le = le->next) { 786 for (le = attrs->list_head; NULL != le; le = le->next) {
979 attrs_str_len += strlen (le->claim->name) + 1; 787 attrs_str_len += 15 + 1; //TODO propery calculate
980 } 788 }
981 buf = GNUNET_malloc (attrs_str_len + size); 789 buf = GNUNET_malloc (attrs_str_len);
982 write_ptr = buf; 790 write_ptr = buf;
983 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 791 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
984 "Writing attributes\n"); 792 "Writing attributes\n");
985 for (le = attrs->list_head; NULL != le; le = le->next) { 793 for (le = attrs->list_head; NULL != le; le = le->next) {
986 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 794 label = GNUNET_STRINGS_data_to_string_alloc (&le->claim->id,
987 "%s\n", le->claim->name); 795 sizeof (uint64_t));
988 796 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
797 "Adding attribute to record: %s\n", label);
989 798
990 GNUNET_memcpy (write_ptr, 799 GNUNET_memcpy (write_ptr,
991 le->claim->name, 800 label,
992 strlen (le->claim->name)); 801 strlen (label));
993 write_ptr[strlen (le->claim->name)] = ','; 802 write_ptr[strlen (label)] = ',';
994 write_ptr += strlen (le->claim->name) + 1; 803 write_ptr += strlen (label) + 1;
804 GNUNET_free (label);
995 } 805 }
996 write_ptr--; 806 write_ptr--;
997 write_ptr[0] = '\0'; //replace last , with a 0-terminator 807 write_ptr[0] = '\0'; //replace last , with a 0-terminator
998 write_ptr++;
999 GNUNET_memcpy (write_ptr,
1000 serialized_key,
1001 size);
1002 GNUNET_free (serialized_key);
1003 // ECDH keypair E = eG 808 // ECDH keypair E = eG
1004 *ecdh_privkey = GNUNET_CRYPTO_ecdhe_key_create(); 809 *ecdh_privkey = GNUNET_CRYPTO_ecdhe_key_create();
1005 GNUNET_CRYPTO_ecdhe_key_get_public (*ecdh_privkey, 810 GNUNET_CRYPTO_ecdhe_key_get_public (*ecdh_privkey,
1006 &ecdh_pubkey); 811 &ecdh_pubkey);
1007 enc_keyinfo = GNUNET_malloc (size + attrs_str_len); 812 enc_keyinfo = GNUNET_malloc (attrs_str_len);
1008 // Derived key K = H(eB) 813 // Derived key K = H(eB)
1009 GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_ecdh_ecdsa (*ecdh_privkey, 814 GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_ecdh_ecdsa (*ecdh_privkey,
1010 &ticket->audience, 815 &ticket->audience,
1011 &new_key_hash)); 816 &new_key_hash));
1012 create_sym_key_from_ecdh(&new_key_hash, &skey, &iv); 817 create_sym_key_from_ecdh (&new_key_hash, &skey, &iv);
1013 enc_size = GNUNET_CRYPTO_symmetric_encrypt (buf, 818 enc_size = GNUNET_CRYPTO_symmetric_encrypt (buf,
1014 size + attrs_str_len, 819 attrs_str_len,
1015 &skey, &iv, 820 &skey, &iv,
1016 enc_keyinfo); 821 enc_keyinfo);
1017 *result = GNUNET_malloc (sizeof (struct GNUNET_CRYPTO_EcdhePublicKey)+ 822 *result = GNUNET_malloc (sizeof (struct GNUNET_CRYPTO_EcdhePublicKey)+
@@ -1030,73 +835,38 @@ serialize_abe_keyinfo2 (const struct GNUNET_RECLAIM_Ticket *ticket,
1030 835
1031 836
1032static void 837static void
1033issue_ticket_after_abe_bootstrap (void *cls, 838issue_ticket (struct TicketIssueHandle *ih)
1034 struct GNUNET_ABE_AbeMasterKey *abe_key)
1035{ 839{
1036 struct TicketIssueHandle *ih = cls;
1037 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
1038 struct GNUNET_CRYPTO_EcdhePrivateKey *ecdhe_privkey; 840 struct GNUNET_CRYPTO_EcdhePrivateKey *ecdhe_privkey;
1039 struct GNUNET_GNSRECORD_Data code_record[1]; 841 struct GNUNET_GNSRECORD_Data code_record[1];
1040 struct GNUNET_ABE_AbeKey *rp_key; 842 char *authz_record_data;
1041 char *code_record_data; 843 size_t authz_record_len;
1042 char **attrs;
1043 char *label; 844 char *label;
1044 char *policy;
1045 int attrs_len;
1046 uint32_t i;
1047 size_t code_record_len;
1048 845
1049 //Create new ABE key for RP 846 //TODO rename function
1050 attrs_len = 0; 847 authz_record_len = serialize_authz_record (&ih->ticket,
1051 for (le = ih->attrs->list_head; NULL != le; le = le->next) 848 ih->attrs,
1052 attrs_len++; 849 &ecdhe_privkey,
1053 attrs = GNUNET_malloc ((attrs_len + 1)*sizeof (char*)); 850 &authz_record_data);
1054 i = 0; 851 code_record[0].data = authz_record_data;
1055 for (le = ih->attrs->list_head; NULL != le; le = le->next) { 852 code_record[0].data_size = authz_record_len;
1056 GNUNET_asprintf (&policy, "%s_%lu",
1057 le->claim->name,
1058 le->claim->version);
1059 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1060 "Adding attribute to key: %s\n",
1061 policy);
1062 attrs[i] = policy;
1063 i++;
1064 }
1065 attrs[i] = NULL;
1066 rp_key = GNUNET_ABE_cpabe_create_key (abe_key,
1067 attrs);
1068
1069 //TODO review this wireformat
1070 code_record_len = serialize_abe_keyinfo2 (&ih->ticket,
1071 ih->attrs,
1072 rp_key,
1073 &ecdhe_privkey,
1074 &code_record_data);
1075 code_record[0].data = code_record_data;
1076 code_record[0].data_size = code_record_len;
1077 code_record[0].expiration_time = GNUNET_TIME_UNIT_DAYS.rel_value_us; 853 code_record[0].expiration_time = GNUNET_TIME_UNIT_DAYS.rel_value_us;
1078 code_record[0].record_type = GNUNET_GNSRECORD_TYPE_ABE_KEY; 854 code_record[0].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_AUTHZ;
1079 code_record[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; 855 code_record[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
1080 856
1081 label = GNUNET_STRINGS_data_to_string_alloc (&ih->ticket.rnd, 857 label = GNUNET_STRINGS_data_to_string_alloc (&ih->ticket.rnd,
1082 sizeof (uint64_t)); 858 sizeof (uint64_t));
1083 //Publish record 859 //Publish record
1084 ih->ns_qe = GNUNET_NAMESTORE_records_store (ns_handle, 860 ih->ns_qe = GNUNET_NAMESTORE_records_store (nsh,
1085 &ih->identity, 861 &ih->identity,
1086 label, 862 label,
1087 1, 863 1,
1088 code_record, 864 code_record,
1089 &store_ticket_issue_cont, 865 &store_ticket_issue_cont,
1090 ih); 866 ih);
1091 //for (; i > 0; i--)
1092 // GNUNET_free (attrs[i-1]);
1093 GNUNET_free (ecdhe_privkey); 867 GNUNET_free (ecdhe_privkey);
1094 GNUNET_free (label); 868 GNUNET_free (label);
1095 GNUNET_free (attrs); 869 GNUNET_free (authz_record_data);
1096 GNUNET_free (code_record_data);
1097 GNUNET_ABE_cpabe_delete_key (rp_key,
1098 GNUNET_YES);
1099 GNUNET_ABE_cpabe_delete_master_key (abe_key);
1100} 870}
1101 871
1102 872
@@ -1139,7 +909,7 @@ handle_issue_ticket_message (void *cls,
1139 GNUNET_CONTAINER_DLL_insert (idp->issue_op_head, 909 GNUNET_CONTAINER_DLL_insert (idp->issue_op_head,
1140 idp->issue_op_tail, 910 idp->issue_op_tail,
1141 ih); 911 ih);
1142 bootstrap_abe (&ih->identity, &issue_ticket_after_abe_bootstrap, ih, GNUNET_NO); 912 issue_ticket (ih);
1143 GNUNET_SERVICE_client_continue (idp->client); 913 GNUNET_SERVICE_client_continue (idp->client);
1144 914
1145} 915}
@@ -1160,8 +930,6 @@ cleanup_revoke_ticket_handle (struct TicketRevocationHandle *rh)
1160 GNUNET_RECLAIM_ATTRIBUTE_list_destroy (rh->attrs); 930 GNUNET_RECLAIM_ATTRIBUTE_list_destroy (rh->attrs);
1161 if (NULL != rh->rvk_attrs) 931 if (NULL != rh->rvk_attrs)
1162 GNUNET_RECLAIM_ATTRIBUTE_list_destroy (rh->rvk_attrs); 932 GNUNET_RECLAIM_ATTRIBUTE_list_destroy (rh->rvk_attrs);
1163 if (NULL != rh->abe_key)
1164 GNUNET_ABE_cpabe_delete_master_key (rh->abe_key);
1165 if (NULL != rh->ns_qe) 933 if (NULL != rh->ns_qe)
1166 GNUNET_NAMESTORE_cancel (rh->ns_qe); 934 GNUNET_NAMESTORE_cancel (rh->ns_qe);
1167 if (NULL != rh->ns_it) 935 if (NULL != rh->ns_it)
@@ -1255,19 +1023,14 @@ ticket_reissue_proc (void *cls,
1255 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs) 1023 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs)
1256{ 1024{
1257 struct TicketRevocationHandle *rh = cls; 1025 struct TicketRevocationHandle *rh = cls;
1026 struct TicketAttributeUpdateEntry *tue;
1258 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le; 1027 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
1259 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le_rollover;
1260 struct GNUNET_CRYPTO_EcdhePrivateKey *ecdhe_privkey; 1028 struct GNUNET_CRYPTO_EcdhePrivateKey *ecdhe_privkey;
1261 struct GNUNET_GNSRECORD_Data code_record[1]; 1029 struct GNUNET_GNSRECORD_Data code_record[1];
1262 struct GNUNET_ABE_AbeKey *rp_key;
1263 char *code_record_data;
1264 char **attr_arr;
1265 char *label;
1266 char *policy;
1267 int attrs_len;
1268 uint32_t i;
1269 int reissue_ticket; 1030 int reissue_ticket;
1270 size_t code_record_len; 1031 size_t authz_record_len;
1032 char *authz_record_data;
1033 char *label;
1271 1034
1272 1035
1273 if (NULL == ticket) 1036 if (NULL == ticket)
@@ -1286,7 +1049,7 @@ ticket_reissue_proc (void *cls,
1286 label = GNUNET_STRINGS_data_to_string_alloc (&rh->ticket.rnd, 1049 label = GNUNET_STRINGS_data_to_string_alloc (&rh->ticket.rnd,
1287 sizeof (uint64_t)); 1050 sizeof (uint64_t));
1288 //Delete record 1051 //Delete record
1289 rh->ns_qe = GNUNET_NAMESTORE_records_store (ns_handle, 1052 rh->ns_qe = GNUNET_NAMESTORE_records_store (nsh,
1290 &rh->identity, 1053 &rh->identity,
1291 label, 1054 label,
1292 0, 1055 0,
@@ -1298,21 +1061,20 @@ ticket_reissue_proc (void *cls,
1298 return; 1061 return;
1299 } 1062 }
1300 1063
1301 /* 1064 /*
1302 * Check if any attribute of this ticket intersects with a rollover attribute 1065 * Check if any attribute of this ticket intersects with a rollover attribute
1303 */ 1066 */
1304 reissue_ticket = GNUNET_NO; 1067 reissue_ticket = GNUNET_NO;
1305 for (le = attrs->list_head; NULL != le; le = le->next) 1068 for (le = attrs->list_head; NULL != le; le = le->next)
1306 { 1069 {
1307 for (le_rollover = rh->rvk_attrs->list_head; 1070 for (tue = rh->attr_updates_head;
1308 NULL != le_rollover; 1071 NULL != tue;
1309 le_rollover = le_rollover->next) 1072 tue = tue->next)
1310 { 1073 {
1311 if (0 == strcmp (le_rollover->claim->name, 1074 if (tue->old_id == le->claim->id)
1312 le->claim->name))
1313 { 1075 {
1314 reissue_ticket = GNUNET_YES; 1076 reissue_ticket = GNUNET_YES;
1315 le->claim->version = le_rollover->claim->version; 1077 le->claim->id = tue->new_id;
1316 } 1078 }
1317 } 1079 }
1318 } 1080 }
@@ -1330,56 +1092,33 @@ ticket_reissue_proc (void *cls,
1330 } 1092 }
1331 1093
1332 //Create new ABE key for RP 1094 //Create new ABE key for RP
1333 attrs_len = 0;
1334 1095
1335 /* If this is the RP we want to revoke attributes of, the do so */ 1096 /* If this is the RP we want to revoke attributes of, the do so */
1336 1097
1337 for (le = attrs->list_head; NULL != le; le = le->next) 1098 //TODO rename function
1338 attrs_len++; 1099 authz_record_len = serialize_authz_record (ticket,
1339 attr_arr = GNUNET_malloc ((attrs_len + 1)*sizeof (char*)); 1100 attrs,
1340 i = 0; 1101 &ecdhe_privkey,
1341 for (le = attrs->list_head; NULL != le; le = le->next) { 1102 &authz_record_data);
1342 GNUNET_asprintf (&policy, "%s_%lu", 1103 code_record[0].data = authz_record_data;
1343 le->claim->name, 1104 code_record[0].data_size = authz_record_len;
1344 le->claim->version);
1345 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1346 "Recreating key with %s\n", policy);
1347 attr_arr[i] = policy;
1348 i++;
1349 }
1350 attr_arr[i] = NULL;
1351 rp_key = GNUNET_ABE_cpabe_create_key (rh->abe_key,
1352 attr_arr);
1353
1354 //TODO review this wireformat
1355 code_record_len = serialize_abe_keyinfo2 (ticket,
1356 attrs,
1357 rp_key,
1358 &ecdhe_privkey,
1359 &code_record_data);
1360 code_record[0].data = code_record_data;
1361 code_record[0].data_size = code_record_len;
1362 code_record[0].expiration_time = GNUNET_TIME_UNIT_DAYS.rel_value_us; 1105 code_record[0].expiration_time = GNUNET_TIME_UNIT_DAYS.rel_value_us;
1363 code_record[0].record_type = GNUNET_GNSRECORD_TYPE_ABE_KEY; 1106 code_record[0].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_AUTHZ;
1364 code_record[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; 1107 code_record[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
1365 1108
1366 label = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, 1109 label = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd,
1367 sizeof (uint64_t)); 1110 sizeof (uint64_t));
1368 //Publish record 1111 //Publish record
1369 rh->ns_qe = GNUNET_NAMESTORE_records_store (ns_handle, 1112 rh->ns_qe = GNUNET_NAMESTORE_records_store (nsh,
1370 &rh->identity, 1113 &rh->identity,
1371 label, 1114 label,
1372 1, 1115 1,
1373 code_record, 1116 code_record,
1374 &reissue_ticket_cont, 1117 &reissue_ticket_cont,
1375 rh); 1118 rh);
1376 //for (; i > 0; i--)
1377 // GNUNET_free (attr_arr[i-1]);
1378 GNUNET_free (ecdhe_privkey); 1119 GNUNET_free (ecdhe_privkey);
1379 GNUNET_free (label); 1120 GNUNET_free (label);
1380 GNUNET_free (attr_arr); 1121 GNUNET_free (authz_record_data);
1381 GNUNET_free (code_record_data);
1382 GNUNET_ABE_cpabe_delete_key (rp_key, GNUNET_YES);
1383} 1122}
1384 1123
1385 1124
@@ -1446,14 +1185,11 @@ check_attr_cb (void *cls,
1446 const struct GNUNET_GNSRECORD_Data *rd_old) 1185 const struct GNUNET_GNSRECORD_Data *rd_old)
1447{ 1186{
1448 struct TicketRevocationHandle *rh = cls; 1187 struct TicketRevocationHandle *rh = cls;
1188 struct TicketAttributeUpdateEntry *tue;
1449 struct GNUNET_GNSRECORD_Data rd[1]; 1189 struct GNUNET_GNSRECORD_Data rd[1];
1450 char* buf; 1190 char* buf;
1451 char* enc_buf;
1452 size_t enc_size;
1453 char* rd_buf;
1454 size_t buf_size; 1191 size_t buf_size;
1455 char* policy; 1192 char* new_label;
1456 uint32_t attr_ver;
1457 1193
1458 rh->ns_qe = NULL; 1194 rh->ns_qe = NULL;
1459 if (1 != rd_count) { 1195 if (1 != rd_count) {
@@ -1467,54 +1203,30 @@ check_attr_cb (void *cls,
1467 rh->attrs->list_head->claim->version++; 1203 rh->attrs->list_head->claim->version++;
1468 GNUNET_RECLAIM_ATTRIBUTE_serialize (rh->attrs->list_head->claim, 1204 GNUNET_RECLAIM_ATTRIBUTE_serialize (rh->attrs->list_head->claim,
1469 buf); 1205 buf);
1470 GNUNET_asprintf (&policy, "%s_%lu", 1206 tue = GNUNET_new (struct TicketAttributeUpdateEntry);
1471 rh->attrs->list_head->claim->name, 1207 tue->old_id = rh->attrs->list_head->claim->id;
1472 rh->attrs->list_head->claim->version); 1208 tue->new_id = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG,
1209 UINT64_MAX);
1210 GNUNET_CONTAINER_DLL_insert (rh->attr_updates_head,
1211 rh->attr_updates_tail,
1212 tue);
1213 rh->attrs->list_head->claim->id = tue->new_id;
1214 new_label = GNUNET_STRINGS_data_to_string_alloc (&tue->new_id,
1215 sizeof (uint64_t));
1473 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1216 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1474 "Encrypting with policy %s\n", policy); 1217 "New attr id %s\n", new_label);
1475 /** 1218 rd[0].data_size = buf_size;
1476 * Encrypt the attribute value and store in namestore 1219 rd[0].data = buf;
1477 */ 1220 rd[0].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR;
1478 enc_size = GNUNET_ABE_cpabe_encrypt (buf,
1479 buf_size,
1480 policy, //Policy
1481 rh->abe_key,
1482 (void**)&enc_buf);
1483 GNUNET_free (buf);
1484 if (GNUNET_SYSERR == enc_size)
1485 {
1486 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1487 "Unable to re-encrypt with policy %s\n",
1488 policy);
1489 GNUNET_free (policy);
1490 send_revocation_finished (rh, GNUNET_SYSERR);
1491 cleanup_revoke_ticket_handle (rh);
1492 return;
1493 }
1494 GNUNET_free (policy);
1495
1496 rd[0].data_size = enc_size + sizeof (uint32_t);
1497 rd_buf = GNUNET_malloc (rd[0].data_size);
1498 attr_ver = htonl (rh->attrs->list_head->claim->version);
1499 GNUNET_memcpy (rd_buf,
1500 &attr_ver,
1501 sizeof (uint32_t));
1502 GNUNET_memcpy (rd_buf+sizeof (uint32_t),
1503 enc_buf,
1504 enc_size);
1505 rd[0].data = rd_buf;
1506 rd[0].record_type = GNUNET_GNSRECORD_TYPE_ID_ATTR;
1507 rd[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; 1221 rd[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
1508 rd[0].expiration_time = rd_old[0].expiration_time; 1222 rd[0].expiration_time = rd_old[0].expiration_time;
1509 rh->ns_qe = GNUNET_NAMESTORE_records_store (ns_handle, 1223 rh->ns_qe = GNUNET_NAMESTORE_records_store (nsh,
1510 &rh->identity, 1224 &rh->identity,
1511 rh->attrs->list_head->claim->name, 1225 new_label,
1512 1, 1226 1,
1513 rd, 1227 rd,
1514 &attr_reenc_cont, 1228 &attr_reenc_cont,
1515 rh); 1229 rh);
1516 GNUNET_free (enc_buf);
1517 GNUNET_free (rd_buf);
1518} 1230}
1519 1231
1520 1232
@@ -1526,19 +1238,23 @@ static void
1526reenc_next_attribute (void *cls) 1238reenc_next_attribute (void *cls)
1527{ 1239{
1528 struct TicketRevocationHandle *rh = cls; 1240 struct TicketRevocationHandle *rh = cls;
1241 char *label;
1529 if (NULL == rh->attrs->list_head) 1242 if (NULL == rh->attrs->list_head)
1530 { 1243 {
1531 revocation_reissue_tickets (rh); 1244 revocation_reissue_tickets (rh);
1532 return; 1245 return;
1533 } 1246 }
1534 /* First check if attribute still exists */ 1247 /* First check if attribute still exists */
1535 rh->ns_qe = GNUNET_NAMESTORE_records_lookup (ns_handle, 1248 label = GNUNET_STRINGS_data_to_string_alloc (&rh->attrs->list_head->claim->id,
1249 sizeof (uint64_t));
1250 rh->ns_qe = GNUNET_NAMESTORE_records_lookup (nsh,
1536 &rh->identity, 1251 &rh->identity,
1537 rh->attrs->list_head->claim->name, 1252 label,
1538 &check_attr_error, 1253 &check_attr_error,
1539 rh, 1254 rh,
1540 &check_attr_cb, 1255 &check_attr_cb,
1541 rh); 1256 rh);
1257 GNUNET_free (label);
1542} 1258}
1543 1259
1544 1260
@@ -1610,21 +1326,6 @@ process_attributes_to_update (void *cls,
1610} 1326}
1611 1327
1612 1328
1613
1614static void
1615get_ticket_after_abe_bootstrap (void *cls,
1616 struct GNUNET_ABE_AbeMasterKey *abe_key)
1617{
1618 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1619 "Finished ABE bootstrap\n");
1620 struct TicketRevocationHandle *rh = cls;
1621 rh->abe_key = abe_key;
1622 TKT_database->get_ticket_attributes (TKT_database->cls,
1623 &rh->ticket,
1624 &process_attributes_to_update,
1625 rh);
1626}
1627
1628static int 1329static int
1629check_revoke_ticket_message(void *cls, 1330check_revoke_ticket_message(void *cls,
1630 const struct RevokeTicketMessage *im) 1331 const struct RevokeTicketMessage *im)
@@ -1660,7 +1361,13 @@ handle_revoke_ticket_message (void *cls,
1660 GNUNET_CONTAINER_DLL_insert (idp->revoke_op_head, 1361 GNUNET_CONTAINER_DLL_insert (idp->revoke_op_head,
1661 idp->revoke_op_tail, 1362 idp->revoke_op_tail,
1662 rh); 1363 rh);
1663 bootstrap_abe (&rh->identity, &get_ticket_after_abe_bootstrap, rh, GNUNET_NO); 1364 /**
1365 * TODO replace with GNS storage
1366 */
1367 TKT_database->get_ticket_attributes (TKT_database->cls,
1368 &rh->ticket,
1369 &process_attributes_to_update,
1370 rh);
1664 GNUNET_SERVICE_client_continue (idp->client); 1371 GNUNET_SERVICE_client_continue (idp->client);
1665 1372
1666} 1373}
@@ -1672,7 +1379,7 @@ handle_revoke_ticket_message (void *cls,
1672static void 1379static void
1673cleanup_consume_ticket_handle (struct ConsumeTicketHandle *handle) 1380cleanup_consume_ticket_handle (struct ConsumeTicketHandle *handle)
1674{ 1381{
1675 struct ParallelLookup *lu; 1382 struct ParallelLookup *lu;
1676 struct ParallelLookup *tmp; 1383 struct ParallelLookup *tmp;
1677 if (NULL != handle->lookup_request) 1384 if (NULL != handle->lookup_request)
1678 GNUNET_GNS_lookup_cancel (handle->lookup_request); 1385 GNUNET_GNS_lookup_cancel (handle->lookup_request);
@@ -1688,9 +1395,6 @@ cleanup_consume_ticket_handle (struct ConsumeTicketHandle *handle)
1688 lu = tmp; 1395 lu = tmp;
1689 } 1396 }
1690 1397
1691 if (NULL != handle->key)
1692 GNUNET_ABE_cpabe_delete_key (handle->key,
1693 GNUNET_YES);
1694 if (NULL != handle->attrs) 1398 if (NULL != handle->attrs)
1695 GNUNET_RECLAIM_ATTRIBUTE_list_destroy (handle->attrs); 1399 GNUNET_RECLAIM_ATTRIBUTE_list_destroy (handle->attrs);
1696 GNUNET_free (handle); 1400 GNUNET_free (handle);
@@ -1724,10 +1428,7 @@ process_parallel_lookup2 (void *cls, uint32_t rd_count,
1724 struct ConsumeTicketResultMessage *crm; 1428 struct ConsumeTicketResultMessage *crm;
1725 struct GNUNET_MQ_Envelope *env; 1429 struct GNUNET_MQ_Envelope *env;
1726 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *attr_le; 1430 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *attr_le;
1727 struct GNUNET_TIME_Absolute decrypt_duration;
1728 char *data;
1729 char *data_tmp; 1431 char *data_tmp;
1730 ssize_t attr_len;
1731 size_t attrs_len; 1432 size_t attrs_len;
1732 1433
1733 GNUNET_CONTAINER_DLL_remove (handle->parallel_lookups_head, 1434 GNUNET_CONTAINER_DLL_remove (handle->parallel_lookups_head,
@@ -1748,39 +1449,22 @@ process_parallel_lookup2 (void *cls, uint32_t rd_count,
1748 GNUNET_free (parallel_lookup); 1449 GNUNET_free (parallel_lookup);
1749 if (1 != rd_count) 1450 if (1 != rd_count)
1750 GNUNET_break(0);//TODO 1451 GNUNET_break(0);//TODO
1751 if (rd->record_type == GNUNET_GNSRECORD_TYPE_ID_ATTR) 1452 if (rd->record_type == GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR)
1752 { 1453 {
1753 decrypt_duration = GNUNET_TIME_absolute_get (); 1454 attr_le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
1754 attr_len = GNUNET_ABE_cpabe_decrypt (rd->data + sizeof (uint32_t), 1455 attr_le->claim = GNUNET_RECLAIM_ATTRIBUTE_deserialize (rd->data,
1755 rd->data_size - sizeof (uint32_t), 1456 rd->data_size);
1756 handle->key, 1457 GNUNET_CONTAINER_DLL_insert (handle->attrs->list_head,
1757 (void**)&data); 1458 handle->attrs->list_tail,
1758 if (GNUNET_SYSERR != attr_len) 1459 attr_le);
1759 {
1760 GNUNET_STATISTICS_update (stats,
1761 "abe_decrypt_time_total",
1762 GNUNET_TIME_absolute_get_duration (decrypt_duration).rel_value_us,
1763 GNUNET_YES);
1764 GNUNET_STATISTICS_update (stats,
1765 "abe_decrypt_count",
1766 1,
1767 GNUNET_YES);
1768
1769 attr_le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
1770 attr_le->claim = GNUNET_RECLAIM_ATTRIBUTE_deserialize (data,
1771 attr_len);
1772 attr_le->claim->version = ntohl(*(uint32_t*)rd->data);
1773 GNUNET_CONTAINER_DLL_insert (handle->attrs->list_head,
1774 handle->attrs->list_tail,
1775 attr_le);
1776 GNUNET_free (data);
1777 }
1778 } 1460 }
1779 if (NULL != handle->parallel_lookups_head) 1461 if (NULL != handle->parallel_lookups_head)
1780 return; //Wait for more 1462 return; //Wait for more
1781 /* Else we are done */ 1463 /* Else we are done */
1782 1464
1783 /* Store ticket in DB */ 1465 /** Store ticket in DB
1466 * TODO: Store in GNS
1467 */
1784 if (GNUNET_OK != TKT_database->store_ticket (TKT_database->cls, 1468 if (GNUNET_OK != TKT_database->store_ticket (TKT_database->cls,
1785 &handle->ticket, 1469 &handle->ticket,
1786 handle->attrs)) 1470 handle->attrs))
@@ -1839,8 +1523,8 @@ abort_parallel_lookups2 (void *cls)
1839 1523
1840 1524
1841static void 1525static void
1842process_consume_abe_key (void *cls, uint32_t rd_count, 1526process_attr_labels (void *cls, uint32_t rd_count,
1843 const struct GNUNET_GNSRECORD_Data *rd) 1527 const struct GNUNET_GNSRECORD_Data *rd)
1844{ 1528{
1845 struct ConsumeTicketHandle *handle = cls; 1529 struct ConsumeTicketHandle *handle = cls;
1846 struct GNUNET_HashCode new_key_hash; 1530 struct GNUNET_HashCode new_key_hash;
@@ -1850,7 +1534,8 @@ process_consume_abe_key (void *cls, uint32_t rd_count,
1850 struct ParallelLookup *parallel_lookup; 1534 struct ParallelLookup *parallel_lookup;
1851 size_t size; 1535 size_t size;
1852 char *buf; 1536 char *buf;
1853 char *scope; 1537 char *attr_lbl;
1538 char *lbls;
1854 1539
1855 handle->lookup_request = NULL; 1540 handle->lookup_request = NULL;
1856 if (1 != rd_count) 1541 if (1 != rd_count)
@@ -1872,7 +1557,7 @@ process_consume_abe_key (void *cls, uint32_t rd_count,
1872 buf = GNUNET_malloc (rd->data_size - sizeof (struct GNUNET_CRYPTO_EcdhePublicKey)); 1557 buf = GNUNET_malloc (rd->data_size - sizeof (struct GNUNET_CRYPTO_EcdhePublicKey));
1873 1558
1874 //Calculate symmetric key from ecdh parameters 1559 //Calculate symmetric key from ecdh parameters
1875 GNUNET_assert (GNUNET_OK == 1560 GNUNET_assert (GNUNET_OK ==
1876 GNUNET_CRYPTO_ecdsa_ecdh (&handle->identity, 1561 GNUNET_CRYPTO_ecdsa_ecdh (&handle->identity,
1877 ecdh_key, 1562 ecdh_key,
1878 &new_key_hash)); 1563 &new_key_hash));
@@ -1889,33 +1574,32 @@ process_consume_abe_key (void *cls, uint32_t rd_count,
1889 "Decrypted bytes: %zd Expected bytes: %zd\n", 1574 "Decrypted bytes: %zd Expected bytes: %zd\n",
1890 size, rd->data_size - sizeof (struct GNUNET_CRYPTO_EcdhePublicKey)); 1575 size, rd->data_size - sizeof (struct GNUNET_CRYPTO_EcdhePublicKey));
1891 GNUNET_STATISTICS_update (stats, 1576 GNUNET_STATISTICS_update (stats,
1892 "abe_key_lookup_time_total", 1577 "reclaim_authz_lookup_time_total",
1893 GNUNET_TIME_absolute_get_duration (handle->lookup_start_time).rel_value_us, 1578 GNUNET_TIME_absolute_get_duration (handle->lookup_start_time).rel_value_us,
1894 GNUNET_YES); 1579 GNUNET_YES);
1895 GNUNET_STATISTICS_update (stats, 1580 GNUNET_STATISTICS_update (stats,
1896 "abe_key_lookups_count", 1581 "reclaim_authz_lookups_count",
1897 1, 1582 1,
1898 GNUNET_YES); 1583 GNUNET_YES);
1899 scopes = GNUNET_strdup (buf); 1584 lbls = GNUNET_strdup (buf);
1900 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1585 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1901 "Scopes %s\n", scopes); 1586 "Attributes found %s\n", lbls);
1902 handle->key = GNUNET_ABE_cpabe_deserialize_key ((void*)(buf + strlen (scopes) + 1),
1903 rd->data_size - sizeof (struct GNUNET_CRYPTO_EcdhePublicKey)
1904 - strlen (scopes) - 1);
1905 1587
1906 for (scope = strtok (scopes, ","); NULL != scope; scope = strtok (NULL, ",")) 1588 for (attr_lbl = strtok (lbls, ",");
1589 NULL != attr_lbl;
1590 attr_lbl = strtok (NULL, ","))
1907 { 1591 {
1908 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1592 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1909 "Looking up %s\n", scope); 1593 "Looking up %s\n", attr_lbl);
1910 parallel_lookup = GNUNET_new (struct ParallelLookup); 1594 parallel_lookup = GNUNET_new (struct ParallelLookup);
1911 parallel_lookup->handle = handle; 1595 parallel_lookup->handle = handle;
1912 parallel_lookup->label = GNUNET_strdup (scope); 1596 parallel_lookup->label = GNUNET_strdup (attr_lbl);
1913 parallel_lookup->lookup_start_time = GNUNET_TIME_absolute_get(); 1597 parallel_lookup->lookup_start_time = GNUNET_TIME_absolute_get();
1914 parallel_lookup->lookup_request 1598 parallel_lookup->lookup_request
1915 = GNUNET_GNS_lookup (gns_handle, 1599 = GNUNET_GNS_lookup (gns_handle,
1916 scope, 1600 attr_lbl,
1917 &handle->ticket.identity, 1601 &handle->ticket.identity,
1918 GNUNET_GNSRECORD_TYPE_ID_ATTR, 1602 GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR,
1919 GNUNET_GNS_LO_DEFAULT, 1603 GNUNET_GNS_LO_DEFAULT,
1920 &process_parallel_lookup2, 1604 &process_parallel_lookup2,
1921 parallel_lookup); 1605 parallel_lookup);
@@ -1923,7 +1607,7 @@ process_consume_abe_key (void *cls, uint32_t rd_count,
1923 handle->parallel_lookups_tail, 1607 handle->parallel_lookups_tail,
1924 parallel_lookup); 1608 parallel_lookup);
1925 } 1609 }
1926 GNUNET_free (scopes); 1610 GNUNET_free (lbls);
1927 GNUNET_free (buf); 1611 GNUNET_free (buf);
1928 handle->kill_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES,3), 1612 handle->kill_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES,3),
1929 &abort_parallel_lookups2, 1613 &abort_parallel_lookups2,
@@ -1956,9 +1640,9 @@ handle_consume_ticket_message (void *cls,
1956 = GNUNET_GNS_lookup (gns_handle, 1640 = GNUNET_GNS_lookup (gns_handle,
1957 rnd_label, 1641 rnd_label,
1958 &ch->ticket.identity, 1642 &ch->ticket.identity,
1959 GNUNET_GNSRECORD_TYPE_ABE_KEY, 1643 GNUNET_GNSRECORD_TYPE_RECLAIM_AUTHZ,
1960 GNUNET_GNS_LO_DEFAULT, 1644 GNUNET_GNS_LO_DEFAULT,
1961 &process_consume_abe_key, 1645 &process_attr_labels,
1962 ch); 1646 ch);
1963 GNUNET_CONTAINER_DLL_insert (idp->consume_op_head, 1647 GNUNET_CONTAINER_DLL_insert (idp->consume_op_head,
1964 idp->consume_op_tail, 1648 idp->consume_op_tail,
@@ -1973,15 +1657,13 @@ handle_consume_ticket_message (void *cls,
1973 * @param handle handle to clean up 1657 * @param handle handle to clean up
1974 */ 1658 */
1975static void 1659static void
1976cleanup_as_handle (struct AttributeStoreHandle *handle) 1660cleanup_as_handle (struct AttributeStoreHandle *ash)
1977{ 1661{
1978 if (NULL != handle->ns_qe) 1662 if (NULL != ash->ns_qe)
1979 GNUNET_NAMESTORE_cancel (handle->ns_qe); 1663 GNUNET_NAMESTORE_cancel (ash->ns_qe);
1980 if (NULL != handle->claim) 1664 if (NULL != ash->claim)
1981 GNUNET_free (handle->claim); 1665 GNUNET_free (ash->claim);
1982 if (NULL != handle->abe_key) 1666 GNUNET_free (ash);
1983 GNUNET_ABE_cpabe_delete_master_key (handle->abe_key);
1984 GNUNET_free (handle);
1985} 1667}
1986 1668
1987static void 1669static void
@@ -1989,21 +1671,21 @@ attr_store_cont (void *cls,
1989 int32_t success, 1671 int32_t success,
1990 const char *emsg) 1672 const char *emsg)
1991{ 1673{
1992 struct AttributeStoreHandle *as_handle = cls; 1674 struct AttributeStoreHandle *ash = cls;
1993 struct GNUNET_MQ_Envelope *env; 1675 struct GNUNET_MQ_Envelope *env;
1994 struct AttributeStoreResultMessage *acr_msg; 1676 struct AttributeStoreResultMessage *acr_msg;
1995 1677
1996 as_handle->ns_qe = NULL; 1678 ash->ns_qe = NULL;
1997 GNUNET_CONTAINER_DLL_remove (as_handle->client->store_op_head, 1679 GNUNET_CONTAINER_DLL_remove (ash->client->store_op_head,
1998 as_handle->client->store_op_tail, 1680 ash->client->store_op_tail,
1999 as_handle); 1681 ash);
2000 1682
2001 if (GNUNET_SYSERR == success) 1683 if (GNUNET_SYSERR == success)
2002 { 1684 {
2003 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1685 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
2004 "Failed to store attribute %s\n", 1686 "Failed to store attribute %s\n",
2005 emsg); 1687 emsg);
2006 cleanup_as_handle (as_handle); 1688 cleanup_as_handle (ash);
2007 GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); 1689 GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
2008 return; 1690 return;
2009 } 1691 }
@@ -2012,101 +1694,57 @@ attr_store_cont (void *cls,
2012 "Sending ATTRIBUTE_STORE_RESPONSE message\n"); 1694 "Sending ATTRIBUTE_STORE_RESPONSE message\n");
2013 env = GNUNET_MQ_msg (acr_msg, 1695 env = GNUNET_MQ_msg (acr_msg,
2014 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE_RESPONSE); 1696 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE_RESPONSE);
2015 acr_msg->id = htonl (as_handle->r_id); 1697 acr_msg->id = htonl (ash->r_id);
2016 acr_msg->op_result = htonl (GNUNET_OK); 1698 acr_msg->op_result = htonl (GNUNET_OK);
2017 GNUNET_MQ_send (as_handle->client->mq, 1699 GNUNET_MQ_send (ash->client->mq,
2018 env); 1700 env);
2019 cleanup_as_handle (as_handle); 1701 cleanup_as_handle (ash);
2020} 1702}
2021 1703
1704/**
1705 * Adds a new attribute
1706 *
1707 * @param cls the AttributeStoreHandle
1708 */
2022static void 1709static void
2023attr_store_task (void *cls) 1710attr_store_task (void *cls)
2024{ 1711{
2025 struct AttributeStoreHandle *as_handle = cls; 1712 struct AttributeStoreHandle *ash = cls;
2026 struct GNUNET_GNSRECORD_Data rd[1]; 1713 struct GNUNET_GNSRECORD_Data rd[1];
2027 char* buf; 1714 char* buf;
2028 char* policy; 1715 char* label;
2029 char* enc_buf;
2030 char* rd_buf;
2031 size_t enc_size;
2032 size_t buf_size; 1716 size_t buf_size;
2033 uint32_t attr_ver;
2034 1717
2035 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1718 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2036 "Storing attribute\n"); 1719 "Storing attribute\n");
2037 buf_size = GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (as_handle->claim); 1720 buf_size = GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (ash->claim);
2038 buf = GNUNET_malloc (buf_size); 1721 buf = GNUNET_malloc (buf_size);
2039 1722 //Give the ash a new id
2040 GNUNET_RECLAIM_ATTRIBUTE_serialize (as_handle->claim, 1723 ash->claim->id = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG,
1724 UINT64_MAX);
1725 GNUNET_RECLAIM_ATTRIBUTE_serialize (ash->claim,
2041 buf); 1726 buf);
2042 1727 label = GNUNET_STRINGS_data_to_string_alloc (&ash->claim->id,
2043 GNUNET_asprintf (&policy, 1728 sizeof (uint64_t));
2044 "%s_%lu",
2045 as_handle->claim->name,
2046 as_handle->claim->version);
2047 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1729 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2048 "Encrypting with policy %s\n", policy); 1730 "Encrypting with label %s\n", label);
2049 /** 1731
2050 * Encrypt the attribute value and store in namestore 1732 rd[0].data_size = buf_size;
2051 */ 1733 rd[0].data = buf;
2052 enc_size = GNUNET_ABE_cpabe_encrypt (buf, 1734 rd[0].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR;
2053 buf_size,
2054 policy, //Policy
2055 as_handle->abe_key,
2056 (void**)&enc_buf);
2057 if (GNUNET_SYSERR == enc_size)
2058 {
2059 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
2060 "Failed to encrypt with policy %s\n",
2061 policy);
2062 GNUNET_CONTAINER_DLL_remove (as_handle->client->store_op_head,
2063 as_handle->client->store_op_tail,
2064 as_handle);
2065
2066 cleanup_as_handle (as_handle);
2067 GNUNET_free (buf);
2068 GNUNET_free (policy);
2069 GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
2070 return;
2071 }
2072 GNUNET_free (buf);
2073 GNUNET_free (policy);
2074 rd[0].data_size = enc_size + sizeof (uint32_t);
2075 rd_buf = GNUNET_malloc (rd[0].data_size);
2076 attr_ver = htonl (as_handle->claim->version);
2077 GNUNET_memcpy (rd_buf,
2078 &attr_ver,
2079 sizeof (uint32_t));
2080 GNUNET_memcpy (rd_buf+sizeof (uint32_t),
2081 enc_buf,
2082 enc_size);
2083 rd[0].data = rd_buf;
2084 rd[0].record_type = GNUNET_GNSRECORD_TYPE_ID_ATTR;
2085 rd[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; 1735 rd[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
2086 rd[0].expiration_time = as_handle->exp.rel_value_us; 1736 rd[0].expiration_time = ash->exp.rel_value_us;
2087 as_handle->ns_qe = GNUNET_NAMESTORE_records_store (ns_handle, 1737 ash->ns_qe = GNUNET_NAMESTORE_records_store (nsh,
2088 &as_handle->identity, 1738 &ash->identity,
2089 as_handle->claim->name, 1739 label,
2090 1, 1740 1,
2091 rd, 1741 rd,
2092 &attr_store_cont, 1742 &attr_store_cont,
2093 as_handle); 1743 ash);
2094 GNUNET_free (enc_buf); 1744 GNUNET_free (buf);
2095 GNUNET_free (rd_buf);
2096} 1745}
2097 1746
2098 1747
2099static void
2100store_after_abe_bootstrap (void *cls,
2101 struct GNUNET_ABE_AbeMasterKey *abe_key)
2102{
2103 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2104 "Finished ABE bootstrap\n");
2105 struct AttributeStoreHandle *ash = cls;
2106 ash->abe_key = abe_key;
2107 GNUNET_SCHEDULER_add_now (&attr_store_task, ash);
2108}
2109
2110static int 1748static int
2111check_attribute_store_message(void *cls, 1749check_attribute_store_message(void *cls,
2112 const struct AttributeStoreMessage *sam) 1750 const struct AttributeStoreMessage *sam)
@@ -2127,7 +1765,7 @@ static void
2127handle_attribute_store_message (void *cls, 1765handle_attribute_store_message (void *cls,
2128 const struct AttributeStoreMessage *sam) 1766 const struct AttributeStoreMessage *sam)
2129{ 1767{
2130 struct AttributeStoreHandle *as_handle; 1768 struct AttributeStoreHandle *ash;
2131 struct IdpClient *idp = cls; 1769 struct IdpClient *idp = cls;
2132 size_t data_len; 1770 size_t data_len;
2133 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1771 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -2135,29 +1773,27 @@ handle_attribute_store_message (void *cls,
2135 1773
2136 data_len = ntohs (sam->attr_len); 1774 data_len = ntohs (sam->attr_len);
2137 1775
2138 as_handle = GNUNET_new (struct AttributeStoreHandle); 1776 ash = GNUNET_new (struct AttributeStoreHandle);
2139 as_handle->claim = GNUNET_RECLAIM_ATTRIBUTE_deserialize ((char*)&sam[1], 1777 ash->claim = GNUNET_RECLAIM_ATTRIBUTE_deserialize ((char*)&sam[1],
2140 data_len); 1778 data_len);
2141 1779
2142 as_handle->r_id = ntohl (sam->id); 1780 ash->r_id = ntohl (sam->id);
2143 as_handle->identity = sam->identity; 1781 ash->identity = sam->identity;
2144 as_handle->exp.rel_value_us = GNUNET_ntohll (sam->exp); 1782 ash->exp.rel_value_us = GNUNET_ntohll (sam->exp);
2145 GNUNET_CRYPTO_ecdsa_key_get_public (&sam->identity, 1783 GNUNET_CRYPTO_ecdsa_key_get_public (&sam->identity,
2146 &as_handle->identity_pkey); 1784 &ash->identity_pkey);
2147 1785
2148 GNUNET_SERVICE_client_continue (idp->client); 1786 GNUNET_SERVICE_client_continue (idp->client);
2149 as_handle->client = idp; 1787 ash->client = idp;
2150 GNUNET_CONTAINER_DLL_insert (idp->store_op_head, 1788 GNUNET_CONTAINER_DLL_insert (idp->store_op_head,
2151 idp->store_op_tail, 1789 idp->store_op_tail,
2152 as_handle); 1790 ash);
2153 bootstrap_abe (&as_handle->identity, &store_after_abe_bootstrap, as_handle, GNUNET_NO); 1791 GNUNET_SCHEDULER_add_now (&attr_store_task, ash);
2154} 1792}
2155 1793
2156static void 1794static void
2157cleanup_attribute_iter_handle (struct AttributeIterator *ai) 1795cleanup_attribute_iter_handle (struct AttributeIterator *ai)
2158{ 1796{
2159 if (NULL != ai->abe_key)
2160 GNUNET_ABE_cpabe_delete_master_key (ai->abe_key);
2161 GNUNET_free (ai); 1797 GNUNET_free (ai);
2162} 1798}
2163 1799
@@ -2165,7 +1801,6 @@ static void
2165attr_iter_error (void *cls) 1801attr_iter_error (void *cls)
2166{ 1802{
2167 struct AttributeIterator *ai = cls; 1803 struct AttributeIterator *ai = cls;
2168 //TODO
2169 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1804 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
2170 "Failed to iterate over attributes\n"); 1805 "Failed to iterate over attributes\n");
2171 GNUNET_CONTAINER_DLL_remove (ai->client->attr_iter_head, 1806 GNUNET_CONTAINER_DLL_remove (ai->client->attr_iter_head,
@@ -2202,14 +1837,8 @@ attr_iter_cb (void *cls,
2202{ 1837{
2203 struct AttributeIterator *ai = cls; 1838 struct AttributeIterator *ai = cls;
2204 struct AttributeResultMessage *arm; 1839 struct AttributeResultMessage *arm;
2205 struct GNUNET_ABE_AbeKey *key;
2206 struct GNUNET_MQ_Envelope *env; 1840 struct GNUNET_MQ_Envelope *env;
2207 ssize_t msg_extra_len;
2208 char* attr_ser;
2209 char* attrs[2];
2210 char* data_tmp; 1841 char* data_tmp;
2211 char* policy;
2212 uint32_t attr_ver;
2213 1842
2214 if (rd_count != 1) 1843 if (rd_count != 1)
2215 { 1844 {
@@ -2218,82 +1847,29 @@ attr_iter_cb (void *cls,
2218 return; 1847 return;
2219 } 1848 }
2220 1849
2221 if (GNUNET_GNSRECORD_TYPE_ID_ATTR != rd->record_type) 1850 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR != rd->record_type)
2222 {
2223 GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it,
2224 1);
2225 return;
2226 }
2227 attr_ver = ntohl(*((uint32_t*)rd->data));
2228 GNUNET_asprintf (&policy, "%s_%lu",
2229 label, attr_ver);
2230 attrs[0] = policy;
2231 attrs[1] = 0;
2232 key = GNUNET_ABE_cpabe_create_key (ai->abe_key,
2233 attrs);
2234 msg_extra_len = GNUNET_ABE_cpabe_decrypt (rd->data+sizeof (uint32_t),
2235 rd->data_size-sizeof (uint32_t),
2236 key,
2237 (void**)&attr_ser);
2238 if (GNUNET_SYSERR == msg_extra_len)
2239 { 1851 {
2240 GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1852 GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it,
2241 1); 1853 1);
2242 return; 1854 return;
2243 } 1855 }
2244
2245 GNUNET_ABE_cpabe_delete_key (key,
2246 GNUNET_YES);
2247 //GNUNET_free (policy);
2248 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1856 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2249 "Found attribute: %s\n", label); 1857 "Found attribute under: %s\n", label);
2250 env = GNUNET_MQ_msg_extra (arm, 1858 env = GNUNET_MQ_msg_extra (arm,
2251 msg_extra_len, 1859 rd->data_size,
2252 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT); 1860 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT);
2253 arm->id = htonl (ai->request_id); 1861 arm->id = htonl (ai->request_id);
2254 arm->attr_len = htons (msg_extra_len); 1862 arm->attr_len = htons (rd->data_size);
2255 GNUNET_CRYPTO_ecdsa_key_get_public (zone, 1863 GNUNET_CRYPTO_ecdsa_key_get_public (zone,
2256 &arm->identity); 1864 &arm->identity);
2257 data_tmp = (char *) &arm[1]; 1865 data_tmp = (char *) &arm[1];
2258 GNUNET_memcpy (data_tmp, 1866 GNUNET_memcpy (data_tmp,
2259 attr_ser, 1867 rd->data,
2260 msg_extra_len); 1868 rd->data_size);
2261 GNUNET_MQ_send (ai->client->mq, env); 1869 GNUNET_MQ_send (ai->client->mq, env);
2262 GNUNET_free (attr_ser);
2263 GNUNET_ABE_cpabe_delete_master_key (ai->abe_key);
2264 ai->abe_key = NULL;
2265}
2266
2267
2268void
2269iterate_after_abe_bootstrap (void *cls,
2270 struct GNUNET_ABE_AbeMasterKey *abe_key)
2271{
2272 struct AttributeIterator *ai = cls;
2273 ai->abe_key = abe_key;
2274 ai->ns_it = GNUNET_NAMESTORE_zone_iteration_start (ns_handle,
2275 &ai->identity,
2276 &attr_iter_error,
2277 ai,
2278 &attr_iter_cb,
2279 ai,
2280 &attr_iter_finished,
2281 ai);
2282}
2283
2284
2285static void
2286iterate_next_after_abe_bootstrap (void *cls,
2287 struct GNUNET_ABE_AbeMasterKey *abe_key)
2288{
2289 struct AttributeIterator *ai = cls;
2290 ai->abe_key = abe_key;
2291 GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it,
2292 1);
2293} 1870}
2294 1871
2295 1872
2296
2297static void 1873static void
2298handle_iteration_start (void *cls, 1874handle_iteration_start (void *cls,
2299 const struct AttributeIterationStartMessage *ais_msg) 1875 const struct AttributeIterationStartMessage *ais_msg)
@@ -2311,7 +1887,14 @@ handle_iteration_start (void *cls,
2311 GNUNET_CONTAINER_DLL_insert (idp->attr_iter_head, 1887 GNUNET_CONTAINER_DLL_insert (idp->attr_iter_head,
2312 idp->attr_iter_tail, 1888 idp->attr_iter_tail,
2313 ai); 1889 ai);
2314 bootstrap_abe (&ai->identity, &iterate_after_abe_bootstrap, ai, GNUNET_NO); 1890 ai->ns_it = GNUNET_NAMESTORE_zone_iteration_start (nsh,
1891 &ai->identity,
1892 &attr_iter_error,
1893 ai,
1894 &attr_iter_cb,
1895 ai,
1896 &attr_iter_finished,
1897 ai);
2315 GNUNET_SERVICE_client_continue (idp->client); 1898 GNUNET_SERVICE_client_continue (idp->client);
2316} 1899}
2317 1900
@@ -2365,10 +1948,8 @@ handle_iteration_next (void *cls,
2365 GNUNET_SERVICE_client_drop (idp->client); 1948 GNUNET_SERVICE_client_drop (idp->client);
2366 return; 1949 return;
2367 } 1950 }
2368 bootstrap_abe (&ai->identity, 1951 GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it,
2369 &iterate_next_after_abe_bootstrap, 1952 1);
2370 ai,
2371 GNUNET_NO);
2372 GNUNET_SERVICE_client_continue (idp->client); 1953 GNUNET_SERVICE_client_continue (idp->client);
2373} 1954}
2374 1955
@@ -2586,7 +2167,7 @@ handle_ticket_iteration_next (void *cls,
2586 * Main function that will be run 2167 * Main function that will be run
2587 * 2168 *
2588 * @param cls closure 2169 * @param cls closure
2589 * @param c the configuration used 2170 * @param c the configuration used
2590 * @param server the service handle 2171 * @param server the service handle
2591 */ 2172 */
2592static void 2173static void
@@ -2600,8 +2181,8 @@ run (void *cls,
2600 stats = GNUNET_STATISTICS_create ("reclaim", cfg); 2181 stats = GNUNET_STATISTICS_create ("reclaim", cfg);
2601 2182
2602 //Connect to identity and namestore services 2183 //Connect to identity and namestore services
2603 ns_handle = GNUNET_NAMESTORE_connect (cfg); 2184 nsh = GNUNET_NAMESTORE_connect (cfg);
2604 if (NULL == ns_handle) 2185 if (NULL == nsh)
2605 { 2186 {
2606 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "error connecting to namestore"); 2187 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "error connecting to namestore");
2607 } 2188 }
@@ -2771,15 +2352,15 @@ GNUNET_SERVICE_MAIN
2771 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE, 2352 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE,
2772 struct AttributeStoreMessage, 2353 struct AttributeStoreMessage,
2773 NULL), 2354 NULL),
2774 GNUNET_MQ_hd_fixed_size (iteration_start, 2355 GNUNET_MQ_hd_fixed_size (iteration_start,
2775 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START, 2356 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START,
2776 struct AttributeIterationStartMessage, 2357 struct AttributeIterationStartMessage,
2777 NULL), 2358 NULL),
2778 GNUNET_MQ_hd_fixed_size (iteration_next, 2359 GNUNET_MQ_hd_fixed_size (iteration_next,
2779 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT, 2360 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT,
2780 struct AttributeIterationNextMessage, 2361 struct AttributeIterationNextMessage,
2781 NULL), 2362 NULL),
2782 GNUNET_MQ_hd_fixed_size (iteration_stop, 2363 GNUNET_MQ_hd_fixed_size (iteration_stop,
2783 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP, 2364 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP,
2784 struct AttributeIterationStopMessage, 2365 struct AttributeIterationStopMessage,
2785 NULL), 2366 NULL),
@@ -2791,15 +2372,15 @@ GNUNET_SERVICE_MAIN
2791 GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET, 2372 GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET,
2792 struct ConsumeTicketMessage, 2373 struct ConsumeTicketMessage,
2793 NULL), 2374 NULL),
2794 GNUNET_MQ_hd_fixed_size (ticket_iteration_start, 2375 GNUNET_MQ_hd_fixed_size (ticket_iteration_start,
2795 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START, 2376 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START,
2796 struct TicketIterationStartMessage, 2377 struct TicketIterationStartMessage,
2797 NULL), 2378 NULL),
2798 GNUNET_MQ_hd_fixed_size (ticket_iteration_next, 2379 GNUNET_MQ_hd_fixed_size (ticket_iteration_next,
2799 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_NEXT, 2380 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_NEXT,
2800 struct TicketIterationNextMessage, 2381 struct TicketIterationNextMessage,
2801 NULL), 2382 NULL),
2802 GNUNET_MQ_hd_fixed_size (ticket_iteration_stop, 2383 GNUNET_MQ_hd_fixed_size (ticket_iteration_stop,
2803 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP, 2384 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP,
2804 struct TicketIterationStopMessage, 2385 struct TicketIterationStopMessage,
2805 NULL), 2386 NULL),
diff --git a/src/reclaim/plugin_gnsrecord_reclaim.c b/src/reclaim/plugin_gnsrecord_reclaim.c
index 9be0e7632..d4d937f7e 100644
--- a/src/reclaim/plugin_gnsrecord_reclaim.c
+++ b/src/reclaim/plugin_gnsrecord_reclaim.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
@@ -44,39 +44,16 @@ value_to_string (void *cls,
44 const void *data, 44 const void *data,
45 size_t data_size) 45 size_t data_size)
46{ 46{
47 const struct GNUNET_CRYPTO_EcdhePrivateKey *ecdhe_privkey;
48 const struct GNUNET_CRYPTO_EcdsaPublicKey *audience_pubkey;
49 const char *scopes;
50 char *ecdhe_str;
51 char *aud_str;
52 char *result;
53
54 switch (type) 47 switch (type)
55 { 48 {
56 case GNUNET_GNSRECORD_TYPE_ID_ATTR: 49 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR:
57 return GNUNET_STRINGS_data_to_string_alloc (data, data_size); 50 return GNUNET_STRINGS_data_to_string_alloc (data, data_size);
58 case GNUNET_GNSRECORD_TYPE_ID_TOKEN: //DEPRECATED
59 case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT: 51 case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT:
60 case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT: 52 case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT:
61 return GNUNET_strndup (data, data_size); 53 return GNUNET_strndup (data, data_size);
62 case GNUNET_GNSRECORD_TYPE_ABE_KEY: 54 case GNUNET_GNSRECORD_TYPE_RECLAIM_AUTHZ:
63 case GNUNET_GNSRECORD_TYPE_ABE_MASTER: 55 case GNUNET_GNSRECORD_TYPE_RECLAIM_MASTER:
64 return GNUNET_STRINGS_data_to_string_alloc (data, data_size); 56 return GNUNET_STRINGS_data_to_string_alloc (data, data_size);
65 case GNUNET_GNSRECORD_TYPE_ID_TOKEN_METADATA: //DEPRECATED
66 ecdhe_privkey = data;
67 audience_pubkey = data+sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey);
68 scopes = (char*) audience_pubkey+(sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
69 ecdhe_str = GNUNET_STRINGS_data_to_string_alloc (ecdhe_privkey,
70 sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey));
71 aud_str = GNUNET_STRINGS_data_to_string_alloc (audience_pubkey,
72 sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
73 GNUNET_asprintf (&result,
74 "%s;%s;%s",
75 ecdhe_str, aud_str, scopes);
76 GNUNET_free (aud_str);
77 GNUNET_free (ecdhe_str);
78 return result;
79
80 default: 57 default:
81 return NULL; 58 return NULL;
82 } 59 }
@@ -101,73 +78,26 @@ string_to_value (void *cls,
101 void **data, 78 void **data,
102 size_t *data_size) 79 size_t *data_size)
103{ 80{
104 char* ecdhe_str;
105 char* aud_keystr;
106 char* write_ptr;
107 char* tmp_tok;
108 char* str;
109
110 if (NULL == s) 81 if (NULL == s)
111 return GNUNET_SYSERR; 82 return GNUNET_SYSERR;
112 switch (type) 83 switch (type)
113 { 84 {
114 case GNUNET_GNSRECORD_TYPE_ID_ATTR: 85 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR:
115 return GNUNET_STRINGS_string_to_data (s, 86 return GNUNET_STRINGS_string_to_data (s,
116 strlen (s), 87 strlen (s),
117 *data, 88 *data,
118 *data_size); 89 *data_size);
119 case GNUNET_GNSRECORD_TYPE_ID_TOKEN:
120 case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT: 90 case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT:
121 case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT: 91 case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT:
122 *data = GNUNET_strdup (s); 92 *data = GNUNET_strdup (s);
123 *data_size = strlen (s); 93 *data_size = strlen (s);
124 return GNUNET_OK; 94 return GNUNET_OK;
125 case GNUNET_GNSRECORD_TYPE_ABE_KEY: 95 case GNUNET_GNSRECORD_TYPE_RECLAIM_AUTHZ:
126 case GNUNET_GNSRECORD_TYPE_ABE_MASTER: 96 case GNUNET_GNSRECORD_TYPE_RECLAIM_MASTER:
127 return GNUNET_STRINGS_string_to_data (s, 97 return GNUNET_STRINGS_string_to_data (s,
128 strlen (s), 98 strlen (s),
129 *data, 99 *data,
130 *data_size); 100 *data_size);
131 case GNUNET_GNSRECORD_TYPE_ID_TOKEN_METADATA:
132 tmp_tok = GNUNET_strdup (s);
133 ecdhe_str = strtok (tmp_tok, ";");
134 if (NULL == ecdhe_str)
135 {
136 GNUNET_free (tmp_tok);
137 return GNUNET_SYSERR;
138 }
139 aud_keystr = strtok (NULL, ";");
140 if (NULL == aud_keystr)
141 {
142 GNUNET_free (tmp_tok);
143 return GNUNET_SYSERR;
144 }
145 str = strtok (NULL, ";");
146 if (NULL == str)
147 {
148 GNUNET_free (tmp_tok);
149 return GNUNET_SYSERR;
150 }
151 *data_size = strlen (str) + 1
152 +sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey)
153 +sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey);
154 *data = GNUNET_malloc (*data_size);
155
156 write_ptr = *data;
157 GNUNET_STRINGS_string_to_data (ecdhe_str,
158 strlen (ecdhe_str),
159 write_ptr,
160 sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey));
161 write_ptr += sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey);
162 GNUNET_STRINGS_string_to_data (aud_keystr,
163 strlen (aud_keystr),
164 write_ptr,
165 sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
166 write_ptr += sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey);
167 GNUNET_memcpy (write_ptr, str, strlen (str) + 1); //with 0-Terminator
168 GNUNET_free (tmp_tok);
169 return GNUNET_OK;
170
171 default: 101 default:
172 return GNUNET_SYSERR; 102 return GNUNET_SYSERR;
173 } 103 }
@@ -182,11 +112,9 @@ static struct {
182 const char *name; 112 const char *name;
183 uint32_t number; 113 uint32_t number;
184} name_map[] = { 114} name_map[] = {
185 { "ID_ATTR", GNUNET_GNSRECORD_TYPE_ID_ATTR }, 115 { "RECLAIM_ATTR", GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR },
186 { "ID_TOKEN", GNUNET_GNSRECORD_TYPE_ID_TOKEN }, 116 { "RECLAIM_AUTHZ", GNUNET_GNSRECORD_TYPE_RECLAIM_AUTHZ },
187 { "ABE_KEY", GNUNET_GNSRECORD_TYPE_ABE_KEY }, 117 { "RECLAIM_MASTER", GNUNET_GNSRECORD_TYPE_RECLAIM_MASTER },
188 { "ABE_MASTER", GNUNET_GNSRECORD_TYPE_ABE_MASTER },
189 { "ID_TOKEN_METADATA", GNUNET_GNSRECORD_TYPE_ID_TOKEN_METADATA },
190 { "RECLAIM_OIDC_CLIENT", GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT }, 118 { "RECLAIM_OIDC_CLIENT", GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT },
191 { "RECLAIM_OIDC_REDIRECT", GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT }, 119 { "RECLAIM_OIDC_REDIRECT", GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT },
192 { NULL, UINT32_MAX } 120 { NULL, UINT32_MAX }