diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2020-08-19 19:05:23 +0200 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2020-08-20 17:59:01 +0200 |
commit | e75869506cc08e08056168383bd4ab02e1f007de (patch) | |
tree | b4617425e38fbd7070f6a6d7cd41544a7f41df5d | |
parent | 1ca1140d4602dcc5c66da0d1ab1b082db9258ead (diff) | |
download | gnunet-e75869506cc08e08056168383bd4ab02e1f007de.tar.gz gnunet-e75869506cc08e08056168383bd4ab02e1f007de.zip |
- towards separation between credentials and presentations thereof, wip, ftbfs
22 files changed, 1402 insertions, 1049 deletions
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h index 4526b75d9..d9821ffe8 100644 --- a/src/include/gnunet_protocols.h +++ b/src/include/gnunet_protocols.h | |||
@@ -2900,17 +2900,17 @@ extern "C" { | |||
2900 | 2900 | ||
2901 | #define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE 976 | 2901 | #define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE 976 |
2902 | 2902 | ||
2903 | #define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_STORE 977 | 2903 | #define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_STORE 977 |
2904 | 2904 | ||
2905 | #define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_DELETE 978 | 2905 | #define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_DELETE 978 |
2906 | 2906 | ||
2907 | #define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT 979 | 2907 | #define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_RESULT 979 |
2908 | 2908 | ||
2909 | #define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_START 980 | 2909 | #define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_START 980 |
2910 | 2910 | ||
2911 | #define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_STOP 981 | 2911 | #define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_STOP 981 |
2912 | 2912 | ||
2913 | #define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_NEXT 982 | 2913 | #define GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_NEXT 982 |
2914 | 2914 | ||
2915 | 2915 | ||
2916 | /************************************************** | 2916 | /************************************************** |
diff --git a/src/include/gnunet_reclaim_lib.h b/src/include/gnunet_reclaim_lib.h index 7d521ffa8..f5c3d3864 100644 --- a/src/include/gnunet_reclaim_lib.h +++ b/src/include/gnunet_reclaim_lib.h | |||
@@ -39,26 +39,34 @@ extern "C" { | |||
39 | 39 | ||
40 | #include "gnunet_util_lib.h" | 40 | #include "gnunet_util_lib.h" |
41 | 41 | ||
42 | enum GNUNET_RECLAIM_AttributeType { | ||
43 | /** | ||
44 | * No value attribute. | ||
45 | */ | ||
46 | GNUNET_RECLAIM_ATTRIBUTE_TYPE_NONE = 0, | ||
42 | 47 | ||
43 | /** | 48 | /** |
44 | * No value attribute. | 49 | * String attribute. |
45 | */ | 50 | */ |
46 | #define GNUNET_RECLAIM_ATTRIBUTE_TYPE_NONE 0 | 51 | GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING = 1 |
52 | }; | ||
47 | 53 | ||
48 | /** | 54 | enum GNUNET_RECLAIM_CredentialType { |
49 | * String attribute. | 55 | /** |
50 | */ | 56 | * No value credential. |
51 | #define GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING 1 | 57 | */ |
58 | GNUNET_RECLAIM_CREDENTIAL_TYPE_NONE = 0, | ||
52 | 59 | ||
53 | /** | 60 | /** |
54 | * No value attestation. | 61 | * A JSON Web Token credential. |
55 | */ | 62 | */ |
56 | #define GNUNET_RECLAIM_ATTESTATION_TYPE_NONE 10 | 63 | GNUNET_RECLAIM_CREDENTIAL_TYPE_JWT = 1, |
57 | 64 | ||
58 | /** | 65 | /** |
59 | * A JSON Web Token attestation. | 66 | * libpabc credential |
60 | */ | 67 | */ |
61 | #define GNUNET_RECLAIM_ATTESTATION_TYPE_JWT 11 | 68 | GNUNET_RECLAIM_CREDENTIAL_TYPE_PABC = 2 |
69 | }; | ||
62 | 70 | ||
63 | /** | 71 | /** |
64 | * We want an ID to be a 256-bit symmetric key | 72 | * We want an ID to be a 256-bit symmetric key |
@@ -107,9 +115,10 @@ struct GNUNET_RECLAIM_Attribute | |||
107 | struct GNUNET_RECLAIM_Identifier id; | 115 | struct GNUNET_RECLAIM_Identifier id; |
108 | 116 | ||
109 | /** | 117 | /** |
110 | * Referenced ID of Attestation (may be 0 if self-attested) | 118 | * Referenced ID of credential |
119 | * (may be GNUNET_RECLAIM_ID_ZERO if self-creded) | ||
111 | */ | 120 | */ |
112 | struct GNUNET_RECLAIM_Identifier attestation; | 121 | struct GNUNET_RECLAIM_Identifier credential; |
113 | 122 | ||
114 | /** | 123 | /** |
115 | * Type of Claim | 124 | * Type of Claim |
@@ -141,9 +150,9 @@ struct GNUNET_RECLAIM_Attribute | |||
141 | }; | 150 | }; |
142 | 151 | ||
143 | /** | 152 | /** |
144 | * An attestation. | 153 | * A credential. |
145 | */ | 154 | */ |
146 | struct GNUNET_RECLAIM_Attestation | 155 | struct GNUNET_RECLAIM_Credential |
147 | { | 156 | { |
148 | /** | 157 | /** |
149 | * ID | 158 | * ID |
@@ -161,7 +170,7 @@ struct GNUNET_RECLAIM_Attestation | |||
161 | uint32_t flag; | 170 | uint32_t flag; |
162 | 171 | ||
163 | /** | 172 | /** |
164 | * The name of the attribute. Note "name" must never be individually | 173 | * The name of the credential. Note: must never be individually |
165 | * free'd | 174 | * free'd |
166 | */ | 175 | */ |
167 | const char *name; | 176 | const char *name; |
@@ -172,7 +181,36 @@ struct GNUNET_RECLAIM_Attestation | |||
172 | size_t data_size; | 181 | size_t data_size; |
173 | 182 | ||
174 | /** | 183 | /** |
175 | * Binary value stored as attribute value. Note: "data" must never | 184 | * Binary value stored as credential value. Note: "data" must never |
185 | * be individually 'malloc'ed, but instead always points into some | ||
186 | * existing data area. | ||
187 | */ | ||
188 | const void *data; | ||
189 | }; | ||
190 | |||
191 | |||
192 | /** | ||
193 | * A credential presentation. | ||
194 | */ | ||
195 | struct GNUNET_RECLAIM_Presentation | ||
196 | { | ||
197 | /** | ||
198 | * The credential id of which this is a presentation. | ||
199 | */ | ||
200 | struct GNUNET_RECLAIM_Identifier credential_id; | ||
201 | |||
202 | /** | ||
203 | * Type/Format of Claim | ||
204 | */ | ||
205 | uint32_t type; | ||
206 | |||
207 | /** | ||
208 | * Number of bytes in @e data. | ||
209 | */ | ||
210 | size_t data_size; | ||
211 | |||
212 | /** | ||
213 | * Binary value stored as presentation value. Note: "data" must never | ||
176 | * be individually 'malloc'ed, but instead always points into some | 214 | * be individually 'malloc'ed, but instead always points into some |
177 | * existing data area. | 215 | * existing data area. |
178 | */ | 216 | */ |
@@ -180,6 +218,7 @@ struct GNUNET_RECLAIM_Attestation | |||
180 | }; | 218 | }; |
181 | 219 | ||
182 | 220 | ||
221 | |||
183 | /** | 222 | /** |
184 | * A list of GNUNET_RECLAIM_Attribute structures. | 223 | * A list of GNUNET_RECLAIM_Attribute structures. |
185 | */ | 224 | */ |
@@ -217,56 +256,94 @@ struct GNUNET_RECLAIM_AttributeListEntry | |||
217 | }; | 256 | }; |
218 | 257 | ||
219 | /** | 258 | /** |
220 | * A list of GNUNET_RECLAIM_Attestation structures. | 259 | * A list of GNUNET_RECLAIM_Credential structures. |
221 | */ | 260 | */ |
222 | struct GNUNET_RECLAIM_AttestationList | 261 | struct GNUNET_RECLAIM_CredentialList |
223 | { | 262 | { |
224 | /** | 263 | /** |
225 | * List head | 264 | * List head |
226 | */ | 265 | */ |
227 | struct GNUNET_RECLAIM_AttestationListEntry *list_head; | 266 | struct GNUNET_RECLAIM_CredentialListEntry *list_head; |
228 | 267 | ||
229 | /** | 268 | /** |
230 | * List tail | 269 | * List tail |
231 | */ | 270 | */ |
232 | struct GNUNET_RECLAIM_AttestationListEntry *list_tail; | 271 | struct GNUNET_RECLAIM_CredentialListEntry *list_tail; |
233 | }; | 272 | }; |
234 | 273 | ||
235 | 274 | ||
236 | struct GNUNET_RECLAIM_AttestationListEntry | 275 | struct GNUNET_RECLAIM_CredentialListEntry |
237 | { | 276 | { |
238 | /** | 277 | /** |
239 | * DLL | 278 | * DLL |
240 | */ | 279 | */ |
241 | struct GNUNET_RECLAIM_AttestationListEntry *prev; | 280 | struct GNUNET_RECLAIM_CredentialListEntry *prev; |
242 | 281 | ||
243 | /** | 282 | /** |
244 | * DLL | 283 | * DLL |
245 | */ | 284 | */ |
246 | struct GNUNET_RECLAIM_AttestationListEntry *next; | 285 | struct GNUNET_RECLAIM_CredentialListEntry *next; |
247 | 286 | ||
248 | /** | 287 | /** |
249 | * The attestation | 288 | * The credential |
250 | */ | 289 | */ |
251 | struct GNUNET_RECLAIM_Attestation *attestation; | 290 | struct GNUNET_RECLAIM_Credential *credential; |
252 | 291 | ||
253 | }; | 292 | }; |
254 | 293 | ||
255 | 294 | ||
256 | /** | 295 | /** |
296 | * A list of GNUNET_RECLAIM_Presentation structures. | ||
297 | */ | ||
298 | struct GNUNET_RECLAIM_PresentationList | ||
299 | { | ||
300 | /** | ||
301 | * List head | ||
302 | */ | ||
303 | struct GNUNET_RECLAIM_PresentationListEntry *list_head; | ||
304 | |||
305 | /** | ||
306 | * List tail | ||
307 | */ | ||
308 | struct GNUNET_RECLAIM_PresentationListEntry *list_tail; | ||
309 | }; | ||
310 | |||
311 | |||
312 | struct GNUNET_RECLAIM_PresentationListEntry | ||
313 | { | ||
314 | /** | ||
315 | * DLL | ||
316 | */ | ||
317 | struct GNUNET_RECLAIM_PresentationListEntry *prev; | ||
318 | |||
319 | /** | ||
320 | * DLL | ||
321 | */ | ||
322 | struct GNUNET_RECLAIM_PresentationListEntry *next; | ||
323 | |||
324 | /** | ||
325 | * The credential | ||
326 | */ | ||
327 | struct GNUNET_RECLAIM_Presentation *presentation; | ||
328 | |||
329 | }; | ||
330 | |||
331 | |||
332 | |||
333 | /** | ||
257 | * Create a new attribute claim. | 334 | * Create a new attribute claim. |
258 | * | 335 | * |
259 | * @param attr_name the attribute name | 336 | * @param attr_name the attribute name |
260 | * @param attestation ID of the attestation (may be NULL) | 337 | * @param credential ID of the credential (may be NULL) |
261 | * @param type the attribute type | 338 | * @param type the attribute type |
262 | * @param data the attribute value. Must be the mapped name if attestation not NULL | 339 | * @param data the attribute value. Must be #attr_name if credential not NULL |
263 | * @param data_size the attribute value size | 340 | * @param data_size the attribute value size |
264 | * @return the new attribute | 341 | * @return the new attribute |
265 | */ | 342 | */ |
266 | struct GNUNET_RECLAIM_Attribute * | 343 | struct GNUNET_RECLAIM_Attribute * |
267 | GNUNET_RECLAIM_attribute_new (const char *attr_name, | 344 | GNUNET_RECLAIM_attribute_new (const char *attr_name, |
268 | const struct | 345 | const struct |
269 | GNUNET_RECLAIM_Identifier *attestation, | 346 | GNUNET_RECLAIM_Identifier *credential, |
270 | uint32_t type, | 347 | uint32_t type, |
271 | const void *data, | 348 | const void *data, |
272 | size_t data_size); | 349 | size_t data_size); |
@@ -298,7 +375,7 @@ GNUNET_RECLAIM_attribute_list_destroy ( | |||
298 | * | 375 | * |
299 | * @param attrs the attribute list to add to | 376 | * @param attrs the attribute list to add to |
300 | * @param attr_name the name of the new attribute claim | 377 | * @param attr_name the name of the new attribute claim |
301 | * @param attestation attestation ID (may be NULL) | 378 | * @param credential credential ID (may be NULL) |
302 | * @param type the type of the claim | 379 | * @param type the type of the claim |
303 | * @param data claim payload | 380 | * @param data claim payload |
304 | * @param data_size claim payload size | 381 | * @param data_size claim payload size |
@@ -307,7 +384,7 @@ void | |||
307 | GNUNET_RECLAIM_attribute_list_add ( | 384 | GNUNET_RECLAIM_attribute_list_add ( |
308 | struct GNUNET_RECLAIM_AttributeList *attrs, | 385 | struct GNUNET_RECLAIM_AttributeList *attrs, |
309 | const char *attr_name, | 386 | const char *attr_name, |
310 | const struct GNUNET_RECLAIM_Identifier *attestation, | 387 | const struct GNUNET_RECLAIM_Identifier *credential, |
311 | uint32_t type, | 388 | uint32_t type, |
312 | const void *data, | 389 | const void *data, |
313 | size_t data_size); | 390 | size_t data_size); |
@@ -439,8 +516,8 @@ GNUNET_RECLAIM_attribute_number_to_typename (uint32_t type); | |||
439 | * @return the required buffer size | 516 | * @return the required buffer size |
440 | */ | 517 | */ |
441 | size_t | 518 | size_t |
442 | GNUNET_RECLAIM_attestation_list_serialize_get_size ( | 519 | GNUNET_RECLAIM_credential_list_serialize_get_size ( |
443 | const struct GNUNET_RECLAIM_AttestationList *attestations); | 520 | const struct GNUNET_RECLAIM_CredentialList *credentials); |
444 | 521 | ||
445 | 522 | ||
446 | /** | 523 | /** |
@@ -449,8 +526,8 @@ GNUNET_RECLAIM_attestation_list_serialize_get_size ( | |||
449 | * @param attrs list to destroy | 526 | * @param attrs list to destroy |
450 | */ | 527 | */ |
451 | void | 528 | void |
452 | GNUNET_RECLAIM_attestation_list_destroy ( | 529 | GNUNET_RECLAIM_credential_list_destroy ( |
453 | struct GNUNET_RECLAIM_AttestationList *attestations); | 530 | struct GNUNET_RECLAIM_CredentialList *credentials); |
454 | 531 | ||
455 | 532 | ||
456 | /** | 533 | /** |
@@ -462,8 +539,8 @@ GNUNET_RECLAIM_attestation_list_destroy ( | |||
462 | * @param data_size claim payload size | 539 | * @param data_size claim payload size |
463 | */ | 540 | */ |
464 | void | 541 | void |
465 | GNUNET_RECLAIM_attestation_list_add ( | 542 | GNUNET_RECLAIM_credential_list_add ( |
466 | struct GNUNET_RECLAIM_AttestationList *attrs, | 543 | struct GNUNET_RECLAIM_CredentialList *attrs, |
467 | const char *att_name, | 544 | const char *att_name, |
468 | uint32_t type, | 545 | uint32_t type, |
469 | const void *data, | 546 | const void *data, |
@@ -478,8 +555,8 @@ GNUNET_RECLAIM_attestation_list_add ( | |||
478 | * @return length of serialized data | 555 | * @return length of serialized data |
479 | */ | 556 | */ |
480 | size_t | 557 | size_t |
481 | GNUNET_RECLAIM_attestation_list_serialize ( | 558 | GNUNET_RECLAIM_credential_list_serialize ( |
482 | const struct GNUNET_RECLAIM_AttestationList *attrs, | 559 | const struct GNUNET_RECLAIM_CredentialList *attrs, |
483 | char *result); | 560 | char *result); |
484 | 561 | ||
485 | 562 | ||
@@ -490,75 +567,75 @@ GNUNET_RECLAIM_attestation_list_serialize ( | |||
490 | * @param data_size the length of the serialized data | 567 | * @param data_size the length of the serialized data |
491 | * @return a GNUNET_IDENTITY_PROVIDER_AttributeList, must be free'd by caller | 568 | * @return a GNUNET_IDENTITY_PROVIDER_AttributeList, must be free'd by caller |
492 | */ | 569 | */ |
493 | struct GNUNET_RECLAIM_AttestationList * | 570 | struct GNUNET_RECLAIM_CredentialList * |
494 | GNUNET_RECLAIM_attestation_list_deserialize (const char *data, | 571 | GNUNET_RECLAIM_credential_list_deserialize (const char *data, |
495 | size_t data_size); | 572 | size_t data_size); |
496 | 573 | ||
497 | 574 | ||
498 | /** | 575 | /** |
499 | * @param attestation the attestation to serialize | 576 | * @param credential the credential to serialize |
500 | * @return the required buffer size | 577 | * @return the required buffer size |
501 | */ | 578 | */ |
502 | size_t | 579 | size_t |
503 | GNUNET_RECLAIM_attestation_serialize_get_size ( | 580 | GNUNET_RECLAIM_credential_serialize_get_size ( |
504 | const struct GNUNET_RECLAIM_Attestation *attestation); | 581 | const struct GNUNET_RECLAIM_Credential *credential); |
505 | 582 | ||
506 | 583 | ||
507 | /** | 584 | /** |
508 | * Serialize an attestation | 585 | * Serialize an credential |
509 | * | 586 | * |
510 | * @param attestation the attestation to serialize | 587 | * @param credential the credential to serialize |
511 | * @param result the serialized attestation | 588 | * @param result the serialized credential |
512 | * @return length of serialized data | 589 | * @return length of serialized data |
513 | */ | 590 | */ |
514 | size_t | 591 | size_t |
515 | GNUNET_RECLAIM_attestation_serialize ( | 592 | GNUNET_RECLAIM_credential_serialize ( |
516 | const struct GNUNET_RECLAIM_Attestation *attestation, | 593 | const struct GNUNET_RECLAIM_Credential *credential, |
517 | char *result); | 594 | char *result); |
518 | 595 | ||
519 | 596 | ||
520 | /** | 597 | /** |
521 | * Deserialize an attestation | 598 | * Deserialize an credential |
522 | * | 599 | * |
523 | * @param data the serialized attestation | 600 | * @param data the serialized credential |
524 | * @param data_size the length of the serialized data | 601 | * @param data_size the length of the serialized data |
525 | * | 602 | * |
526 | * @return a GNUNET_IDENTITY_PROVIDER_Attribute, must be free'd by caller | 603 | * @return a GNUNET_IDENTITY_PROVIDER_Attribute, must be free'd by caller |
527 | */ | 604 | */ |
528 | struct GNUNET_RECLAIM_Attestation * | 605 | struct GNUNET_RECLAIM_Credential * |
529 | GNUNET_RECLAIM_attestation_deserialize (const char *data, size_t data_size); | 606 | GNUNET_RECLAIM_credential_deserialize (const char *data, size_t data_size); |
530 | 607 | ||
531 | 608 | ||
532 | /** | 609 | /** |
533 | * Create a new attestation. | 610 | * Create a new credential. |
534 | * | 611 | * |
535 | * @param name the attestation name | 612 | * @param name the credential name |
536 | * @param type the attestation type | 613 | * @param type the credential type |
537 | * @param data the attestation value | 614 | * @param data the credential value |
538 | * @param data_size the attestation value size | 615 | * @param data_size the credential value size |
539 | * @return the new attestation | 616 | * @return the new credential |
540 | */ | 617 | */ |
541 | struct GNUNET_RECLAIM_Attestation * | 618 | struct GNUNET_RECLAIM_Credential * |
542 | GNUNET_RECLAIM_attestation_new (const char *name, | 619 | GNUNET_RECLAIM_credential_new (const char *name, |
543 | uint32_t type, | 620 | uint32_t type, |
544 | const void *data, | 621 | const void *data, |
545 | size_t data_size); | 622 | size_t data_size); |
546 | 623 | ||
547 | /** | 624 | /** |
548 | * Convert the 'claim' of an attestation to a string | 625 | * Convert the 'claim' of an credential to a string |
549 | * | 626 | * |
550 | * @param type the type of attestation | 627 | * @param type the type of credential |
551 | * @param data claim in binary encoding | 628 | * @param data claim in binary encoding |
552 | * @param data_size number of bytes in @a data | 629 | * @param data_size number of bytes in @a data |
553 | * @return NULL on error, otherwise human-readable representation of the claim | 630 | * @return NULL on error, otherwise human-readable representation of the claim |
554 | */ | 631 | */ |
555 | char * | 632 | char * |
556 | GNUNET_RECLAIM_attestation_value_to_string (uint32_t type, | 633 | GNUNET_RECLAIM_credential_value_to_string (uint32_t type, |
557 | const void *data, | 634 | const void *data, |
558 | size_t data_size); | 635 | size_t data_size); |
559 | 636 | ||
560 | /** | 637 | /** |
561 | * Convert human-readable version of a 'claim' of an attestation to the binary | 638 | * Convert human-readable version of a 'claim' of an credential to the binary |
562 | * representation | 639 | * representation |
563 | * | 640 | * |
564 | * @param type type of the claim | 641 | * @param type type of the claim |
@@ -568,48 +645,199 @@ GNUNET_RECLAIM_attestation_value_to_string (uint32_t type, | |||
568 | * @return #GNUNET_OK on success | 645 | * @return #GNUNET_OK on success |
569 | */ | 646 | */ |
570 | int | 647 | int |
571 | GNUNET_RECLAIM_attestation_string_to_value (uint32_t type, | 648 | GNUNET_RECLAIM_credential_string_to_value (uint32_t type, |
572 | const char *s, | 649 | const char *s, |
573 | void **data, | 650 | void **data, |
574 | size_t *data_size); | 651 | size_t *data_size); |
575 | 652 | ||
576 | /** | 653 | /** |
577 | * Convert an attestation type number to the corresponding attestation type string | 654 | * Convert an credential type number to the corresponding credential type string |
578 | * | 655 | * |
579 | * @param type number of a type | 656 | * @param type number of a type |
580 | * @return corresponding typestring, NULL on error | 657 | * @return corresponding typestring, NULL on error |
581 | */ | 658 | */ |
582 | const char * | 659 | const char * |
583 | GNUNET_RECLAIM_attestation_number_to_typename (uint32_t type); | 660 | GNUNET_RECLAIM_credential_number_to_typename (uint32_t type); |
584 | 661 | ||
585 | /** | 662 | /** |
586 | * Convert an attestation type name to the corresponding number | 663 | * Convert an credential type name to the corresponding number |
587 | * | 664 | * |
588 | * @param typename name to convert | 665 | * @param typename name to convert |
589 | * @return corresponding number, UINT32_MAX on error | 666 | * @return corresponding number, UINT32_MAX on error |
590 | */ | 667 | */ |
591 | uint32_t | 668 | uint32_t |
592 | GNUNET_RECLAIM_attestation_typename_to_number (const char *typename); | 669 | GNUNET_RECLAIM_credential_typename_to_number (const char *typename); |
593 | 670 | ||
594 | /** | 671 | /** |
595 | * Convert an attestation type name to the corresponding number | 672 | * Convert an credential type name to the corresponding number |
596 | * | 673 | * |
597 | * @param typename name to convert | 674 | * @param typename name to convert |
598 | * @return corresponding number, UINT32_MAX on error | 675 | * @return corresponding number, UINT32_MAX on error |
599 | */ | 676 | */ |
600 | struct GNUNET_RECLAIM_AttributeList* | 677 | struct GNUNET_RECLAIM_AttributeList* |
601 | GNUNET_RECLAIM_attestation_get_attributes (const struct | 678 | GNUNET_RECLAIM_credential_get_attributes (const struct |
602 | GNUNET_RECLAIM_Attestation *attest); | 679 | GNUNET_RECLAIM_Credential *cred); |
603 | 680 | ||
604 | char* | 681 | char* |
605 | GNUNET_RECLAIM_attestation_get_issuer (const struct | 682 | GNUNET_RECLAIM_credential_get_issuer (const struct |
606 | GNUNET_RECLAIM_Attestation *attest); | 683 | GNUNET_RECLAIM_Credential *cred); |
607 | 684 | ||
608 | int | 685 | int |
609 | GNUNET_RECLAIM_attestation_get_expiration (const struct | 686 | GNUNET_RECLAIM_credential_get_expiration (const struct |
610 | GNUNET_RECLAIM_Attestation *attest, | 687 | GNUNET_RECLAIM_Credential *cred, |
611 | struct GNUNET_TIME_Absolute *exp); | 688 | struct GNUNET_TIME_Absolute *exp); |
612 | 689 | ||
690 | /** | ||
691 | * Get required size for serialization buffer | ||
692 | * | ||
693 | * @param presentations the presentation list to serialize | ||
694 | * @return the required buffer size | ||
695 | */ | ||
696 | size_t | ||
697 | GNUNET_RECLAIM_presentation_list_serialize_get_size ( | ||
698 | const struct GNUNET_RECLAIM_PresentationList *presentations); | ||
699 | |||
700 | |||
701 | /** | ||
702 | * Destroy presentations list | ||
703 | * | ||
704 | * @param presentations list to destroy | ||
705 | */ | ||
706 | void | ||
707 | GNUNET_RECLAIM_presentation_list_destroy ( | ||
708 | struct GNUNET_RECLAIM_PresentationList *presentations); | ||
709 | |||
710 | |||
711 | /** | ||
712 | * Serialize a presentation list | ||
713 | * | ||
714 | * @param presentations the attribute list to serialize | ||
715 | * @param result the serialized list | ||
716 | * @return length of serialized data | ||
717 | */ | ||
718 | size_t | ||
719 | GNUNET_RECLAIM_presentation_list_serialize ( | ||
720 | const struct GNUNET_RECLAIM_PresentationList *presentations, | ||
721 | char *result); | ||
722 | |||
723 | |||
724 | /** | ||
725 | * Deserialize a presentation list | ||
726 | * | ||
727 | * @param data the serialized list | ||
728 | * @param data_size the length of the serialized data | ||
729 | * @return a GNUNET_RECLAIM_PresentationList, must be free'd by caller | ||
730 | */ | ||
731 | struct GNUNET_RECLAIM_PresentationList * | ||
732 | GNUNET_RECLAIM_presentation_list_deserialize (const char *data, | ||
733 | size_t data_size); | ||
734 | |||
735 | |||
736 | /** | ||
737 | * @param presentation the presentation to serialize | ||
738 | * @return the required buffer size | ||
739 | */ | ||
740 | size_t | ||
741 | GNUNET_RECLAIM_presentation_serialize_get_size ( | ||
742 | const struct GNUNET_RECLAIM_Presentation *presentation); | ||
743 | |||
744 | |||
745 | /** | ||
746 | * Serialize a presentation. | ||
747 | * | ||
748 | * @param presentation the presentation to serialize | ||
749 | * @param result the serialized presentation | ||
750 | * @return length of serialized data | ||
751 | */ | ||
752 | size_t | ||
753 | GNUNET_RECLAIM_presentation_serialize ( | ||
754 | const struct GNUNET_RECLAIM_Presentation *presentation, | ||
755 | char *result); | ||
756 | |||
757 | |||
758 | /** | ||
759 | * Deserialize a presentation | ||
760 | * | ||
761 | * @param data the serialized presentation | ||
762 | * @param data_size the length of the serialized data | ||
763 | * | ||
764 | * @return a GNUNET_RECLAIM_Presentation, must be free'd by caller | ||
765 | */ | ||
766 | struct GNUNET_RECLAIM_Presentation * | ||
767 | GNUNET_RECLAIM_presentation_deserialize (const char *data, size_t data_size); | ||
768 | |||
769 | |||
770 | /** | ||
771 | * Convert the 'claim' of a presentation to a string | ||
772 | * | ||
773 | * @param type the type of presentation | ||
774 | * @param data presentation in binary encoding | ||
775 | * @param data_size number of bytes in @a data | ||
776 | * @return NULL on error, otherwise human-readable representation of the claim | ||
777 | */ | ||
778 | char * | ||
779 | GNUNET_RECLAIM_presentation_value_to_string (uint32_t type, | ||
780 | const void *data, | ||
781 | size_t data_size); | ||
782 | |||
783 | /** | ||
784 | * Convert human-readable version of a 'claim' of a presentation to the binary | ||
785 | * representation | ||
786 | * | ||
787 | * @param type type of the presentation | ||
788 | * @param s human-readable string | ||
789 | * @param data set to value in binary encoding (will be allocated) | ||
790 | * @param data_size set to number of bytes in @a data | ||
791 | * @return #GNUNET_OK on success | ||
792 | */ | ||
793 | int | ||
794 | GNUNET_RECLAIM_presentation_string_to_value (uint32_t type, | ||
795 | const char *s, | ||
796 | void **data, | ||
797 | size_t *data_size); | ||
798 | |||
799 | /** | ||
800 | * Convert a presentation type number to the corresponding credential type | ||
801 | * string. | ||
802 | * | ||
803 | * @param type number of a type | ||
804 | * @return corresponding typestring, NULL on error | ||
805 | */ | ||
806 | const char * | ||
807 | GNUNET_RECLAIM_presentation_number_to_typename (uint32_t type); | ||
808 | |||
809 | struct GNUNET_RECLAIM_AttributeList* | ||
810 | GNUNET_RECLAIM_presentation_get_attributes (const struct | ||
811 | GNUNET_RECLAIM_Presentation *cred); | ||
812 | |||
813 | char* | ||
814 | GNUNET_RECLAIM_presentation_get_issuer (const struct | ||
815 | GNUNET_RECLAIM_Presentation *cred); | ||
816 | |||
817 | int | ||
818 | GNUNET_RECLAIM_presentation_get_expiration (const struct | ||
819 | GNUNET_RECLAIM_Presentation *cred, | ||
820 | struct GNUNET_TIME_Absolute *exp); | ||
821 | |||
822 | |||
823 | |||
824 | /** | ||
825 | * Create a presentation from a credential and a lift of (selected) | ||
826 | * attributes in the credential. | ||
827 | * FIXME not yet implemented | ||
828 | * | ||
829 | * @param cred the credential to use | ||
830 | * @param attrs the attributes to present from the credential | ||
831 | * @return the credential presentation presenting the attributes according | ||
832 | * to the presentation mechanism of the credential | ||
833 | * or NULL on error. | ||
834 | */ | ||
835 | struct GNUNET_RECLAIM_Presentation* | ||
836 | GNUNET_RECLAIM_credential_get_presentation ( | ||
837 | const struct GNUNET_RECLAIM_Credential *cred, | ||
838 | const struct GNUNET_RECLAIM_AttributeList *attrs); | ||
839 | |||
840 | |||
613 | #if 0 /* keep Emacsens' auto-indent happy */ | 841 | #if 0 /* keep Emacsens' auto-indent happy */ |
614 | { | 842 | { |
615 | #endif | 843 | #endif |
diff --git a/src/include/gnunet_reclaim_plugin.h b/src/include/gnunet_reclaim_plugin.h index 7ee9e730f..af6c74e0b 100644 --- a/src/include/gnunet_reclaim_plugin.h +++ b/src/include/gnunet_reclaim_plugin.h | |||
@@ -27,8 +27,8 @@ | |||
27 | * @defgroup reclaim-attribute-plugin reclaim plugin API for attributes/claims | 27 | * @defgroup reclaim-attribute-plugin reclaim plugin API for attributes/claims |
28 | * @{ | 28 | * @{ |
29 | */ | 29 | */ |
30 | #ifndef GNUNET_RECLAIM_AttributePLUGIN_H | 30 | #ifndef GNUNET_RECLAIM_PLUGIN_H |
31 | #define GNUNET_RECLAIM_AttributePLUGIN_H | 31 | #define GNUNET_RECLAIM_PLUGIN_H |
32 | 32 | ||
33 | #include "gnunet_util_lib.h" | 33 | #include "gnunet_util_lib.h" |
34 | #include "gnunet_reclaim_lib.h" | 34 | #include "gnunet_reclaim_lib.h" |
@@ -113,7 +113,7 @@ typedef const char *(*GNUNET_RECLAIM_AttributeNumberToTypenameFunction) ( | |||
113 | * @param data_size number of bytes in @a data | 113 | * @param data_size number of bytes in @a data |
114 | * @return NULL on error, otherwise human-readable representation of the value | 114 | * @return NULL on error, otherwise human-readable representation of the value |
115 | */ | 115 | */ |
116 | typedef char *(*GNUNET_RECLAIM_AttestationValueToStringFunction) ( | 116 | typedef char *(*GNUNET_RECLAIM_CredentialValueToStringFunction) ( |
117 | void *cls, | 117 | void *cls, |
118 | uint32_t type, | 118 | uint32_t type, |
119 | const void *data, | 119 | const void *data, |
@@ -132,7 +132,7 @@ typedef char *(*GNUNET_RECLAIM_AttestationValueToStringFunction) ( | |||
132 | * @param data_size set to number of bytes in @a data | 132 | * @param data_size set to number of bytes in @a data |
133 | * @return #GNUNET_OK on success | 133 | * @return #GNUNET_OK on success |
134 | */ | 134 | */ |
135 | typedef int (*GNUNET_RECLAIM_AttestationStringToValueFunction) ( | 135 | typedef int (*GNUNET_RECLAIM_CredentialStringToValueFunction) ( |
136 | void *cls, | 136 | void *cls, |
137 | uint32_t type, | 137 | uint32_t type, |
138 | const char *s, | 138 | const char *s, |
@@ -148,7 +148,7 @@ typedef int (*GNUNET_RECLAIM_AttestationStringToValueFunction) ( | |||
148 | * @param typename name to convert | 148 | * @param typename name to convert |
149 | * @return corresponding number, UINT32_MAX on error | 149 | * @return corresponding number, UINT32_MAX on error |
150 | */ | 150 | */ |
151 | typedef uint32_t (*GNUNET_RECLAIM_AttestationTypenameToNumberFunction) ( | 151 | typedef uint32_t (*GNUNET_RECLAIM_CredentialTypenameToNumberFunction) ( |
152 | void *cls, | 152 | void *cls, |
153 | const char *typename); | 153 | const char *typename); |
154 | 154 | ||
@@ -161,45 +161,144 @@ typedef uint32_t (*GNUNET_RECLAIM_AttestationTypenameToNumberFunction) ( | |||
161 | * @param type number of a type to convert | 161 | * @param type number of a type to convert |
162 | * @return corresponding typestring, NULL on error | 162 | * @return corresponding typestring, NULL on error |
163 | */ | 163 | */ |
164 | typedef const char *(*GNUNET_RECLAIM_AttestationNumberToTypenameFunction) ( | 164 | typedef const char *(*GNUNET_RECLAIM_CredentialNumberToTypenameFunction) ( |
165 | void *cls, | 165 | void *cls, |
166 | uint32_t type); | 166 | uint32_t type); |
167 | 167 | ||
168 | /** | 168 | /** |
169 | * Function called to extract attributes from an attestation | 169 | * Function called to extract attributes from a credential |
170 | * | 170 | * |
171 | * @param cls closure | 171 | * @param cls closure |
172 | * @param attest the attestation object | 172 | * @param cred the credential object |
173 | * @return an attribute list | 173 | * @return an attribute list |
174 | */ | 174 | */ |
175 | typedef struct | 175 | typedef struct |
176 | GNUNET_RECLAIM_AttributeList *(* | 176 | GNUNET_RECLAIM_AttributeList *(* |
177 | GNUNET_RECLAIM_AttestationGetAttributesFunction) ( | 177 | GNUNET_RECLAIM_CredentialGetAttributesFunction) ( |
178 | void *cls, | 178 | void *cls, |
179 | const struct GNUNET_RECLAIM_Attestation *attest); | 179 | const struct GNUNET_RECLAIM_Credential *cred); |
180 | 180 | ||
181 | /** | 181 | /** |
182 | * Function called to get the issuer of the attestation (as string) | 182 | * Function called to get the issuer of the credential (as string) |
183 | * | 183 | * |
184 | * @param cls closure | 184 | * @param cls closure |
185 | * @param attest the attestation object | 185 | * @param cred the credential object |
186 | * @return corresponding issuer string | 186 | * @return corresponding issuer string |
187 | */ | 187 | */ |
188 | typedef char *(*GNUNET_RECLAIM_AttestationGetIssuerFunction) ( | 188 | typedef char *(*GNUNET_RECLAIM_CredentialGetIssuerFunction) ( |
189 | void *cls, | 189 | void *cls, |
190 | const struct GNUNET_RECLAIM_Attestation *attest); | 190 | const struct GNUNET_RECLAIM_Credential *cred); |
191 | 191 | ||
192 | /** | 192 | /** |
193 | * Function called to get the expiration of the attestation | 193 | * Function called to get the expiration of the credential |
194 | * | 194 | * |
195 | * @param cls closure | 195 | * @param cls closure |
196 | * @param attest the attestation object | 196 | * @param cred the credential object |
197 | * @param where to write the value | 197 | * @param where to write the value |
198 | * @return GNUNET_OK if successful | 198 | * @return GNUNET_OK if successful |
199 | */ | 199 | */ |
200 | typedef int (*GNUNET_RECLAIM_AttestationGetExpirationFunction) ( | 200 | typedef int (*GNUNET_RECLAIM_CredentialGetExpirationFunction) ( |
201 | void *cls, | 201 | void *cls, |
202 | const struct GNUNET_RECLAIM_Attestation *attest, | 202 | const struct GNUNET_RECLAIM_Credential *cred, |
203 | struct GNUNET_TIME_Absolute *expiration); | ||
204 | |||
205 | /** | ||
206 | * Function called to convert the binary value @a data of an attribute of | ||
207 | * type @a type to a human-readable string. | ||
208 | * | ||
209 | * @param cls closure | ||
210 | * @param type type of the attribute | ||
211 | * @param data value in binary encoding | ||
212 | * @param data_size number of bytes in @a data | ||
213 | * @return NULL on error, otherwise human-readable representation of the value | ||
214 | */ | ||
215 | typedef char *(*GNUNET_RECLAIM_PresentationValueToStringFunction) ( | ||
216 | void *cls, | ||
217 | uint32_t type, | ||
218 | const void *data, | ||
219 | size_t data_size); | ||
220 | |||
221 | |||
222 | /** | ||
223 | * Function called to convert human-readable version of the value @a s | ||
224 | * of an attribute of type @a type to the respective binary | ||
225 | * representation. | ||
226 | * | ||
227 | * @param cls closure | ||
228 | * @param type type of the attribute | ||
229 | * @param s human-readable string | ||
230 | * @param data set to value in binary encoding (will be allocated) | ||
231 | * @param data_size set to number of bytes in @a data | ||
232 | * @return #GNUNET_OK on success | ||
233 | */ | ||
234 | typedef int (*GNUNET_RECLAIM_PresentationStringToValueFunction) ( | ||
235 | void *cls, | ||
236 | uint32_t type, | ||
237 | const char *s, | ||
238 | void **data, | ||
239 | size_t *data_size); | ||
240 | |||
241 | |||
242 | /** | ||
243 | * Function called to convert a type name to the | ||
244 | * corresponding number. | ||
245 | * | ||
246 | * @param cls closure | ||
247 | * @param typename name to convert | ||
248 | * @return corresponding number, UINT32_MAX on error | ||
249 | */ | ||
250 | typedef uint32_t (*GNUNET_RECLAIM_PresentationTypenameToNumberFunction) ( | ||
251 | void *cls, | ||
252 | const char *typename); | ||
253 | |||
254 | |||
255 | /** | ||
256 | * Function called to convert a type number (i.e. 1) to the | ||
257 | * corresponding type string | ||
258 | * | ||
259 | * @param cls closure | ||
260 | * @param type number of a type to convert | ||
261 | * @return corresponding typestring, NULL on error | ||
262 | */ | ||
263 | typedef const char *(*GNUNET_RECLAIM_PresentationNumberToTypenameFunction) ( | ||
264 | void *cls, | ||
265 | uint32_t type); | ||
266 | |||
267 | /** | ||
268 | * Function called to extract attributes from a credential | ||
269 | * | ||
270 | * @param cls closure | ||
271 | * @param cred the credential object | ||
272 | * @return an attribute list | ||
273 | */ | ||
274 | typedef struct | ||
275 | GNUNET_RECLAIM_AttributeList *(* | ||
276 | GNUNET_RECLAIM_PresentationGetAttributesFunction) ( | ||
277 | void *cls, | ||
278 | const struct GNUNET_RECLAIM_Presentation *cred); | ||
279 | |||
280 | /** | ||
281 | * Function called to get the issuer of the credential (as string) | ||
282 | * | ||
283 | * @param cls closure | ||
284 | * @param cred the credential object | ||
285 | * @return corresponding issuer string | ||
286 | */ | ||
287 | typedef char *(*GNUNET_RECLAIM_PresentationGetIssuerFunction) ( | ||
288 | void *cls, | ||
289 | const struct GNUNET_RECLAIM_Presentation *cred); | ||
290 | |||
291 | /** | ||
292 | * Function called to get the expiration of the credential | ||
293 | * | ||
294 | * @param cls closure | ||
295 | * @param cred the credential object | ||
296 | * @param where to write the value | ||
297 | * @return GNUNET_OK if successful | ||
298 | */ | ||
299 | typedef int (*GNUNET_RECLAIM_PresentationGetExpirationFunction) ( | ||
300 | void *cls, | ||
301 | const struct GNUNET_RECLAIM_Presentation *cred, | ||
203 | struct GNUNET_TIME_Absolute *expiration); | 302 | struct GNUNET_TIME_Absolute *expiration); |
204 | 303 | ||
205 | 304 | ||
@@ -240,7 +339,7 @@ struct GNUNET_RECLAIM_AttributePluginFunctions | |||
240 | * Each plugin is required to return a pointer to a struct of this | 339 | * Each plugin is required to return a pointer to a struct of this |
241 | * type as the return value from its entry point. | 340 | * type as the return value from its entry point. |
242 | */ | 341 | */ |
243 | struct GNUNET_RECLAIM_AttestationPluginFunctions | 342 | struct GNUNET_RECLAIM_CredentialPluginFunctions |
244 | { | 343 | { |
245 | /** | 344 | /** |
246 | * Closure for all of the callbacks. | 345 | * Closure for all of the callbacks. |
@@ -250,37 +349,73 @@ struct GNUNET_RECLAIM_AttestationPluginFunctions | |||
250 | /** | 349 | /** |
251 | * Conversion to string. | 350 | * Conversion to string. |
252 | */ | 351 | */ |
253 | GNUNET_RECLAIM_AttestationValueToStringFunction value_to_string; | 352 | GNUNET_RECLAIM_CredentialValueToStringFunction value_to_string; |
353 | |||
354 | /** | ||
355 | * Conversion to binary. | ||
356 | */ | ||
357 | GNUNET_RECLAIM_CredentialStringToValueFunction string_to_value; | ||
358 | |||
359 | /** | ||
360 | * Typename to number. | ||
361 | */ | ||
362 | GNUNET_RECLAIM_CredentialTypenameToNumberFunction typename_to_number; | ||
363 | |||
364 | /** | ||
365 | * Number to typename. | ||
366 | */ | ||
367 | GNUNET_RECLAIM_CredentialNumberToTypenameFunction number_to_typename; | ||
368 | |||
369 | /** | ||
370 | * Attesation attributes. | ||
371 | */ | ||
372 | GNUNET_RECLAIM_CredentialGetAttributesFunction get_attributes; | ||
373 | |||
374 | /** | ||
375 | * Attesation issuer. | ||
376 | */ | ||
377 | GNUNET_RECLAIM_CredentialGetIssuerFunction get_issuer; | ||
378 | |||
379 | /** | ||
380 | * Expiration. | ||
381 | */ | ||
382 | GNUNET_RECLAIM_CredentialGetExpirationFunction get_expiration; | ||
383 | |||
384 | /** | ||
385 | * Conversion to string. | ||
386 | */ | ||
387 | GNUNET_RECLAIM_PresentationValueToStringFunction value_to_string_p; | ||
254 | 388 | ||
255 | /** | 389 | /** |
256 | * Conversion to binary. | 390 | * Conversion to binary. |
257 | */ | 391 | */ |
258 | GNUNET_RECLAIM_AttestationStringToValueFunction string_to_value; | 392 | GNUNET_RECLAIM_PresentationStringToValueFunction string_to_value_p; |
259 | 393 | ||
260 | /** | 394 | /** |
261 | * Typename to number. | 395 | * Typename to number. |
262 | */ | 396 | */ |
263 | GNUNET_RECLAIM_AttestationTypenameToNumberFunction typename_to_number; | 397 | GNUNET_RECLAIM_PresentationTypenameToNumberFunction typename_to_number_p; |
264 | 398 | ||
265 | /** | 399 | /** |
266 | * Number to typename. | 400 | * Number to typename. |
267 | */ | 401 | */ |
268 | GNUNET_RECLAIM_AttestationNumberToTypenameFunction number_to_typename; | 402 | GNUNET_RECLAIM_PresentationNumberToTypenameFunction number_to_typename_p; |
269 | 403 | ||
270 | /** | 404 | /** |
271 | * Attesation attributes. | 405 | * Attesation attributes. |
272 | */ | 406 | */ |
273 | GNUNET_RECLAIM_AttestationGetAttributesFunction get_attributes; | 407 | GNUNET_RECLAIM_PresentationGetAttributesFunction get_attributes_p; |
274 | 408 | ||
275 | /** | 409 | /** |
276 | * Attesation issuer. | 410 | * Attesation issuer. |
277 | */ | 411 | */ |
278 | GNUNET_RECLAIM_AttestationGetIssuerFunction get_issuer; | 412 | GNUNET_RECLAIM_PresentationGetIssuerFunction get_issuer_p; |
279 | 413 | ||
280 | /** | 414 | /** |
281 | * Expiration. | 415 | * Expiration. |
282 | */ | 416 | */ |
283 | GNUNET_RECLAIM_AttestationGetExpirationFunction get_expiration; | 417 | GNUNET_RECLAIM_PresentationGetExpirationFunction get_expiration_p; |
418 | |||
284 | }; | 419 | }; |
285 | 420 | ||
286 | 421 | ||
diff --git a/src/include/gnunet_reclaim_service.h b/src/include/gnunet_reclaim_service.h index 139c44ae7..8387c79b0 100644 --- a/src/include/gnunet_reclaim_service.h +++ b/src/include/gnunet_reclaim_service.h | |||
@@ -113,7 +113,6 @@ typedef void (*GNUNET_RECLAIM_ContinuationWithStatus) (void *cls, | |||
113 | * @param cls The callback closure | 113 | * @param cls The callback closure |
114 | * @param identity The identity authoritative over the attributes | 114 | * @param identity The identity authoritative over the attributes |
115 | * @param attr The attribute | 115 | * @param attr The attribute |
116 | * @param attestation The attestation for the attribute (may be NULL) | ||
117 | */ | 116 | */ |
118 | typedef void (*GNUNET_RECLAIM_AttributeResult) ( | 117 | typedef void (*GNUNET_RECLAIM_AttributeResult) ( |
119 | void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, | 118 | void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, |
@@ -125,25 +124,25 @@ typedef void (*GNUNET_RECLAIM_AttributeResult) ( | |||
125 | * @param cls The callback closure | 124 | * @param cls The callback closure |
126 | * @param identity The identity authoritative over the attributes | 125 | * @param identity The identity authoritative over the attributes |
127 | * @param attr The attribute | 126 | * @param attr The attribute |
128 | * @param attestation The attestation for the attribute (may be NULL) | 127 | * @param presentation The presentation for the credential (may be NULL) |
129 | */ | 128 | */ |
130 | typedef void (*GNUNET_RECLAIM_AttributeTicketResult) ( | 129 | typedef void (*GNUNET_RECLAIM_AttributeTicketResult) ( |
131 | void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, | 130 | void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, |
132 | const struct GNUNET_RECLAIM_Attribute *attr, | 131 | const struct GNUNET_RECLAIM_Attribute *attr, |
133 | const struct GNUNET_RECLAIM_Attestation *attestation); | 132 | const struct GNUNET_RECLAIM_Presentation *presentation); |
134 | 133 | ||
135 | 134 | ||
136 | /** | 135 | /** |
137 | * Callback used to notify the client of attestation results. | 136 | * Callback used to notify the client of credential results. |
138 | * | 137 | * |
139 | * @param cls The callback closure | 138 | * @param cls The callback closure |
140 | * @param identity The identity authoritative over the attributes | 139 | * @param identity The identity authoritative over the attributes |
141 | * @param attestation The attestation | 140 | * @param credential The credential |
142 | * @param attributes the parsed attributes | 141 | * @param attributes the parsed attributes |
143 | */ | 142 | */ |
144 | typedef void (*GNUNET_RECLAIM_AttestationResult) ( | 143 | typedef void (*GNUNET_RECLAIM_CredentialResult) ( |
145 | void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, | 144 | void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, |
146 | const struct GNUNET_RECLAIM_Attestation *attestation); | 145 | const struct GNUNET_RECLAIM_Credential *credential); |
147 | 146 | ||
148 | 147 | ||
149 | /** | 148 | /** |
@@ -178,22 +177,22 @@ GNUNET_RECLAIM_attribute_store ( | |||
178 | 177 | ||
179 | 178 | ||
180 | /** | 179 | /** |
181 | * Store an attestation. If the attestation is already present, | 180 | * Store a credential. If the credential is already present, |
182 | * it is replaced with the new attestation. | 181 | * it is replaced with the new credential. |
183 | * | 182 | * |
184 | * @param h handle to the re:claimID service | 183 | * @param h handle to the re:claimID service |
185 | * @param pkey private key of the identity | 184 | * @param pkey private key of the identity |
186 | * @param attr the attestation value | 185 | * @param attr the credential value |
187 | * @param exp_interval the relative expiration interval for the attestation | 186 | * @param exp_interval the relative expiration interval for the credential |
188 | * @param cont continuation to call when done | 187 | * @param cont continuation to call when done |
189 | * @param cont_cls closure for @a cont | 188 | * @param cont_cls closure for @a cont |
190 | * @return handle to abort the request | 189 | * @return handle to abort the request |
191 | */ | 190 | */ |
192 | struct GNUNET_RECLAIM_Operation * | 191 | struct GNUNET_RECLAIM_Operation * |
193 | GNUNET_RECLAIM_attestation_store ( | 192 | GNUNET_RECLAIM_credential_store ( |
194 | struct GNUNET_RECLAIM_Handle *h, | 193 | struct GNUNET_RECLAIM_Handle *h, |
195 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, | 194 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, |
196 | const struct GNUNET_RECLAIM_Attestation *attestation, | 195 | const struct GNUNET_RECLAIM_Credential *credential, |
197 | const struct GNUNET_TIME_Relative *exp_interval, | 196 | const struct GNUNET_TIME_Relative *exp_interval, |
198 | GNUNET_RECLAIM_ContinuationWithStatus cont, | 197 | GNUNET_RECLAIM_ContinuationWithStatus cont, |
199 | void *cont_cls); | 198 | void *cont_cls); |
@@ -218,21 +217,21 @@ GNUNET_RECLAIM_attribute_delete ( | |||
218 | GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls); | 217 | GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls); |
219 | 218 | ||
220 | /** | 219 | /** |
221 | * Delete an attestation. Tickets used to share this attestation are updated | 220 | * Delete a credential. Tickets used to share use a presentation of this |
222 | * accordingly. | 221 | * credential are updated accordingly. |
223 | * | 222 | * |
224 | * @param h handle to the re:claimID service | 223 | * @param h handle to the re:claimID service |
225 | * @param pkey Private key of the identity to add an attribute to | 224 | * @param pkey Private key of the identity to add an attribute to |
226 | * @param attr The attestation | 225 | * @param cred The credential |
227 | * @param cont Continuation to call when done | 226 | * @param cont Continuation to call when done |
228 | * @param cont_cls Closure for @a cont | 227 | * @param cont_cls Closure for @a cont |
229 | * @return handle Used to to abort the request | 228 | * @return handle Used to to abort the request |
230 | */ | 229 | */ |
231 | struct GNUNET_RECLAIM_Operation * | 230 | struct GNUNET_RECLAIM_Operation * |
232 | GNUNET_RECLAIM_attestation_delete ( | 231 | GNUNET_RECLAIM_credential_delete ( |
233 | struct GNUNET_RECLAIM_Handle *h, | 232 | struct GNUNET_RECLAIM_Handle *h, |
234 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, | 233 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, |
235 | const struct GNUNET_RECLAIM_Attestation *attr, | 234 | const struct GNUNET_RECLAIM_Credential *cred, |
236 | GNUNET_RECLAIM_ContinuationWithStatus cont, | 235 | GNUNET_RECLAIM_ContinuationWithStatus cont, |
237 | void *cont_cls); | 236 | void *cont_cls); |
238 | 237 | ||
@@ -293,12 +292,12 @@ GNUNET_RECLAIM_get_attributes_stop ( | |||
293 | 292 | ||
294 | 293 | ||
295 | /** | 294 | /** |
296 | * List all attestations for a local identity. | 295 | * List all credentials for a local identity. |
297 | * This MUST lock the `struct GNUNET_RECLAIM_Handle` | 296 | * This MUST lock the `struct GNUNET_RECLAIM_Handle` |
298 | * for any other calls than #GNUNET_RECLAIM_get_attestations_next() and | 297 | * for any other calls than #GNUNET_RECLAIM_get_credentials_next() and |
299 | * #GNUNET_RECLAIM_get_attestations_stop. @a proc will be called once | 298 | * #GNUNET_RECLAIM_get_credentials_stop. @a proc will be called once |
300 | * immediately, and then again after | 299 | * immediately, and then again after |
301 | * #GNUNET_RECLAIM_get_attestations_next() is invoked. | 300 | * #GNUNET_RECLAIM_get_credentials_next() is invoked. |
302 | * | 301 | * |
303 | * On error (disconnect), @a error_cb will be invoked. | 302 | * On error (disconnect), @a error_cb will be invoked. |
304 | * On normal completion, @a finish_cb proc will be | 303 | * On normal completion, @a finish_cb proc will be |
@@ -309,34 +308,34 @@ GNUNET_RECLAIM_get_attributes_stop ( | |||
309 | * @param error_cb Function to call on error (i.e. disconnect), | 308 | * @param error_cb Function to call on error (i.e. disconnect), |
310 | * the handle is afterwards invalid | 309 | * the handle is afterwards invalid |
311 | * @param error_cb_cls Closure for @a error_cb | 310 | * @param error_cb_cls Closure for @a error_cb |
312 | * @param proc Function to call on each attestation | 311 | * @param proc Function to call on each credential |
313 | * @param proc_cls Closure for @a proc | 312 | * @param proc_cls Closure for @a proc |
314 | * @param finish_cb Function to call on completion | 313 | * @param finish_cb Function to call on completion |
315 | * the handle is afterwards invalid | 314 | * the handle is afterwards invalid |
316 | * @param finish_cb_cls Closure for @a finish_cb | 315 | * @param finish_cb_cls Closure for @a finish_cb |
317 | * @return an iterator Handle to use for iteration | 316 | * @return an iterator Handle to use for iteration |
318 | */ | 317 | */ |
319 | struct GNUNET_RECLAIM_AttestationIterator * | 318 | struct GNUNET_RECLAIM_CredentialIterator * |
320 | GNUNET_RECLAIM_get_attestations_start ( | 319 | GNUNET_RECLAIM_get_credentials_start ( |
321 | struct GNUNET_RECLAIM_Handle *h, | 320 | struct GNUNET_RECLAIM_Handle *h, |
322 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, | 321 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, |
323 | GNUNET_SCHEDULER_TaskCallback error_cb, | 322 | GNUNET_SCHEDULER_TaskCallback error_cb, |
324 | void *error_cb_cls, | 323 | void *error_cb_cls, |
325 | GNUNET_RECLAIM_AttestationResult proc, | 324 | GNUNET_RECLAIM_CredentialResult proc, |
326 | void *proc_cls, | 325 | void *proc_cls, |
327 | GNUNET_SCHEDULER_TaskCallback finish_cb, | 326 | GNUNET_SCHEDULER_TaskCallback finish_cb, |
328 | void *finish_cb_cls); | 327 | void *finish_cb_cls); |
329 | 328 | ||
330 | 329 | ||
331 | /** | 330 | /** |
332 | * Calls the record processor specified in #GNUNET_RECLAIM_get_attestation_start | 331 | * Calls the record processor specified in #GNUNET_RECLAIM_get_credentials_start |
333 | * for the next record. | 332 | * for the next record. |
334 | * | 333 | * |
335 | * @param it the iterator | 334 | * @param it the iterator |
336 | */ | 335 | */ |
337 | void | 336 | void |
338 | GNUNET_RECLAIM_get_attestations_next (struct | 337 | GNUNET_RECLAIM_get_credentials_next ( |
339 | GNUNET_RECLAIM_AttestationIterator *ait); | 338 | struct GNUNET_RECLAIM_CredentialIterator *ait); |
340 | 339 | ||
341 | 340 | ||
342 | /** | 341 | /** |
@@ -347,8 +346,8 @@ GNUNET_RECLAIM_get_attestations_next (struct | |||
347 | * @param it the iterator | 346 | * @param it the iterator |
348 | */ | 347 | */ |
349 | void | 348 | void |
350 | GNUNET_RECLAIM_get_attestations_stop (struct | 349 | GNUNET_RECLAIM_get_credentials_stop ( |
351 | GNUNET_RECLAIM_AttestationIterator *ait); | 350 | struct GNUNET_RECLAIM_CredentialIterator *ait); |
352 | 351 | ||
353 | 352 | ||
354 | /** | 353 | /** |
diff --git a/src/reclaim/Makefile.am b/src/reclaim/Makefile.am index 9b75c11aa..a58127abf 100644 --- a/src/reclaim/Makefile.am +++ b/src/reclaim/Makefile.am | |||
@@ -13,8 +13,8 @@ REST_PLUGIN = \ | |||
13 | libgnunet_plugin_rest_openid_connect.la \ | 13 | libgnunet_plugin_rest_openid_connect.la \ |
14 | libgnunet_plugin_rest_reclaim.la | 14 | libgnunet_plugin_rest_reclaim.la |
15 | 15 | ||
16 | ATTESTATION_PLUGIN = \ | 16 | CREDENTIAL_PLUGIN = \ |
17 | libgnunet_plugin_reclaim_attestation_jwt.la | 17 | libgnunet_plugin_reclaim_credential_jwt.la |
18 | 18 | ||
19 | EXTRA_DIST = \ | 19 | EXTRA_DIST = \ |
20 | reclaim.conf \ | 20 | reclaim.conf \ |
@@ -34,7 +34,7 @@ lib_LTLIBRARIES = \ | |||
34 | plugin_LTLIBRARIES = \ | 34 | plugin_LTLIBRARIES = \ |
35 | libgnunet_plugin_gnsrecord_reclaim.la \ | 35 | libgnunet_plugin_gnsrecord_reclaim.la \ |
36 | libgnunet_plugin_reclaim_attribute_basic.la \ | 36 | libgnunet_plugin_reclaim_attribute_basic.la \ |
37 | $(ATTESTATION_PLUGIN) \ | 37 | $(CREDENTIAL_PLUGIN) \ |
38 | $(REST_PLUGIN) | 38 | $(REST_PLUGIN) |
39 | 39 | ||
40 | bin_PROGRAMS = \ | 40 | bin_PROGRAMS = \ |
@@ -115,8 +115,8 @@ libgnunetreclaim_la_SOURCES = \ | |||
115 | reclaim.h \ | 115 | reclaim.h \ |
116 | reclaim_attribute.c \ | 116 | reclaim_attribute.c \ |
117 | reclaim_attribute.h \ | 117 | reclaim_attribute.h \ |
118 | reclaim_attestation.c \ | 118 | reclaim_credential.c \ |
119 | reclaim_attestation.h | 119 | reclaim_credential.h |
120 | libgnunetreclaim_la_LIBADD = \ | 120 | libgnunetreclaim_la_LIBADD = \ |
121 | $(top_builddir)/src/util/libgnunetutil.la \ | 121 | $(top_builddir)/src/util/libgnunetutil.la \ |
122 | $(GN_LIBINTL) $(XLIB) | 122 | $(GN_LIBINTL) $(XLIB) |
@@ -133,14 +133,14 @@ libgnunet_plugin_reclaim_attribute_basic_la_LIBADD = \ | |||
133 | libgnunet_plugin_reclaim_attribute_basic_la_LDFLAGS = \ | 133 | libgnunet_plugin_reclaim_attribute_basic_la_LDFLAGS = \ |
134 | $(GN_PLUGIN_LDFLAGS) | 134 | $(GN_PLUGIN_LDFLAGS) |
135 | 135 | ||
136 | libgnunet_plugin_reclaim_attestation_jwt_la_SOURCES = \ | 136 | libgnunet_plugin_reclaim_credential_jwt_la_SOURCES = \ |
137 | plugin_reclaim_attestation_jwt.c | 137 | plugin_reclaim_credential_jwt.c |
138 | libgnunet_plugin_reclaim_attestation_jwt_la_LIBADD = \ | 138 | libgnunet_plugin_reclaim_credential_jwt_la_LIBADD = \ |
139 | $(top_builddir)/src/util/libgnunetutil.la \ | 139 | $(top_builddir)/src/util/libgnunetutil.la \ |
140 | libgnunetreclaim.la \ | 140 | libgnunetreclaim.la \ |
141 | -ljansson\ | 141 | -ljansson\ |
142 | $(LTLIBINTL) | 142 | $(LTLIBINTL) |
143 | libgnunet_plugin_reclaim_attestation_jwt_la_LDFLAGS = \ | 143 | libgnunet_plugin_reclaim_credential_jwt_la_LDFLAGS = \ |
144 | $(GN_PLUGIN_LDFLAGS) | 144 | $(GN_PLUGIN_LDFLAGS) |
145 | 145 | ||
146 | gnunet_reclaim_SOURCES = \ | 146 | gnunet_reclaim_SOURCES = \ |
diff --git a/src/reclaim/gnunet-reclaim.c b/src/reclaim/gnunet-reclaim.c index 6bef5b6fe..a59053f5f 100644 --- a/src/reclaim/gnunet-reclaim.c +++ b/src/reclaim/gnunet-reclaim.c | |||
@@ -43,29 +43,34 @@ static int ret; | |||
43 | static int list; | 43 | static int list; |
44 | 44 | ||
45 | /** | 45 | /** |
46 | * List attestations flag | 46 | * List credentials flag |
47 | */ | 47 | */ |
48 | static int list_attestations; | 48 | static int list_credentials; |
49 | 49 | ||
50 | /** | 50 | /** |
51 | * Attestation ID string | 51 | * Credential ID string |
52 | */ | 52 | */ |
53 | static char *attestation_id; | 53 | static char *credential_id; |
54 | 54 | ||
55 | /** | 55 | /** |
56 | * Attestation ID | 56 | * Credential ID |
57 | */ | 57 | */ |
58 | static struct GNUNET_RECLAIM_Identifier attestation; | 58 | static struct GNUNET_RECLAIM_Identifier credential; |
59 | 59 | ||
60 | /** | 60 | /** |
61 | * Attestation name | 61 | * Credential name |
62 | */ | 62 | */ |
63 | static char *attestation_name; | 63 | static char *credential_name; |
64 | 64 | ||
65 | /** | 65 | /** |
66 | * Attestation exists | 66 | * Credential type |
67 | */ | 67 | */ |
68 | static int attestation_exists; | 68 | static char *credential_type; |
69 | |||
70 | /** | ||
71 | * Credential exists | ||
72 | */ | ||
73 | static int credential_exists; | ||
69 | 74 | ||
70 | /** | 75 | /** |
71 | * Relying party | 76 | * Relying party |
@@ -133,9 +138,9 @@ static struct GNUNET_RECLAIM_Operation *reclaim_op; | |||
133 | static struct GNUNET_RECLAIM_AttributeIterator *attr_iterator; | 138 | static struct GNUNET_RECLAIM_AttributeIterator *attr_iterator; |
134 | 139 | ||
135 | /** | 140 | /** |
136 | * Attestation iterator | 141 | * Credential iterator |
137 | */ | 142 | */ |
138 | static struct GNUNET_RECLAIM_AttestationIterator *attest_iterator; | 143 | static struct GNUNET_RECLAIM_CredentialIterator *cred_iterator; |
139 | 144 | ||
140 | 145 | ||
141 | /** | 146 | /** |
@@ -143,10 +148,6 @@ static struct GNUNET_RECLAIM_AttestationIterator *attest_iterator; | |||
143 | */ | 148 | */ |
144 | static struct GNUNET_RECLAIM_TicketIterator *ticket_iterator; | 149 | static struct GNUNET_RECLAIM_TicketIterator *ticket_iterator; |
145 | 150 | ||
146 | /** | ||
147 | * Master ABE key | ||
148 | */ | ||
149 | static struct GNUNET_CRYPTO_AbeMasterKey *abe_key; | ||
150 | 151 | ||
151 | /** | 152 | /** |
152 | * ego private key | 153 | * ego private key |
@@ -208,20 +209,20 @@ do_cleanup (void *cls) | |||
208 | GNUNET_RECLAIM_cancel (reclaim_op); | 209 | GNUNET_RECLAIM_cancel (reclaim_op); |
209 | if (NULL != attr_iterator) | 210 | if (NULL != attr_iterator) |
210 | GNUNET_RECLAIM_get_attributes_stop (attr_iterator); | 211 | GNUNET_RECLAIM_get_attributes_stop (attr_iterator); |
211 | if (NULL != attest_iterator) | 212 | if (NULL != cred_iterator) |
212 | GNUNET_RECLAIM_get_attestations_stop (attest_iterator); | 213 | GNUNET_RECLAIM_get_credentials_stop (cred_iterator); |
213 | if (NULL != ticket_iterator) | 214 | if (NULL != ticket_iterator) |
214 | GNUNET_RECLAIM_ticket_iteration_stop (ticket_iterator); | 215 | GNUNET_RECLAIM_ticket_iteration_stop (ticket_iterator); |
215 | if (NULL != reclaim_handle) | 216 | if (NULL != reclaim_handle) |
216 | GNUNET_RECLAIM_disconnect (reclaim_handle); | 217 | GNUNET_RECLAIM_disconnect (reclaim_handle); |
217 | if (NULL != identity_handle) | 218 | if (NULL != identity_handle) |
218 | GNUNET_IDENTITY_disconnect (identity_handle); | 219 | GNUNET_IDENTITY_disconnect (identity_handle); |
219 | if (NULL != abe_key) | ||
220 | GNUNET_free (abe_key); | ||
221 | if (NULL != attr_list) | 220 | if (NULL != attr_list) |
222 | GNUNET_free (attr_list); | 221 | GNUNET_free (attr_list); |
223 | if (NULL != attr_to_delete) | 222 | if (NULL != attr_to_delete) |
224 | GNUNET_free (attr_to_delete); | 223 | GNUNET_free (attr_to_delete); |
224 | if (NULL == credential_type) | ||
225 | GNUNET_free (credential_type); | ||
225 | } | 226 | } |
226 | 227 | ||
227 | 228 | ||
@@ -260,7 +261,7 @@ static void | |||
260 | process_attrs (void *cls, | 261 | process_attrs (void *cls, |
261 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, | 262 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, |
262 | const struct GNUNET_RECLAIM_Attribute *attr, | 263 | const struct GNUNET_RECLAIM_Attribute *attr, |
263 | const struct GNUNET_RECLAIM_Attestation *attest) | 264 | const struct GNUNET_RECLAIM_Presentation *presentation) |
264 | { | 265 | { |
265 | char *value_str; | 266 | char *value_str; |
266 | char *id; | 267 | char *id; |
@@ -280,7 +281,7 @@ process_attrs (void *cls, | |||
280 | attr_type = GNUNET_RECLAIM_attribute_number_to_typename (attr->type); | 281 | attr_type = GNUNET_RECLAIM_attribute_number_to_typename (attr->type); |
281 | id = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(attr->id)); | 282 | id = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(attr->id)); |
282 | value_str = NULL; | 283 | value_str = NULL; |
283 | if (NULL == attest) | 284 | if (NULL == presentation) |
284 | { | 285 | { |
285 | value_str = GNUNET_RECLAIM_attribute_value_to_string (attr->type, | 286 | value_str = GNUNET_RECLAIM_attribute_value_to_string (attr->type, |
286 | attr->data, | 287 | attr->data, |
@@ -290,7 +291,7 @@ process_attrs (void *cls, | |||
290 | { | 291 | { |
291 | struct GNUNET_RECLAIM_AttributeListEntry *ale; | 292 | struct GNUNET_RECLAIM_AttributeListEntry *ale; |
292 | struct GNUNET_RECLAIM_AttributeList *al | 293 | struct GNUNET_RECLAIM_AttributeList *al |
293 | = GNUNET_RECLAIM_attestation_get_attributes (attest); | 294 | = GNUNET_RECLAIM_presentation_get_attributes (presentation); |
294 | 295 | ||
295 | for (ale = al->list_head; NULL != ale; ale = ale->next) | 296 | for (ale = al->list_head; NULL != ale; ale = ale->next) |
296 | { | 297 | { |
@@ -298,10 +299,8 @@ process_attrs (void *cls, | |||
298 | continue; | 299 | continue; |
299 | value_str | 300 | value_str |
300 | = GNUNET_RECLAIM_attribute_value_to_string (ale->attribute->type, | 301 | = GNUNET_RECLAIM_attribute_value_to_string (ale->attribute->type, |
301 | ale->attribute-> | 302 | ale->attribute->data, |
302 | data, | 303 | ale->attribute->data_size); |
303 | ale->attribute-> | ||
304 | data_size); | ||
305 | break; | 304 | break; |
306 | } | 305 | } |
307 | } | 306 | } |
@@ -312,7 +311,7 @@ process_attrs (void *cls, | |||
312 | attr_type, | 311 | attr_type, |
313 | attr->flag, | 312 | attr->flag, |
314 | id, | 313 | id, |
315 | (NULL == attest) ? "" : "(ATTESTED)"); | 314 | (NULL == presentation) ? "" : "(ATTESTED)"); |
316 | GNUNET_free (value_str); | 315 | GNUNET_free (value_str); |
317 | GNUNET_free (id); | 316 | GNUNET_free (id); |
318 | } | 317 | } |
@@ -362,7 +361,7 @@ static void | |||
362 | iter_error (void *cls) | 361 | iter_error (void *cls) |
363 | { | 362 | { |
364 | attr_iterator = NULL; | 363 | attr_iterator = NULL; |
365 | attest_iterator = NULL; | 364 | cred_iterator = NULL; |
366 | fprintf (stderr, "Failed\n"); | 365 | fprintf (stderr, "Failed\n"); |
367 | 366 | ||
368 | cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); | 367 | cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); |
@@ -489,9 +488,9 @@ iter_finished (void *cls) | |||
489 | claim = | 488 | claim = |
490 | GNUNET_RECLAIM_attribute_new (attr_name, NULL, type, data, data_size); | 489 | GNUNET_RECLAIM_attribute_new (attr_name, NULL, type, data, data_size); |
491 | } | 490 | } |
492 | if (NULL != attestation_id) | 491 | if (NULL != credential_id) |
493 | { | 492 | { |
494 | claim->attestation = attestation; | 493 | claim->credential = credential; |
495 | } | 494 | } |
496 | reclaim_op = GNUNET_RECLAIM_attribute_store (reclaim_handle, | 495 | reclaim_op = GNUNET_RECLAIM_attribute_store (reclaim_handle, |
497 | pkey, | 496 | pkey, |
@@ -524,7 +523,7 @@ iter_cb (void *cls, | |||
524 | if (0 == strcasecmp (attr_name, attr->name)) | 523 | if (0 == strcasecmp (attr_name, attr->name)) |
525 | { | 524 | { |
526 | claim = GNUNET_RECLAIM_attribute_new (attr->name, | 525 | claim = GNUNET_RECLAIM_attribute_new (attr->name, |
527 | &attr->attestation, | 526 | &attr->credential, |
528 | attr->type, | 527 | attr->type, |
529 | attr->data, | 528 | attr->data, |
530 | attr->data_size); | 529 | attr->data_size); |
@@ -543,7 +542,7 @@ iter_cb (void *cls, | |||
543 | } | 542 | } |
544 | le = GNUNET_new (struct GNUNET_RECLAIM_AttributeListEntry); | 543 | le = GNUNET_new (struct GNUNET_RECLAIM_AttributeListEntry); |
545 | le->attribute = GNUNET_RECLAIM_attribute_new (attr->name, | 544 | le->attribute = GNUNET_RECLAIM_attribute_new (attr->name, |
546 | &attr->attestation, | 545 | &attr->credential, |
547 | attr->type, | 546 | attr->type, |
548 | attr->data, | 547 | attr->data, |
549 | attr->data_size); | 548 | attr->data_size); |
@@ -562,7 +561,7 @@ iter_cb (void *cls, | |||
562 | if (0 == strcasecmp (attr_delete, label)) | 561 | if (0 == strcasecmp (attr_delete, label)) |
563 | { | 562 | { |
564 | attr_to_delete = GNUNET_RECLAIM_attribute_new (attr->name, | 563 | attr_to_delete = GNUNET_RECLAIM_attribute_new (attr->name, |
565 | &attr->attestation, | 564 | &attr->credential, |
566 | attr->type, | 565 | attr->type, |
567 | attr->data, | 566 | attr->data, |
568 | attr->data_size); | 567 | attr->data_size); |
@@ -577,7 +576,7 @@ iter_cb (void *cls, | |||
577 | attr->data_size); | 576 | attr->data_size); |
578 | attr_type = GNUNET_RECLAIM_attribute_number_to_typename (attr->type); | 577 | attr_type = GNUNET_RECLAIM_attribute_number_to_typename (attr->type); |
579 | id = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(attr->id)); | 578 | id = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(attr->id)); |
580 | if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&attr->attestation)) | 579 | if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&attr->credential)) |
581 | { | 580 | { |
582 | fprintf (stdout, | 581 | fprintf (stdout, |
583 | "%s: ``%s'' (%s); ID: %s\n", | 582 | "%s: ``%s'' (%s); ID: %s\n", |
@@ -588,17 +587,17 @@ iter_cb (void *cls, | |||
588 | } | 587 | } |
589 | else | 588 | else |
590 | { | 589 | { |
591 | char *attest_id = | 590 | char *cred_id = |
592 | GNUNET_STRINGS_data_to_string_alloc (&attr->attestation, | 591 | GNUNET_STRINGS_data_to_string_alloc (&attr->credential, |
593 | sizeof(attr->attestation)); | 592 | sizeof(attr->credential)); |
594 | fprintf (stdout, | 593 | fprintf (stdout, |
595 | "%s: <``%s'' in attestation %s> (%s); ID: %s\n", | 594 | "%s: ``%s'' in credential presentation `%s' (%s); ID: %s\n", |
596 | attr->name, | 595 | attr->name, |
597 | attr_str, | 596 | attr_str, |
598 | attest_id, | 597 | cred_id, |
599 | attr_type, | 598 | attr_type, |
600 | id); | 599 | id); |
601 | GNUNET_free (attest_id); | 600 | GNUNET_free (cred_id); |
602 | 601 | ||
603 | } | 602 | } |
604 | GNUNET_free (id); | 603 | GNUNET_free (id); |
@@ -608,29 +607,31 @@ iter_cb (void *cls, | |||
608 | 607 | ||
609 | 608 | ||
610 | static void | 609 | static void |
611 | attest_iter_finished (void *cls) | 610 | cred_iter_finished (void *cls) |
612 | { | 611 | { |
613 | attest_iterator = NULL; | 612 | cred_iterator = NULL; |
614 | 613 | ||
615 | // Add new attestation | 614 | // Add new credential |
616 | if ((NULL != attestation_name) && | 615 | if ((NULL != credential_name) && |
617 | (NULL != attr_value)) | 616 | (NULL != attr_value)) |
618 | { | 617 | { |
619 | struct GNUNET_RECLAIM_Attestation *attestation = | 618 | enum GNUNET_RECLAIM_CredentialType ctype = |
620 | GNUNET_RECLAIM_attestation_new (attestation_name, | 619 | GNUNET_RECLAIM_credential_typename_to_number (credential_type); |
621 | GNUNET_RECLAIM_ATTESTATION_TYPE_JWT, // FIXME hardcoded | 620 | struct GNUNET_RECLAIM_Credential *credential = |
622 | attr_value, | 621 | GNUNET_RECLAIM_credential_new (credential_name, |
623 | strlen (attr_value)); | 622 | ctype, |
624 | reclaim_op = GNUNET_RECLAIM_attestation_store (reclaim_handle, | 623 | attr_value, |
625 | pkey, | 624 | strlen (attr_value)); |
626 | attestation, | 625 | reclaim_op = GNUNET_RECLAIM_credential_store (reclaim_handle, |
627 | &exp_interval, | 626 | pkey, |
628 | store_cont, | 627 | credential, |
629 | NULL); | 628 | &exp_interval, |
629 | store_cont, | ||
630 | NULL); | ||
630 | return; | 631 | return; |
631 | 632 | ||
632 | } | 633 | } |
633 | if (list_attestations) | 634 | if (list_credentials) |
634 | { | 635 | { |
635 | cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); | 636 | cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); |
636 | return; | 637 | return; |
@@ -648,34 +649,34 @@ attest_iter_finished (void *cls) | |||
648 | 649 | ||
649 | 650 | ||
650 | static void | 651 | static void |
651 | attest_iter_cb (void *cls, | 652 | cred_iter_cb (void *cls, |
652 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, | 653 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, |
653 | const struct GNUNET_RECLAIM_Attestation *attest) | 654 | const struct GNUNET_RECLAIM_Credential *cred) |
654 | { | 655 | { |
655 | char *attest_str; | 656 | char *cred_str; |
656 | char *attr_str; | 657 | char *attr_str; |
657 | char *id; | 658 | char *id; |
658 | const char *attest_type; | 659 | const char *cred_type; |
659 | struct GNUNET_RECLAIM_AttributeListEntry *ale; | 660 | struct GNUNET_RECLAIM_AttributeListEntry *ale; |
660 | 661 | ||
661 | if (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (&attestation, | 662 | if (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (&credential, |
662 | &attest->id)) | 663 | &cred->id)) |
663 | attestation_exists = GNUNET_YES; | 664 | credential_exists = GNUNET_YES; |
664 | if (list_attestations) | 665 | if (list_credentials) |
665 | { | 666 | { |
666 | attest_str = GNUNET_RECLAIM_attestation_value_to_string (attest->type, | 667 | cred_str = GNUNET_RECLAIM_credential_value_to_string (cred->type, |
667 | attest->data, | 668 | cred->data, |
668 | attest->data_size); | 669 | cred->data_size); |
669 | attest_type = GNUNET_RECLAIM_attestation_number_to_typename (attest->type); | 670 | cred_type = GNUNET_RECLAIM_credential_number_to_typename (cred->type); |
670 | id = GNUNET_STRINGS_data_to_string_alloc (&attest->id, sizeof(attest->id)); | 671 | id = GNUNET_STRINGS_data_to_string_alloc (&cred->id, sizeof(cred->id)); |
671 | fprintf (stdout, | 672 | fprintf (stdout, |
672 | "%s: ``%s'' (%s); ID: %s\n", | 673 | "%s: ``%s'' (%s); ID: %s\n", |
673 | attest->name, | 674 | cred->name, |
674 | attest_str, | 675 | cred_str, |
675 | attest_type, | 676 | cred_type, |
676 | id); | 677 | id); |
677 | struct GNUNET_RECLAIM_AttributeList *attrs = | 678 | struct GNUNET_RECLAIM_AttributeList *attrs = |
678 | GNUNET_RECLAIM_attestation_get_attributes (attest); | 679 | GNUNET_RECLAIM_credential_get_attributes (cred); |
679 | if (NULL != attrs) | 680 | if (NULL != attrs) |
680 | { | 681 | { |
681 | fprintf (stdout, | 682 | fprintf (stdout, |
@@ -684,11 +685,8 @@ attest_iter_cb (void *cls, | |||
684 | { | 685 | { |
685 | attr_str = GNUNET_RECLAIM_attribute_value_to_string ( | 686 | attr_str = GNUNET_RECLAIM_attribute_value_to_string ( |
686 | ale->attribute->type, | 687 | ale->attribute->type, |
687 | ale->attribute-> | 688 | ale->attribute->data, |
688 | data, | 689 | ale->attribute->data_size); |
689 | ale->attribute-> | ||
690 | data_size); | ||
691 | |||
692 | fprintf (stdout, | 690 | fprintf (stdout, |
693 | "\t %s: %s\n", ale->attribute->name, attr_str); | 691 | "\t %s: %s\n", ale->attribute->name, attr_str); |
694 | GNUNET_free (attr_str); | 692 | GNUNET_free (attr_str); |
@@ -697,7 +695,7 @@ attest_iter_cb (void *cls, | |||
697 | } | 695 | } |
698 | GNUNET_free (id); | 696 | GNUNET_free (id); |
699 | } | 697 | } |
700 | GNUNET_RECLAIM_get_attestations_next (attest_iterator); | 698 | GNUNET_RECLAIM_get_credentials_next (cred_iterator); |
701 | } | 699 | } |
702 | 700 | ||
703 | 701 | ||
@@ -710,12 +708,14 @@ start_process () | |||
710 | cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); | 708 | cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); |
711 | return; | 709 | return; |
712 | } | 710 | } |
713 | attestation = GNUNET_RECLAIM_ID_ZERO; | 711 | if (NULL == credential_type) |
714 | if (NULL != attestation_id) | 712 | credential_type = GNUNET_strdup ("JWT"); |
715 | GNUNET_STRINGS_string_to_data (attestation_id, | 713 | credential = GNUNET_RECLAIM_ID_ZERO; |
716 | strlen (attestation_id), | 714 | if (NULL != credential_id) |
717 | &attestation, sizeof(attestation)); | 715 | GNUNET_STRINGS_string_to_data (credential_id, |
718 | attestation_exists = GNUNET_NO; | 716 | strlen (credential_id), |
717 | &credential, sizeof(credential)); | ||
718 | credential_exists = GNUNET_NO; | ||
719 | if (list_tickets) | 719 | if (list_tickets) |
720 | { | 720 | { |
721 | ticket_iterator = GNUNET_RECLAIM_ticket_iteration_start (reclaim_handle, | 721 | ticket_iterator = GNUNET_RECLAIM_ticket_iteration_start (reclaim_handle, |
@@ -750,15 +750,14 @@ start_process () | |||
750 | 750 | ||
751 | attr_list = GNUNET_new (struct GNUNET_RECLAIM_AttributeList); | 751 | attr_list = GNUNET_new (struct GNUNET_RECLAIM_AttributeList); |
752 | claim = NULL; | 752 | claim = NULL; |
753 | attest_iterator = GNUNET_RECLAIM_get_attestations_start (reclaim_handle, | 753 | cred_iterator = GNUNET_RECLAIM_get_credentials_start (reclaim_handle, |
754 | pkey, | 754 | pkey, |
755 | &iter_error, | 755 | &iter_error, |
756 | NULL, | 756 | NULL, |
757 | &attest_iter_cb, | 757 | &cred_iter_cb, |
758 | NULL, | 758 | NULL, |
759 | & | 759 | &cred_iter_finished, |
760 | attest_iter_finished, | 760 | NULL); |
761 | NULL); | ||
762 | 761 | ||
763 | } | 762 | } |
764 | 763 | ||
@@ -856,20 +855,20 @@ main (int argc, char *const argv[]) | |||
856 | gettext_noop ("List attributes for EGO"), | 855 | gettext_noop ("List attributes for EGO"), |
857 | &list), | 856 | &list), |
858 | GNUNET_GETOPT_option_flag ('A', | 857 | GNUNET_GETOPT_option_flag ('A', |
859 | "attestations", | 858 | "credentials", |
860 | gettext_noop ("List attestations for EGO"), | 859 | gettext_noop ("List credentials for EGO"), |
861 | &list_attestations), | 860 | &list_credentials), |
862 | GNUNET_GETOPT_option_string ('I', | 861 | GNUNET_GETOPT_option_string ('I', |
863 | "Attestation ID", | 862 | "Credential ID", |
864 | "ATTESTATION_ID", | 863 | "CREDENTIAL_ID", |
865 | gettext_noop ( | 864 | gettext_noop ( |
866 | "Attestation to use for attribute"), | 865 | "Credential to use for attribute"), |
867 | &attestation_id), | 866 | &credential_id), |
868 | GNUNET_GETOPT_option_string ('N', | 867 | GNUNET_GETOPT_option_string ('N', |
869 | "attestation-name", | 868 | "credential-name", |
870 | "NAME", | 869 | "NAME", |
871 | gettext_noop ("Attestation name"), | 870 | gettext_noop ("Credential name"), |
872 | &attestation_name), | 871 | &credential_name), |
873 | GNUNET_GETOPT_option_string ('i', | 872 | GNUNET_GETOPT_option_string ('i', |
874 | "issue", | 873 | "issue", |
875 | "A1,A2,...", | 874 | "A1,A2,...", |
@@ -891,6 +890,11 @@ main (int argc, char *const argv[]) | |||
891 | "TYPE", | 890 | "TYPE", |
892 | gettext_noop ("Type of attribute"), | 891 | gettext_noop ("Type of attribute"), |
893 | &type_str), | 892 | &type_str), |
893 | GNUNET_GETOPT_option_string ('u', | ||
894 | "credential-type", | ||
895 | "TYPE", | ||
896 | gettext_noop ("Type of credential"), | ||
897 | &credential_type), | ||
894 | GNUNET_GETOPT_option_flag ('T', | 898 | GNUNET_GETOPT_option_flag ('T', |
895 | "tickets", | 899 | "tickets", |
896 | gettext_noop ("List tickets of ego"), | 900 | gettext_noop ("List tickets of ego"), |
diff --git a/src/reclaim/gnunet-service-reclaim.c b/src/reclaim/gnunet-service-reclaim.c index 84afd482e..30a84b3e8 100644 --- a/src/reclaim/gnunet-service-reclaim.c +++ b/src/reclaim/gnunet-service-reclaim.c | |||
@@ -170,17 +170,17 @@ struct IdpClient | |||
170 | 170 | ||
171 | /** | 171 | /** |
172 | * Head of the DLL of | 172 | * Head of the DLL of |
173 | * Attribute iteration operations in | 173 | * Credential iteration operations in |
174 | * progress initiated by this client | 174 | * progress initiated by this client |
175 | */ | 175 | */ |
176 | struct Iterator *attest_iter_head; | 176 | struct Iterator *cred_iter_head; |
177 | 177 | ||
178 | /** | 178 | /** |
179 | * Tail of the DLL of | 179 | * Tail of the DLL of |
180 | * Attribute iteration operations | 180 | * Credential iteration operations |
181 | * in progress initiated by this client | 181 | * in progress initiated by this client |
182 | */ | 182 | */ |
183 | struct Iterator *attest_iter_tail; | 183 | struct Iterator *cred_iter_tail; |
184 | 184 | ||
185 | /** | 185 | /** |
186 | * Head of DLL of ticket iteration ops | 186 | * Head of DLL of ticket iteration ops |
@@ -285,9 +285,9 @@ struct AttributeDeleteHandle | |||
285 | struct GNUNET_RECLAIM_Attribute *claim; | 285 | struct GNUNET_RECLAIM_Attribute *claim; |
286 | 286 | ||
287 | /** | 287 | /** |
288 | * The attestation to delete | 288 | * The credential to delete |
289 | */ | 289 | */ |
290 | struct GNUNET_RECLAIM_Attestation *attest; | 290 | struct GNUNET_RECLAIM_Credential *credential; |
291 | 291 | ||
292 | /** | 292 | /** |
293 | * Tickets to update | 293 | * Tickets to update |
@@ -352,9 +352,9 @@ struct AttributeStoreHandle | |||
352 | struct GNUNET_RECLAIM_Attribute *claim; | 352 | struct GNUNET_RECLAIM_Attribute *claim; |
353 | 353 | ||
354 | /** | 354 | /** |
355 | * The attestation to store | 355 | * The credential to store |
356 | */ | 356 | */ |
357 | struct GNUNET_RECLAIM_Attestation *attest; | 357 | struct GNUNET_RECLAIM_Credential *credential; |
358 | 358 | ||
359 | /** | 359 | /** |
360 | * The attribute expiration interval | 360 | * The attribute expiration interval |
@@ -488,8 +488,8 @@ cleanup_adh (struct AttributeDeleteHandle *adh) | |||
488 | GNUNET_free (adh->label); | 488 | GNUNET_free (adh->label); |
489 | if (NULL != adh->claim) | 489 | if (NULL != adh->claim) |
490 | GNUNET_free (adh->claim); | 490 | GNUNET_free (adh->claim); |
491 | if (NULL != adh->attest) | 491 | if (NULL != adh->credential) |
492 | GNUNET_free (adh->attest); | 492 | GNUNET_free (adh->credential); |
493 | while (NULL != (le = adh->tickets_to_update_head)) | 493 | while (NULL != (le = adh->tickets_to_update_head)) |
494 | { | 494 | { |
495 | GNUNET_CONTAINER_DLL_remove (adh->tickets_to_update_head, | 495 | GNUNET_CONTAINER_DLL_remove (adh->tickets_to_update_head, |
@@ -517,8 +517,8 @@ cleanup_as_handle (struct AttributeStoreHandle *ash) | |||
517 | GNUNET_NAMESTORE_cancel (ash->ns_qe); | 517 | GNUNET_NAMESTORE_cancel (ash->ns_qe); |
518 | if (NULL != ash->claim) | 518 | if (NULL != ash->claim) |
519 | GNUNET_free (ash->claim); | 519 | GNUNET_free (ash->claim); |
520 | if (NULL != ash->attest) | 520 | if (NULL != ash->credential) |
521 | GNUNET_free (ash->attest); | 521 | GNUNET_free (ash->credential); |
522 | GNUNET_free (ash); | 522 | GNUNET_free (ash); |
523 | } | 523 | } |
524 | 524 | ||
@@ -569,9 +569,9 @@ cleanup_client (struct IdpClient *idp) | |||
569 | GNUNET_CONTAINER_DLL_remove (idp->attr_iter_head, idp->attr_iter_tail, ai); | 569 | GNUNET_CONTAINER_DLL_remove (idp->attr_iter_head, idp->attr_iter_tail, ai); |
570 | GNUNET_free (ai); | 570 | GNUNET_free (ai); |
571 | } | 571 | } |
572 | while (NULL != (ai = idp->attest_iter_head)) | 572 | while (NULL != (ai = idp->cred_iter_head)) |
573 | { | 573 | { |
574 | GNUNET_CONTAINER_DLL_remove (idp->attest_iter_head, idp->attest_iter_tail, | 574 | GNUNET_CONTAINER_DLL_remove (idp->cred_iter_head, idp->cred_iter_tail, |
575 | ai); | 575 | ai); |
576 | GNUNET_free (ai); | 576 | GNUNET_free (ai); |
577 | } | 577 | } |
@@ -847,7 +847,7 @@ static void | |||
847 | consume_result_cb (void *cls, | 847 | consume_result_cb (void *cls, |
848 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, | 848 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, |
849 | const struct GNUNET_RECLAIM_AttributeList *attrs, | 849 | const struct GNUNET_RECLAIM_AttributeList *attrs, |
850 | const struct GNUNET_RECLAIM_AttestationList *attests, | 850 | const struct GNUNET_RECLAIM_PresentationList *presentations, |
851 | int32_t success, | 851 | int32_t success, |
852 | const char *emsg) | 852 | const char *emsg) |
853 | { | 853 | { |
@@ -856,28 +856,28 @@ consume_result_cb (void *cls, | |||
856 | struct GNUNET_MQ_Envelope *env; | 856 | struct GNUNET_MQ_Envelope *env; |
857 | char *data_tmp; | 857 | char *data_tmp; |
858 | size_t attrs_len = 0; | 858 | size_t attrs_len = 0; |
859 | size_t attests_len = 0; | 859 | size_t pres_len = 0; |
860 | 860 | ||
861 | if (GNUNET_OK != success) | 861 | if (GNUNET_OK != success) |
862 | { | 862 | { |
863 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error consuming ticket: %s\n", emsg); | 863 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error consuming ticket: %s\n", emsg); |
864 | } | 864 | } |
865 | attrs_len = GNUNET_RECLAIM_attribute_list_serialize_get_size (attrs); | 865 | attrs_len = GNUNET_RECLAIM_attribute_list_serialize_get_size (attrs); |
866 | attests_len = GNUNET_RECLAIM_attestation_list_serialize_get_size (attests); | 866 | pres_len = GNUNET_RECLAIM_presentation_list_serialize_get_size (presentations); |
867 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 867 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
868 | "Sending CONSUME_TICKET_RESULT message\n"); | 868 | "Sending CONSUME_TICKET_RESULT message\n"); |
869 | env = GNUNET_MQ_msg_extra (crm, | 869 | env = GNUNET_MQ_msg_extra (crm, |
870 | attrs_len + attests_len, | 870 | attrs_len + pres_len, |
871 | GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT); | 871 | GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT); |
872 | crm->id = htonl (cop->r_id); | 872 | crm->id = htonl (cop->r_id); |
873 | crm->attrs_len = htons (attrs_len); | 873 | crm->attrs_len = htons (attrs_len); |
874 | crm->attestations_len = htons (attests_len); | 874 | crm->pres_len = htons (pres_len); |
875 | crm->identity = *identity; | 875 | crm->identity = *identity; |
876 | crm->result = htonl (success); | 876 | crm->result = htonl (success); |
877 | data_tmp = (char *) &crm[1]; | 877 | data_tmp = (char *) &crm[1]; |
878 | GNUNET_RECLAIM_attribute_list_serialize (attrs, data_tmp); | 878 | GNUNET_RECLAIM_attribute_list_serialize (attrs, data_tmp); |
879 | data_tmp += attrs_len; | 879 | data_tmp += attrs_len; |
880 | GNUNET_RECLAIM_attestation_list_serialize (attests, data_tmp); | 880 | GNUNET_RECLAIM_presentation_list_serialize (presentations, data_tmp); |
881 | GNUNET_MQ_send (cop->client->mq, env); | 881 | GNUNET_MQ_send (cop->client->mq, env); |
882 | GNUNET_CONTAINER_DLL_remove (cop->client->consume_op_head, | 882 | GNUNET_CONTAINER_DLL_remove (cop->client->consume_op_head, |
883 | cop->client->consume_op_tail, | 883 | cop->client->consume_op_tail, |
@@ -1075,14 +1075,14 @@ handle_attribute_store_message (void *cls, | |||
1075 | 1075 | ||
1076 | 1076 | ||
1077 | /** | 1077 | /** |
1078 | * Attestation store result handler | 1078 | * Credential store result handler |
1079 | * | 1079 | * |
1080 | * @param cls our attribute store handle | 1080 | * @param cls our attribute store handle |
1081 | * @param success GNUNET_OK if successful | 1081 | * @param success GNUNET_OK if successful |
1082 | * @param emsg error message (NULL if success=GNUNET_OK) | 1082 | * @param emsg error message (NULL if success=GNUNET_OK) |
1083 | */ | 1083 | */ |
1084 | static void | 1084 | static void |
1085 | attest_store_cont (void *cls, int32_t success, const char *emsg) | 1085 | cred_store_cont (void *cls, int32_t success, const char *emsg) |
1086 | { | 1086 | { |
1087 | struct AttributeStoreHandle *ash = cls; | 1087 | struct AttributeStoreHandle *ash = cls; |
1088 | struct GNUNET_MQ_Envelope *env; | 1088 | struct GNUNET_MQ_Envelope *env; |
@@ -1096,7 +1096,7 @@ attest_store_cont (void *cls, int32_t success, const char *emsg) | |||
1096 | if (GNUNET_SYSERR == success) | 1096 | if (GNUNET_SYSERR == success) |
1097 | { | 1097 | { |
1098 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1098 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1099 | "Failed to store attestation %s\n", | 1099 | "Failed to store credential: %s\n", |
1100 | emsg); | 1100 | emsg); |
1101 | cleanup_as_handle (ash); | 1101 | cleanup_as_handle (ash); |
1102 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); | 1102 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); |
@@ -1113,16 +1113,16 @@ attest_store_cont (void *cls, int32_t success, const char *emsg) | |||
1113 | 1113 | ||
1114 | 1114 | ||
1115 | /** | 1115 | /** |
1116 | * Error looking up potential attestation. Abort. | 1116 | * Error looking up potential credential. Abort. |
1117 | * | 1117 | * |
1118 | * @param cls our attribute store handle | 1118 | * @param cls our attribute store handle |
1119 | */ | 1119 | */ |
1120 | static void | 1120 | static void |
1121 | attest_error (void *cls) | 1121 | cred_error (void *cls) |
1122 | { | 1122 | { |
1123 | struct AttributeStoreHandle *ash = cls; | 1123 | struct AttributeStoreHandle *ash = cls; |
1124 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1124 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1125 | "Failed to check for existing Attestation\n"); | 1125 | "Failed to check for existing credential.\n"); |
1126 | cleanup_as_handle (ash); | 1126 | cleanup_as_handle (ash); |
1127 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); | 1127 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); |
1128 | return; | 1128 | return; |
@@ -1130,7 +1130,7 @@ attest_error (void *cls) | |||
1130 | 1130 | ||
1131 | 1131 | ||
1132 | /** | 1132 | /** |
1133 | * Check for existing record before storing attestation | 1133 | * Check for existing record before storing credential |
1134 | * | 1134 | * |
1135 | * @param cls our attribute store handle | 1135 | * @param cls our attribute store handle |
1136 | * @param zone zone we are iterating | 1136 | * @param zone zone we are iterating |
@@ -1139,33 +1139,34 @@ attest_error (void *cls) | |||
1139 | * @param rd records | 1139 | * @param rd records |
1140 | */ | 1140 | */ |
1141 | static void | 1141 | static void |
1142 | attest_add_cb (void *cls, | 1142 | cred_add_cb (void *cls, |
1143 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 1143 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, |
1144 | const char *label, | 1144 | const char *label, |
1145 | unsigned int rd_count, | 1145 | unsigned int rd_count, |
1146 | const struct GNUNET_GNSRECORD_Data *rd) | 1146 | const struct GNUNET_GNSRECORD_Data *rd) |
1147 | { | 1147 | { |
1148 | struct AttributeStoreHandle *ash = cls; | 1148 | struct AttributeStoreHandle *ash = cls; |
1149 | struct GNUNET_GNSRECORD_Data rd_new[1]; | ||
1149 | char *buf; | 1150 | char *buf; |
1150 | size_t buf_size; | 1151 | size_t buf_size; |
1151 | buf_size = GNUNET_RECLAIM_attestation_serialize_get_size (ash->attest); | 1152 | |
1153 | buf_size = GNUNET_RECLAIM_credential_serialize_get_size (ash->credential); | ||
1152 | buf = GNUNET_malloc (buf_size); | 1154 | buf = GNUNET_malloc (buf_size); |
1153 | GNUNET_RECLAIM_attestation_serialize (ash->attest, buf); | 1155 | GNUNET_RECLAIM_presentation_serialize (ash->credential, buf); |
1154 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1156 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1155 | "Storing new Attestation\n"); | 1157 | "Storing new credential under `%s'.\n", |
1156 | struct GNUNET_GNSRECORD_Data rd_new[1]; | 1158 | label); |
1157 | rd_new[0].data_size = buf_size; | 1159 | rd_new[0].data_size = buf_size; |
1158 | rd_new[0].data = buf; | 1160 | rd_new[0].data = buf; |
1159 | rd_new[0].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION; | 1161 | rd_new[0].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL; |
1160 | rd_new[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; | 1162 | rd_new[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; |
1161 | rd_new[0].expiration_time = ash->exp.rel_value_us; | 1163 | rd_new[0].expiration_time = ash->exp.rel_value_us; |
1162 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Encrypting with label %s\n", label); | ||
1163 | ash->ns_qe = GNUNET_NAMESTORE_records_store (nsh, | 1164 | ash->ns_qe = GNUNET_NAMESTORE_records_store (nsh, |
1164 | &ash->identity, | 1165 | &ash->identity, |
1165 | label, | 1166 | label, |
1166 | 1, | 1167 | 1, |
1167 | rd_new, | 1168 | rd_new, |
1168 | &attest_store_cont, | 1169 | &cred_store_cont, |
1169 | ash); | 1170 | ash); |
1170 | GNUNET_free (buf); | 1171 | GNUNET_free (buf); |
1171 | return; | 1172 | return; |
@@ -1173,44 +1174,43 @@ attest_add_cb (void *cls, | |||
1173 | 1174 | ||
1174 | 1175 | ||
1175 | /** | 1176 | /** |
1176 | * Add a new attestation | 1177 | * Add a new credential |
1177 | * | 1178 | * |
1178 | * @param cls the AttributeStoreHandle | 1179 | * @param cls the AttributeStoreHandle |
1179 | */ | 1180 | */ |
1180 | static void | 1181 | static void |
1181 | attest_store_task (void *cls) | 1182 | cred_store_task (void *cls) |
1182 | { | 1183 | { |
1183 | struct AttributeStoreHandle *ash = cls; | 1184 | struct AttributeStoreHandle *ash = cls; |
1184 | char *label; | 1185 | char *label; |
1185 | 1186 | ||
1186 | // Give the ash a new id if unset | 1187 | // Give the ash a new id if unset |
1187 | if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&ash->attest->id)) | 1188 | if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&ash->credential->id)) |
1188 | GNUNET_RECLAIM_id_generate (&ash->attest->id); | 1189 | GNUNET_RECLAIM_id_generate (&ash->credential->id); |
1189 | label = GNUNET_STRINGS_data_to_string_alloc (&ash->attest->id, | 1190 | label = GNUNET_STRINGS_data_to_string_alloc (&ash->credential->id, |
1190 | sizeof (ash->attest->id)); | 1191 | sizeof (ash->credential->id)); |
1191 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1192 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1192 | "Looking up existing data under label %s\n", label); | 1193 | "Looking up existing data under label `%s'\n", label); |
1193 | // Test for the content of the existing ID | ||
1194 | ash->ns_qe = GNUNET_NAMESTORE_records_lookup (nsh, | 1194 | ash->ns_qe = GNUNET_NAMESTORE_records_lookup (nsh, |
1195 | &ash->identity, | 1195 | &ash->identity, |
1196 | label, | 1196 | label, |
1197 | &attest_error, | 1197 | &cred_error, |
1198 | ash, | 1198 | ash, |
1199 | &attest_add_cb, | 1199 | &cred_add_cb, |
1200 | ash); | 1200 | ash); |
1201 | GNUNET_free (label); | 1201 | GNUNET_free (label); |
1202 | } | 1202 | } |
1203 | 1203 | ||
1204 | 1204 | ||
1205 | /** | 1205 | /** |
1206 | * Check an attestation store message | 1206 | * Check an credential store message |
1207 | * | 1207 | * |
1208 | * @param cls unused | 1208 | * @param cls unused |
1209 | * @param sam the message to check | 1209 | * @param sam the message to check |
1210 | */ | 1210 | */ |
1211 | static int | 1211 | static int |
1212 | check_attestation_store_message (void *cls, | 1212 | check_credential_store_message (void *cls, |
1213 | const struct AttributeStoreMessage *sam) | 1213 | const struct AttributeStoreMessage *sam) |
1214 | { | 1214 | { |
1215 | uint16_t size; | 1215 | uint16_t size; |
1216 | 1216 | ||
@@ -1225,26 +1225,26 @@ check_attestation_store_message (void *cls, | |||
1225 | 1225 | ||
1226 | 1226 | ||
1227 | /** | 1227 | /** |
1228 | * Handle an attestation store message | 1228 | * Handle a credential store message |
1229 | * | 1229 | * |
1230 | * @param cls our client | 1230 | * @param cls our client |
1231 | * @param sam the message to handle | 1231 | * @param sam the message to handle |
1232 | */ | 1232 | */ |
1233 | static void | 1233 | static void |
1234 | handle_attestation_store_message (void *cls, | 1234 | handle_credential_store_message (void *cls, |
1235 | const struct AttributeStoreMessage *sam) | 1235 | const struct AttributeStoreMessage *sam) |
1236 | { | 1236 | { |
1237 | struct AttributeStoreHandle *ash; | 1237 | struct AttributeStoreHandle *ash; |
1238 | struct IdpClient *idp = cls; | 1238 | struct IdpClient *idp = cls; |
1239 | size_t data_len; | 1239 | size_t data_len; |
1240 | 1240 | ||
1241 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ATTESTATION_STORE message\n"); | 1241 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CREDENTIAL_STORE message\n"); |
1242 | 1242 | ||
1243 | data_len = ntohs (sam->attr_len); | 1243 | data_len = ntohs (sam->attr_len); |
1244 | 1244 | ||
1245 | ash = GNUNET_new (struct AttributeStoreHandle); | 1245 | ash = GNUNET_new (struct AttributeStoreHandle); |
1246 | ash->attest = GNUNET_RECLAIM_attestation_deserialize ((char *) &sam[1], | 1246 | ash->credential = GNUNET_RECLAIM_credential_deserialize ((char *) &sam[1], |
1247 | data_len); | 1247 | data_len); |
1248 | 1248 | ||
1249 | ash->r_id = ntohl (sam->id); | 1249 | ash->r_id = ntohl (sam->id); |
1250 | ash->identity = sam->identity; | 1250 | ash->identity = sam->identity; |
@@ -1254,7 +1254,7 @@ handle_attestation_store_message (void *cls, | |||
1254 | GNUNET_SERVICE_client_continue (idp->client); | 1254 | GNUNET_SERVICE_client_continue (idp->client); |
1255 | ash->client = idp; | 1255 | ash->client = idp; |
1256 | GNUNET_CONTAINER_DLL_insert (idp->store_op_head, idp->store_op_tail, ash); | 1256 | GNUNET_CONTAINER_DLL_insert (idp->store_op_head, idp->store_op_tail, ash); |
1257 | GNUNET_SCHEDULER_add_now (&attest_store_task, ash); | 1257 | GNUNET_SCHEDULER_add_now (&cred_store_task, ash); |
1258 | } | 1258 | } |
1259 | 1259 | ||
1260 | 1260 | ||
@@ -1310,12 +1310,12 @@ ticket_iter (void *cls, | |||
1310 | if (GNUNET_YES != GNUNET_RECLAIM_id_is_equal (rd[i].data, | 1310 | if (GNUNET_YES != GNUNET_RECLAIM_id_is_equal (rd[i].data, |
1311 | &adh->claim->id)) | 1311 | &adh->claim->id)) |
1312 | continue; | 1312 | continue; |
1313 | if (adh->attest != NULL) | 1313 | if (adh->credential != NULL) |
1314 | if (GNUNET_YES != GNUNET_RECLAIM_id_is_equal (rd[i].data, | 1314 | if (GNUNET_YES != GNUNET_RECLAIM_id_is_equal (rd[i].data, |
1315 | &adh->attest->id)) | 1315 | &adh->credential->id)) |
1316 | continue; | 1316 | continue; |
1317 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1317 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1318 | "Attribute or Attestation to delete found (%s)\n", | 1318 | "Attribute to delete found (%s)\n", |
1319 | adh->label); | 1319 | adh->label); |
1320 | has_changed = GNUNET_YES; | 1320 | has_changed = GNUNET_YES; |
1321 | break; | 1321 | break; |
@@ -1410,10 +1410,10 @@ update_tickets (void *cls) | |||
1410 | && (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (rd[i].data, | 1410 | && (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (rd[i].data, |
1411 | &adh->claim->id))) | 1411 | &adh->claim->id))) |
1412 | continue; | 1412 | continue; |
1413 | if (adh->attest != NULL) | 1413 | if (adh->credential != NULL) |
1414 | if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF == rd[i].record_type) | 1414 | if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF == rd[i].record_type) |
1415 | && (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (rd[i].data, | 1415 | && (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (rd[i].data, |
1416 | &adh->attest->id))) | 1416 | &adh->credential->id))) |
1417 | continue; | 1417 | continue; |
1418 | rd_new[j] = rd[i]; | 1418 | rd_new[j] = rd[i]; |
1419 | j++; | 1419 | j++; |
@@ -1557,7 +1557,7 @@ handle_attribute_delete_message (void *cls, | |||
1557 | GNUNET_RECLAIM_attribute_deserialize ((char *) &dam[1], | 1557 | GNUNET_RECLAIM_attribute_deserialize ((char *) &dam[1], |
1558 | data_len, | 1558 | data_len, |
1559 | &adh->claim); | 1559 | &adh->claim); |
1560 | adh->attest = NULL; | 1560 | adh->credential = NULL; |
1561 | 1561 | ||
1562 | adh->r_id = ntohl (dam->id); | 1562 | adh->r_id = ntohl (dam->id); |
1563 | adh->identity = dam->identity; | 1563 | adh->identity = dam->identity; |
@@ -1578,14 +1578,14 @@ handle_attribute_delete_message (void *cls, | |||
1578 | 1578 | ||
1579 | 1579 | ||
1580 | /** | 1580 | /** |
1581 | * Attestation deleted callback | 1581 | * Credential deleted callback |
1582 | * | 1582 | * |
1583 | * @param cls our handle | 1583 | * @param cls our handle |
1584 | * @param success success status | 1584 | * @param success success status |
1585 | * @param emsg error message (NULL if success=GNUNET_OK) | 1585 | * @param emsg error message (NULL if success=GNUNET_OK) |
1586 | */ | 1586 | */ |
1587 | static void | 1587 | static void |
1588 | attest_delete_cont (void *cls, int32_t success, const char *emsg) | 1588 | cred_delete_cont (void *cls, int32_t success, const char *emsg) |
1589 | { | 1589 | { |
1590 | struct AttributeDeleteHandle *adh = cls; | 1590 | struct AttributeDeleteHandle *adh = cls; |
1591 | 1591 | ||
@@ -1593,7 +1593,7 @@ attest_delete_cont (void *cls, int32_t success, const char *emsg) | |||
1593 | if (GNUNET_SYSERR == success) | 1593 | if (GNUNET_SYSERR == success) |
1594 | { | 1594 | { |
1595 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1595 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1596 | "Error deleting attestation %s\n", | 1596 | "Error deleting credential `%s'\n", |
1597 | adh->label); | 1597 | adh->label); |
1598 | send_delete_response (adh, GNUNET_SYSERR); | 1598 | send_delete_response (adh, GNUNET_SYSERR); |
1599 | cleanup_adh (adh); | 1599 | cleanup_adh (adh); |
@@ -1605,13 +1605,13 @@ attest_delete_cont (void *cls, int32_t success, const char *emsg) | |||
1605 | 1605 | ||
1606 | 1606 | ||
1607 | /** | 1607 | /** |
1608 | * Check attestation delete message format | 1608 | * Check credential delete message format |
1609 | * | 1609 | * |
1610 | * @cls unused | 1610 | * @cls unused |
1611 | * @dam message to check | 1611 | * @dam message to check |
1612 | */ | 1612 | */ |
1613 | static int | 1613 | static int |
1614 | check_attestation_delete_message (void *cls, | 1614 | check_cred_delete_message (void *cls, |
1615 | const struct AttributeDeleteMessage *dam) | 1615 | const struct AttributeDeleteMessage *dam) |
1616 | { | 1616 | { |
1617 | uint16_t size; | 1617 | uint16_t size; |
@@ -1627,33 +1627,33 @@ check_attestation_delete_message (void *cls, | |||
1627 | 1627 | ||
1628 | 1628 | ||
1629 | /** | 1629 | /** |
1630 | * Handle attestation deletion | 1630 | * Handle credential deletion |
1631 | * | 1631 | * |
1632 | * @param cls our client | 1632 | * @param cls our client |
1633 | * @param dam deletion message | 1633 | * @param dam deletion message |
1634 | */ | 1634 | */ |
1635 | static void | 1635 | static void |
1636 | handle_attestation_delete_message (void *cls, | 1636 | handle_credential_delete_message (void *cls, |
1637 | const struct AttributeDeleteMessage *dam) | 1637 | const struct AttributeDeleteMessage *dam) |
1638 | { | 1638 | { |
1639 | struct AttributeDeleteHandle *adh; | 1639 | struct AttributeDeleteHandle *adh; |
1640 | struct IdpClient *idp = cls; | 1640 | struct IdpClient *idp = cls; |
1641 | size_t data_len; | 1641 | size_t data_len; |
1642 | 1642 | ||
1643 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ATTESTATION_DELETE message\n"); | 1643 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CREDENTIAL_DELETE message\n"); |
1644 | 1644 | ||
1645 | data_len = ntohs (dam->attr_len); | 1645 | data_len = ntohs (dam->attr_len); |
1646 | 1646 | ||
1647 | adh = GNUNET_new (struct AttributeDeleteHandle); | 1647 | adh = GNUNET_new (struct AttributeDeleteHandle); |
1648 | adh->attest = GNUNET_RECLAIM_attestation_deserialize ((char *) &dam[1], | 1648 | adh->credential = GNUNET_RECLAIM_credential_deserialize ((char *) &dam[1], |
1649 | data_len); | 1649 | data_len); |
1650 | adh->claim = NULL; | 1650 | adh->claim = NULL; |
1651 | 1651 | ||
1652 | adh->r_id = ntohl (dam->id); | 1652 | adh->r_id = ntohl (dam->id); |
1653 | adh->identity = dam->identity; | 1653 | adh->identity = dam->identity; |
1654 | adh->label | 1654 | adh->label |
1655 | = GNUNET_STRINGS_data_to_string_alloc (&adh->attest->id, | 1655 | = GNUNET_STRINGS_data_to_string_alloc (&adh->credential->id, |
1656 | sizeof(adh->attest->id)); | 1656 | sizeof(adh->credential->id)); |
1657 | GNUNET_SERVICE_client_continue (idp->client); | 1657 | GNUNET_SERVICE_client_continue (idp->client); |
1658 | adh->client = idp; | 1658 | adh->client = idp; |
1659 | GNUNET_CONTAINER_DLL_insert (idp->delete_op_head, idp->delete_op_tail, adh); | 1659 | GNUNET_CONTAINER_DLL_insert (idp->delete_op_head, idp->delete_op_tail, adh); |
@@ -1662,7 +1662,7 @@ handle_attestation_delete_message (void *cls, | |||
1662 | adh->label, | 1662 | adh->label, |
1663 | 0, | 1663 | 0, |
1664 | NULL, | 1664 | NULL, |
1665 | &attest_delete_cont, | 1665 | &cred_delete_cont, |
1666 | adh); | 1666 | adh); |
1667 | } | 1667 | } |
1668 | 1668 | ||
@@ -1712,7 +1712,7 @@ attr_iter_error (void *cls) | |||
1712 | 1712 | ||
1713 | 1713 | ||
1714 | /** | 1714 | /** |
1715 | * Got record. Return if it is an attribute or attestation. | 1715 | * Got record. Return if it is an attribute. |
1716 | * | 1716 | * |
1717 | * @param cls our attribute iterator | 1717 | * @param cls our attribute iterator |
1718 | * @param zone zone we are iterating | 1718 | * @param zone zone we are iterating |
@@ -1852,51 +1852,51 @@ handle_iteration_next (void *cls, | |||
1852 | 1852 | ||
1853 | 1853 | ||
1854 | /************************************************* | 1854 | /************************************************* |
1855 | * Attestation iteration | 1855 | * Credential iteration |
1856 | *************************************************/ | 1856 | *************************************************/ |
1857 | 1857 | ||
1858 | 1858 | ||
1859 | /** | 1859 | /** |
1860 | * Done iterating over attestations | 1860 | * Done iterating over credentials |
1861 | * | 1861 | * |
1862 | * @param cls our iterator handle | 1862 | * @param cls our iterator handle |
1863 | */ | 1863 | */ |
1864 | static void | 1864 | static void |
1865 | attest_iter_finished (void *cls) | 1865 | cred_iter_finished (void *cls) |
1866 | { | 1866 | { |
1867 | struct Iterator *ai = cls; | 1867 | struct Iterator *ai = cls; |
1868 | struct GNUNET_MQ_Envelope *env; | 1868 | struct GNUNET_MQ_Envelope *env; |
1869 | struct AttestationResultMessage *arm; | 1869 | struct CredentialResultMessage *arm; |
1870 | 1870 | ||
1871 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending ATTESTATION_RESULT message\n"); | 1871 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending CREDENTIAL_RESULT message\n"); |
1872 | env = GNUNET_MQ_msg (arm, GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT); | 1872 | env = GNUNET_MQ_msg (arm, GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_RESULT); |
1873 | arm->id = htonl (ai->request_id); | 1873 | arm->id = htonl (ai->request_id); |
1874 | arm->attestation_len = htons (0); | 1874 | arm->credential_len = htons (0); |
1875 | GNUNET_MQ_send (ai->client->mq, env); | 1875 | GNUNET_MQ_send (ai->client->mq, env); |
1876 | GNUNET_CONTAINER_DLL_remove (ai->client->attest_iter_head, | 1876 | GNUNET_CONTAINER_DLL_remove (ai->client->cred_iter_head, |
1877 | ai->client->attest_iter_tail, | 1877 | ai->client->cred_iter_tail, |
1878 | ai); | 1878 | ai); |
1879 | GNUNET_free (ai); | 1879 | GNUNET_free (ai); |
1880 | } | 1880 | } |
1881 | 1881 | ||
1882 | 1882 | ||
1883 | /** | 1883 | /** |
1884 | * Error iterating over attestations. Abort. | 1884 | * Error iterating over credentials. Abort. |
1885 | * | 1885 | * |
1886 | * @param cls our attribute iteration handle | 1886 | * @param cls our attribute iteration handle |
1887 | */ | 1887 | */ |
1888 | static void | 1888 | static void |
1889 | attest_iter_error (void *cls) | 1889 | cred_iter_error (void *cls) |
1890 | { | 1890 | { |
1891 | struct Iterator *ai = cls; | 1891 | struct Iterator *ai = cls; |
1892 | 1892 | ||
1893 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to iterate over attestations\n"); | 1893 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to iterate over credentials\n"); |
1894 | attest_iter_finished (ai); | 1894 | cred_iter_finished (ai); |
1895 | } | 1895 | } |
1896 | 1896 | ||
1897 | 1897 | ||
1898 | /** | 1898 | /** |
1899 | * Got record. Return attestation. | 1899 | * Got record. Return credential. |
1900 | * | 1900 | * |
1901 | * @param cls our attribute iterator | 1901 | * @param cls our attribute iterator |
1902 | * @param zone zone we are iterating | 1902 | * @param zone zone we are iterating |
@@ -1905,32 +1905,32 @@ attest_iter_error (void *cls) | |||
1905 | * @param rd records | 1905 | * @param rd records |
1906 | */ | 1906 | */ |
1907 | static void | 1907 | static void |
1908 | attest_iter_cb (void *cls, | 1908 | cred_iter_cb (void *cls, |
1909 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 1909 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, |
1910 | const char *label, | 1910 | const char *label, |
1911 | unsigned int rd_count, | 1911 | unsigned int rd_count, |
1912 | const struct GNUNET_GNSRECORD_Data *rd) | 1912 | const struct GNUNET_GNSRECORD_Data *rd) |
1913 | { | 1913 | { |
1914 | struct Iterator *ai = cls; | 1914 | struct Iterator *ai = cls; |
1915 | struct GNUNET_MQ_Envelope *env; | 1915 | struct GNUNET_MQ_Envelope *env; |
1916 | struct AttestationResultMessage *arm; | 1916 | struct CredentialResultMessage *arm; |
1917 | char *data_tmp; | 1917 | char *data_tmp; |
1918 | 1918 | ||
1919 | if ((rd_count != 1) || | 1919 | if ((rd_count != 1) || |
1920 | (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION != rd->record_type)) | 1920 | (GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL != rd->record_type)) |
1921 | { | 1921 | { |
1922 | GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1); | 1922 | GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1); |
1923 | return; | 1923 | return; |
1924 | } | 1924 | } |
1925 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attestation under: %s\n", | 1925 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found credential under: %s\n", |
1926 | label); | 1926 | label); |
1927 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1927 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1928 | "Sending ATTESTATION_RESULT message\n"); | 1928 | "Sending CREDENTIAL_RESULT message\n"); |
1929 | env = GNUNET_MQ_msg_extra (arm, | 1929 | env = GNUNET_MQ_msg_extra (arm, |
1930 | rd->data_size, | 1930 | rd->data_size, |
1931 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT); | 1931 | GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_RESULT); |
1932 | arm->id = htonl (ai->request_id); | 1932 | arm->id = htonl (ai->request_id); |
1933 | arm->attestation_len = htons (rd->data_size); | 1933 | arm->credential_len = htons (rd->data_size); |
1934 | GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity); | 1934 | GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity); |
1935 | data_tmp = (char *) &arm[1]; | 1935 | data_tmp = (char *) &arm[1]; |
1936 | GNUNET_memcpy (data_tmp, rd->data, rd->data_size); | 1936 | GNUNET_memcpy (data_tmp, rd->data, rd->data_size); |
@@ -1946,29 +1946,29 @@ attest_iter_cb (void *cls, | |||
1946 | * @param ais_msg the iteration message to start | 1946 | * @param ais_msg the iteration message to start |
1947 | */ | 1947 | */ |
1948 | static void | 1948 | static void |
1949 | handle_attestation_iteration_start (void *cls, | 1949 | handle_credential_iteration_start (void *cls, |
1950 | const struct | 1950 | const struct |
1951 | AttestationIterationStartMessage *ais_msg) | 1951 | CredentialIterationStartMessage *ais_msg) |
1952 | { | 1952 | { |
1953 | struct IdpClient *idp = cls; | 1953 | struct IdpClient *idp = cls; |
1954 | struct Iterator *ai; | 1954 | struct Iterator *ai; |
1955 | 1955 | ||
1956 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1956 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1957 | "Received ATTESTATION_ITERATION_START message\n"); | 1957 | "Received CREDENTIAL_ITERATION_START message\n"); |
1958 | ai = GNUNET_new (struct Iterator); | 1958 | ai = GNUNET_new (struct Iterator); |
1959 | ai->request_id = ntohl (ais_msg->id); | 1959 | ai->request_id = ntohl (ais_msg->id); |
1960 | ai->client = idp; | 1960 | ai->client = idp; |
1961 | ai->identity = ais_msg->identity; | 1961 | ai->identity = ais_msg->identity; |
1962 | 1962 | ||
1963 | GNUNET_CONTAINER_DLL_insert (idp->attest_iter_head, idp->attest_iter_tail, | 1963 | GNUNET_CONTAINER_DLL_insert (idp->cred_iter_head, idp->cred_iter_tail, |
1964 | ai); | 1964 | ai); |
1965 | ai->ns_it = GNUNET_NAMESTORE_zone_iteration_start (nsh, | 1965 | ai->ns_it = GNUNET_NAMESTORE_zone_iteration_start (nsh, |
1966 | &ai->identity, | 1966 | &ai->identity, |
1967 | &attest_iter_error, | 1967 | &cred_iter_error, |
1968 | ai, | 1968 | ai, |
1969 | &attest_iter_cb, | 1969 | &cred_iter_cb, |
1970 | ai, | 1970 | ai, |
1971 | &attest_iter_finished, | 1971 | &cred_iter_finished, |
1972 | ai); | 1972 | ai); |
1973 | GNUNET_SERVICE_client_continue (idp->client); | 1973 | GNUNET_SERVICE_client_continue (idp->client); |
1974 | } | 1974 | } |
@@ -1981,9 +1981,9 @@ handle_attestation_iteration_start (void *cls, | |||
1981 | * @param ais_msg the stop message | 1981 | * @param ais_msg the stop message |
1982 | */ | 1982 | */ |
1983 | static void | 1983 | static void |
1984 | handle_attestation_iteration_stop (void *cls, | 1984 | handle_credential_iteration_stop (void *cls, |
1985 | const struct | 1985 | const struct |
1986 | AttestationIterationStopMessage *ais_msg) | 1986 | CredentialIterationStopMessage *ais_msg) |
1987 | { | 1987 | { |
1988 | struct IdpClient *idp = cls; | 1988 | struct IdpClient *idp = cls; |
1989 | struct Iterator *ai; | 1989 | struct Iterator *ai; |
@@ -1991,9 +1991,9 @@ handle_attestation_iteration_stop (void *cls, | |||
1991 | 1991 | ||
1992 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1992 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1993 | "Received `%s' message\n", | 1993 | "Received `%s' message\n", |
1994 | "ATTESTATION_ITERATION_STOP"); | 1994 | "CREDENTIAL_ITERATION_STOP"); |
1995 | rid = ntohl (ais_msg->id); | 1995 | rid = ntohl (ais_msg->id); |
1996 | for (ai = idp->attest_iter_head; NULL != ai; ai = ai->next) | 1996 | for (ai = idp->cred_iter_head; NULL != ai; ai = ai->next) |
1997 | if (ai->request_id == rid) | 1997 | if (ai->request_id == rid) |
1998 | break; | 1998 | break; |
1999 | if (NULL == ai) | 1999 | if (NULL == ai) |
@@ -2002,7 +2002,7 @@ handle_attestation_iteration_stop (void *cls, | |||
2002 | GNUNET_SERVICE_client_drop (idp->client); | 2002 | GNUNET_SERVICE_client_drop (idp->client); |
2003 | return; | 2003 | return; |
2004 | } | 2004 | } |
2005 | GNUNET_CONTAINER_DLL_remove (idp->attest_iter_head, idp->attest_iter_tail, | 2005 | GNUNET_CONTAINER_DLL_remove (idp->cred_iter_head, idp->cred_iter_tail, |
2006 | ai); | 2006 | ai); |
2007 | GNUNET_free (ai); | 2007 | GNUNET_free (ai); |
2008 | GNUNET_SERVICE_client_continue (idp->client); | 2008 | GNUNET_SERVICE_client_continue (idp->client); |
@@ -2010,24 +2010,24 @@ handle_attestation_iteration_stop (void *cls, | |||
2010 | 2010 | ||
2011 | 2011 | ||
2012 | /** | 2012 | /** |
2013 | * Client requests next attestation from iterator | 2013 | * Client requests next credential from iterator |
2014 | * | 2014 | * |
2015 | * @param cls the client | 2015 | * @param cls the client |
2016 | * @param ais_msg the message | 2016 | * @param ais_msg the message |
2017 | */ | 2017 | */ |
2018 | static void | 2018 | static void |
2019 | handle_attestation_iteration_next (void *cls, | 2019 | handle_credential_iteration_next (void *cls, |
2020 | const struct | 2020 | const struct |
2021 | AttestationIterationNextMessage *ais_msg) | 2021 | CredentialIterationNextMessage *ais_msg) |
2022 | { | 2022 | { |
2023 | struct IdpClient *idp = cls; | 2023 | struct IdpClient *idp = cls; |
2024 | struct Iterator *ai; | 2024 | struct Iterator *ai; |
2025 | uint32_t rid; | 2025 | uint32_t rid; |
2026 | 2026 | ||
2027 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2027 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2028 | "Received ATTESTATION_ITERATION_NEXT message\n"); | 2028 | "Received CREDENTIAL_ITERATION_NEXT message\n"); |
2029 | rid = ntohl (ais_msg->id); | 2029 | rid = ntohl (ais_msg->id); |
2030 | for (ai = idp->attest_iter_head; NULL != ai; ai = ai->next) | 2030 | for (ai = idp->cred_iter_head; NULL != ai; ai = ai->next) |
2031 | if (ai->request_id == rid) | 2031 | if (ai->request_id == rid) |
2032 | break; | 2032 | break; |
2033 | if (NULL == ai) | 2033 | if (NULL == ai) |
@@ -2269,16 +2269,16 @@ GNUNET_SERVICE_MAIN ( | |||
2269 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE, | 2269 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE, |
2270 | struct AttributeStoreMessage, | 2270 | struct AttributeStoreMessage, |
2271 | NULL), | 2271 | NULL), |
2272 | GNUNET_MQ_hd_var_size (attestation_store_message, | 2272 | GNUNET_MQ_hd_var_size (credential_store_message, |
2273 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_STORE, | 2273 | GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_STORE, |
2274 | struct AttributeStoreMessage, | 2274 | struct AttributeStoreMessage, |
2275 | NULL), | 2275 | NULL), |
2276 | GNUNET_MQ_hd_var_size (attribute_delete_message, | 2276 | GNUNET_MQ_hd_var_size (attribute_delete_message, |
2277 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE, | 2277 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE, |
2278 | struct AttributeDeleteMessage, | 2278 | struct AttributeDeleteMessage, |
2279 | NULL), | 2279 | NULL), |
2280 | GNUNET_MQ_hd_var_size (attestation_delete_message, | 2280 | GNUNET_MQ_hd_var_size (credential_delete_message, |
2281 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_DELETE, | 2281 | GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_DELETE, |
2282 | struct AttributeDeleteMessage, | 2282 | struct AttributeDeleteMessage, |
2283 | NULL), | 2283 | NULL), |
2284 | GNUNET_MQ_hd_fixed_size (iteration_start, | 2284 | GNUNET_MQ_hd_fixed_size (iteration_start, |
@@ -2293,17 +2293,17 @@ GNUNET_SERVICE_MAIN ( | |||
2293 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP, | 2293 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP, |
2294 | struct AttributeIterationStopMessage, | 2294 | struct AttributeIterationStopMessage, |
2295 | NULL), | 2295 | NULL), |
2296 | GNUNET_MQ_hd_fixed_size (attestation_iteration_start, | 2296 | GNUNET_MQ_hd_fixed_size (credential_iteration_start, |
2297 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_START, | 2297 | GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_START, |
2298 | struct AttestationIterationStartMessage, | 2298 | struct CredentialIterationStartMessage, |
2299 | NULL), | 2299 | NULL), |
2300 | GNUNET_MQ_hd_fixed_size (attestation_iteration_next, | 2300 | GNUNET_MQ_hd_fixed_size (credential_iteration_next, |
2301 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_NEXT, | 2301 | GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_NEXT, |
2302 | struct AttestationIterationNextMessage, | 2302 | struct CredentialIterationNextMessage, |
2303 | NULL), | 2303 | NULL), |
2304 | GNUNET_MQ_hd_fixed_size (attestation_iteration_stop, | 2304 | GNUNET_MQ_hd_fixed_size (credential_iteration_stop, |
2305 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_STOP, | 2305 | GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_STOP, |
2306 | struct AttestationIterationStopMessage, | 2306 | struct CredentialIterationStopMessage, |
2307 | NULL), | 2307 | NULL), |
2308 | 2308 | ||
2309 | GNUNET_MQ_hd_var_size (issue_ticket_message, | 2309 | GNUNET_MQ_hd_var_size (issue_ticket_message, |
diff --git a/src/reclaim/gnunet-service-reclaim_tickets.c b/src/reclaim/gnunet-service-reclaim_tickets.c index af01d8ec7..18b173aaa 100644 --- a/src/reclaim/gnunet-service-reclaim_tickets.c +++ b/src/reclaim/gnunet-service-reclaim_tickets.c | |||
@@ -114,9 +114,9 @@ struct RECLAIM_TICKETS_ConsumeHandle | |||
114 | struct GNUNET_RECLAIM_AttributeList *attrs; | 114 | struct GNUNET_RECLAIM_AttributeList *attrs; |
115 | 115 | ||
116 | /** | 116 | /** |
117 | * Attestations | 117 | * Credentials |
118 | */ | 118 | */ |
119 | struct GNUNET_RECLAIM_AttestationList *attests; | 119 | struct GNUNET_RECLAIM_CredentialList *credentials; |
120 | 120 | ||
121 | /** | 121 | /** |
122 | * Lookup time | 122 | * Lookup time |
@@ -715,20 +715,20 @@ rvk_move_attr_cb (void *cls, | |||
715 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute %s\n", new_label); | 715 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute %s\n", new_label); |
716 | GNUNET_free (claim); | 716 | GNUNET_free (claim); |
717 | } | 717 | } |
718 | else if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION == rd[i].record_type) | 718 | else if (GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL == rd[i].record_type) |
719 | { | 719 | { |
720 | struct GNUNET_RECLAIM_Attestation *attest; | 720 | struct GNUNET_RECLAIM_Credential *credential; |
721 | attest = GNUNET_RECLAIM_attestation_deserialize (rd[i].data, | 721 | credential = GNUNET_RECLAIM_credential_deserialize (rd[i].data, |
722 | rd[i].data_size); | 722 | rd[i].data_size); |
723 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 723 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
724 | "Attestation to update: Name=%s\n", | 724 | "Credential to update: Name=%s\n", |
725 | attest->name); | 725 | credential->name); |
726 | attest->id = rvk->move_attr->new_id; | 726 | credential->id = rvk->move_attr->new_id; |
727 | new_rd[i].data_size = | 727 | new_rd[i].data_size = |
728 | GNUNET_RECLAIM_attestation_serialize_get_size (attest); | 728 | GNUNET_RECLAIM_credential_serialize_get_size (credential); |
729 | attr_data = GNUNET_malloc (rd[i].data_size); | 729 | attr_data = GNUNET_malloc (rd[i].data_size); |
730 | new_rd[i].data_size = GNUNET_RECLAIM_attestation_serialize (attest, | 730 | new_rd[i].data_size = GNUNET_RECLAIM_credential_serialize (credential, |
731 | attr_data); | 731 | attr_data); |
732 | new_rd[i].data = attr_data; | 732 | new_rd[i].data = attr_data; |
733 | new_rd[i].record_type = rd[i].record_type; | 733 | new_rd[i].record_type = rd[i].record_type; |
734 | new_rd[i].flags = rd[i].flags; | 734 | new_rd[i].flags = rd[i].flags; |
@@ -736,9 +736,9 @@ rvk_move_attr_cb (void *cls, | |||
736 | new_label = | 736 | new_label = |
737 | GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->new_id, | 737 | GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->new_id, |
738 | sizeof (rvk->move_attr->new_id)); | 738 | sizeof (rvk->move_attr->new_id)); |
739 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attestation %s\n", | 739 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding credential %s\n", |
740 | new_label); | 740 | new_label); |
741 | GNUNET_free (attest); | 741 | GNUNET_free (credential); |
742 | } | 742 | } |
743 | } | 743 | } |
744 | rvk->ns_qe = GNUNET_NAMESTORE_records_store (nsh, | 744 | rvk->ns_qe = GNUNET_NAMESTORE_records_store (nsh, |
@@ -981,8 +981,8 @@ cleanup_cth (struct RECLAIM_TICKETS_ConsumeHandle *cth) | |||
981 | 981 | ||
982 | if (NULL != cth->attrs) | 982 | if (NULL != cth->attrs) |
983 | GNUNET_RECLAIM_attribute_list_destroy (cth->attrs); | 983 | GNUNET_RECLAIM_attribute_list_destroy (cth->attrs); |
984 | if (NULL != cth->attests) | 984 | if (NULL != cth->credentials) |
985 | GNUNET_RECLAIM_attestation_list_destroy (cth->attests); | 985 | GNUNET_RECLAIM_credential_list_destroy (cth->credentials); |
986 | GNUNET_free (cth); | 986 | GNUNET_free (cth); |
987 | } | 987 | } |
988 | 988 | ||
@@ -1027,40 +1027,20 @@ process_parallel_lookup_result (void *cls, | |||
1027 | // REMARK: It is possible now to find rd_count > 1 | 1027 | // REMARK: It is possible now to find rd_count > 1 |
1028 | for (int i = 0; i < rd_count; i++) | 1028 | for (int i = 0; i < rd_count; i++) |
1029 | { | 1029 | { |
1030 | if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE == rd[i].record_type) | 1030 | if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE != rd[i].record_type) |
1031 | { | ||
1032 | attr_le = GNUNET_new (struct GNUNET_RECLAIM_AttributeListEntry); | ||
1033 | GNUNET_RECLAIM_attribute_deserialize (rd[i].data, rd[i].data_size, | ||
1034 | &attr_le->attribute); | ||
1035 | GNUNET_CONTAINER_DLL_insert (cth->attrs->list_head, | ||
1036 | cth->attrs->list_tail, | ||
1037 | attr_le); | ||
1038 | } | ||
1039 | else if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION == rd[i].record_type) | ||
1040 | { | ||
1041 | struct GNUNET_RECLAIM_AttestationListEntry *ale; | ||
1042 | ale = GNUNET_new (struct GNUNET_RECLAIM_AttestationListEntry); | ||
1043 | ale->attestation = | ||
1044 | GNUNET_RECLAIM_attestation_deserialize (rd[i].data, | ||
1045 | rd[i].data_size); | ||
1046 | GNUNET_CONTAINER_DLL_insert (cth->attests->list_head, | ||
1047 | cth->attests->list_tail, | ||
1048 | ale); | ||
1049 | } | ||
1050 | else | ||
1051 | { | ||
1052 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1053 | "Parallel Lookup of Reference without Attestation"); | ||
1054 | continue; | 1031 | continue; |
1055 | } | 1032 | attr_le = GNUNET_new (struct GNUNET_RECLAIM_AttributeListEntry); |
1056 | 1033 | GNUNET_RECLAIM_attribute_deserialize (rd[i].data, rd[i].data_size, | |
1057 | 1034 | &attr_le->attribute); | |
1035 | GNUNET_CONTAINER_DLL_insert (cth->attrs->list_head, | ||
1036 | cth->attrs->list_tail, | ||
1037 | attr_le); | ||
1058 | } | 1038 | } |
1059 | if (NULL != cth->parallel_lookups_head) | 1039 | if (NULL != cth->parallel_lookups_head) |
1060 | return; // Wait for more | 1040 | return; // Wait for more |
1061 | /* Else we are done */ | 1041 | /* Else we are done */ |
1062 | cth->cb (cth->cb_cls, &cth->ticket.identity, | 1042 | cth->cb (cth->cb_cls, &cth->ticket.identity, |
1063 | cth->attrs, cth->attests, GNUNET_OK, NULL); | 1043 | cth->attrs, cth->credentials, GNUNET_OK, NULL); |
1064 | cleanup_cth (cth); | 1044 | cleanup_cth (cth); |
1065 | } | 1045 | } |
1066 | 1046 | ||
@@ -1126,26 +1106,45 @@ lookup_authz_cb (void *cls, | |||
1126 | 1106 | ||
1127 | for (int i = 0; i < rd_count; i++) | 1107 | for (int i = 0; i < rd_count; i++) |
1128 | { | 1108 | { |
1129 | if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF != rd[i].record_type) && | 1109 | /** |
1130 | (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION_REF != rd[i].record_type)) | 1110 | * Check if record is a credential presentation or an attribute |
1131 | continue; | 1111 | * reference. |
1132 | lbl = GNUNET_STRINGS_data_to_string_alloc (rd[i].data, rd[i].data_size); | 1112 | */ |
1133 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ticket reference found %s\n", lbl); | 1113 | switch (rd[i].record_type) |
1134 | parallel_lookup = GNUNET_new (struct ParallelLookup); | 1114 | { |
1135 | parallel_lookup->handle = cth; | 1115 | case GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION: |
1136 | parallel_lookup->label = lbl; | 1116 | struct GNUNET_RECLAIM_CredentialListEntry *ale; |
1137 | parallel_lookup->lookup_start_time = GNUNET_TIME_absolute_get (); | 1117 | ale = GNUNET_new (struct GNUNET_RECLAIM_CredentialListEntry); |
1138 | parallel_lookup->lookup_request = | 1118 | ale->credential = |
1139 | GNUNET_GNS_lookup (gns, | 1119 | GNUNET_RECLAIM_credential_deserialize (rd[i].data, |
1140 | lbl, | 1120 | rd[i].data_size); |
1141 | &cth->ticket.identity, | 1121 | GNUNET_CONTAINER_DLL_insert (cth->credentials->list_head, |
1142 | GNUNET_GNSRECORD_TYPE_ANY, | 1122 | cth->credentials->list_tail, |
1143 | GNUNET_GNS_LO_DEFAULT, | 1123 | ale); |
1144 | &process_parallel_lookup_result, | 1124 | break; |
1145 | parallel_lookup); | 1125 | case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF: |
1146 | GNUNET_CONTAINER_DLL_insert (cth->parallel_lookups_head, | 1126 | lbl = GNUNET_STRINGS_data_to_string_alloc (rd[i].data, rd[i].data_size); |
1147 | cth->parallel_lookups_tail, | 1127 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Ticket reference found %s\n", lbl); |
1148 | parallel_lookup); | 1128 | parallel_lookup = GNUNET_new (struct ParallelLookup); |
1129 | parallel_lookup->handle = cth; | ||
1130 | parallel_lookup->label = lbl; | ||
1131 | parallel_lookup->lookup_start_time = GNUNET_TIME_absolute_get (); | ||
1132 | parallel_lookup->lookup_request = | ||
1133 | GNUNET_GNS_lookup (gns, | ||
1134 | lbl, | ||
1135 | &cth->ticket.identity, | ||
1136 | GNUNET_GNSRECORD_TYPE_ANY, | ||
1137 | GNUNET_GNS_LO_DEFAULT, | ||
1138 | &process_parallel_lookup_result, | ||
1139 | parallel_lookup); | ||
1140 | GNUNET_CONTAINER_DLL_insert (cth->parallel_lookups_head, | ||
1141 | cth->parallel_lookups_tail, | ||
1142 | parallel_lookup); | ||
1143 | break; | ||
1144 | default: | ||
1145 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1146 | "Ignoring unknown record type %d", rd[i].record_type); | ||
1147 | } | ||
1149 | } | 1148 | } |
1150 | /** | 1149 | /** |
1151 | * We started lookups. Add a timeout task. | 1150 | * We started lookups. Add a timeout task. |
@@ -1163,7 +1162,7 @@ lookup_authz_cb (void *cls, | |||
1163 | * No references found, return empty attribute list | 1162 | * No references found, return empty attribute list |
1164 | */ | 1163 | */ |
1165 | cth->cb (cth->cb_cls, &cth->ticket.identity, | 1164 | cth->cb (cth->cb_cls, &cth->ticket.identity, |
1166 | cth->attrs, cth->attests, GNUNET_OK, NULL); | 1165 | cth->attrs, cth->credentials, GNUNET_OK, NULL); |
1167 | cleanup_cth (cth); | 1166 | cleanup_cth (cth); |
1168 | } | 1167 | } |
1169 | 1168 | ||
@@ -1193,7 +1192,7 @@ RECLAIM_TICKETS_consume (const struct GNUNET_CRYPTO_EcdsaPrivateKey *id, | |||
1193 | cth->identity = *id; | 1192 | cth->identity = *id; |
1194 | GNUNET_CRYPTO_ecdsa_key_get_public (&cth->identity, &cth->identity_pub); | 1193 | GNUNET_CRYPTO_ecdsa_key_get_public (&cth->identity, &cth->identity_pub); |
1195 | cth->attrs = GNUNET_new (struct GNUNET_RECLAIM_AttributeList); | 1194 | cth->attrs = GNUNET_new (struct GNUNET_RECLAIM_AttributeList); |
1196 | cth->attests = GNUNET_new (struct GNUNET_RECLAIM_AttestationList); | 1195 | cth->credentials = GNUNET_new (struct GNUNET_RECLAIM_CredentialList); |
1197 | cth->ticket = *ticket; | 1196 | cth->ticket = *ticket; |
1198 | cth->cb = cb; | 1197 | cth->cb = cb; |
1199 | cth->cb_cls = cb_cls; | 1198 | cth->cb_cls = cb_cls; |
@@ -1293,7 +1292,7 @@ issue_ticket (struct TicketIssueHandle *ih) | |||
1293 | for (le = ih->attrs->list_head; NULL != le; le = le->next) | 1292 | for (le = ih->attrs->list_head; NULL != le; le = le->next) |
1294 | attrs_count++; | 1293 | attrs_count++; |
1295 | 1294 | ||
1296 | // Worst case we have one attestation per attribute | 1295 | // Worst case we have one credential per attribute |
1297 | attrs_record = | 1296 | attrs_record = |
1298 | GNUNET_malloc (2 * attrs_count * sizeof(struct GNUNET_GNSRECORD_Data)); | 1297 | GNUNET_malloc (2 * attrs_count * sizeof(struct GNUNET_GNSRECORD_Data)); |
1299 | i = 0; | 1298 | i = 0; |
@@ -1308,26 +1307,31 @@ issue_ticket (struct TicketIssueHandle *ih) | |||
1308 | attrs_record[i].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF; | 1307 | attrs_record[i].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF; |
1309 | attrs_record[i].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; | 1308 | attrs_record[i].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; |
1310 | i++; | 1309 | i++; |
1311 | if (GNUNET_NO == GNUNET_RECLAIM_id_is_zero (&le->attribute->attestation)) | 1310 | if (GNUNET_NO == GNUNET_RECLAIM_id_is_zero (&le->attribute->credential)) |
1312 | { | 1311 | { |
1312 | struct GNUNET_RECLAIM_Presentation *pres; | ||
1313 | int j; | 1313 | int j; |
1314 | for (j = 0; j < i; j++) | 1314 | for (j = 0; j < i; j++) |
1315 | { | 1315 | { |
1316 | if (attrs_record[j].record_type | 1316 | if (attrs_record[j].record_type |
1317 | != GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION_REF) | 1317 | != GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION) |
1318 | continue; | 1318 | continue; |
1319 | if (0 == memcmp (attrs_record[j].data, | 1319 | pres = attrs_record[j].data; |
1320 | &le->attribute->attestation, | 1320 | if (0 == memcmp (pres->credential_id, |
1321 | sizeof (le->attribute->attestation))) | 1321 | &le->attribute->credential, |
1322 | sizeof (le->attribute->credential))) | ||
1322 | break; | 1323 | break; |
1323 | } | 1324 | } |
1324 | if (j < i) | 1325 | if (j < i) |
1325 | continue; // Skip as we have already added this attestation. | 1326 | continue; // Skip as we have already added this credential presentation. |
1326 | attrs_record[i].data = &le->attribute->attestation; | 1327 | /** |
1327 | attrs_record[i].data_size = sizeof(le->attribute->attestation); | 1328 | * FIXME: Create a new presentation from the credential. |
1329 | */ | ||
1330 | attrs_record[i].data = &le->attribute->credential; | ||
1331 | attrs_record[i].data_size = sizeof(le->attribute->credential); | ||
1328 | attrs_record[i].expiration_time = ticket_refresh_interval.rel_value_us; | 1332 | attrs_record[i].expiration_time = ticket_refresh_interval.rel_value_us; |
1329 | attrs_record[i].record_type = | 1333 | attrs_record[i].record_type = |
1330 | GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION_REF; | 1334 | GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION; |
1331 | attrs_record[i].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; | 1335 | attrs_record[i].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; |
1332 | i++; | 1336 | i++; |
1333 | } | 1337 | } |
@@ -1401,22 +1405,23 @@ filter_tickets_cb (void *cls, | |||
1401 | { | 1405 | { |
1402 | struct TicketIssueHandle *tih = cls; | 1406 | struct TicketIssueHandle *tih = cls; |
1403 | struct GNUNET_RECLAIM_Ticket *ticket = NULL; | 1407 | struct GNUNET_RECLAIM_Ticket *ticket = NULL; |
1408 | struct GNUNET_RECLAIM_Presentation *pres; | ||
1404 | 1409 | ||
1405 | // figure out the number of requested attributes | 1410 | // figure out the number of requested attributes |
1406 | struct GNUNET_RECLAIM_AttributeListEntry *le; | 1411 | struct GNUNET_RECLAIM_AttributeListEntry *le; |
1407 | unsigned int attr_cnt = 0; | 1412 | unsigned int attr_cnt = 0; |
1408 | unsigned int attest_cnt = 0; | 1413 | unsigned int cred_cnt = 0; |
1409 | 1414 | ||
1410 | for (le = tih->attrs->list_head; NULL != le; le = le->next) | 1415 | for (le = tih->attrs->list_head; NULL != le; le = le->next) |
1411 | { | 1416 | { |
1412 | attr_cnt++; | 1417 | attr_cnt++; |
1413 | if (GNUNET_NO == GNUNET_RECLAIM_id_is_zero (&le->attribute->attestation)) | 1418 | if (GNUNET_NO == GNUNET_RECLAIM_id_is_zero (&le->attribute->credential)) |
1414 | attest_cnt++; | 1419 | pres_cnt++; |
1415 | } | 1420 | } |
1416 | 1421 | ||
1417 | // ticket search | 1422 | // ticket search |
1418 | unsigned int found_attrs_cnt = 0; | 1423 | unsigned int found_attrs_cnt = 0; |
1419 | unsigned int found_attests_cnt = 0; | 1424 | unsigned int found_pres_cnt = 0; |
1420 | 1425 | ||
1421 | for (int i = 0; i < rd_count; i++) | 1426 | for (int i = 0; i < rd_count; i++) |
1422 | { | 1427 | { |
@@ -1436,20 +1441,25 @@ filter_tickets_cb (void *cls, | |||
1436 | } | 1441 | } |
1437 | 1442 | ||
1438 | // cmp requested attributes with ticket attributes | 1443 | // cmp requested attributes with ticket attributes |
1439 | if ((GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF != rd[i].record_type) && | 1444 | if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF == rd[i].record_type) |
1440 | (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION_REF != rd[i].record_type)) | ||
1441 | continue; | ||
1442 | for (le = tih->attrs->list_head; NULL != le; le = le->next) | ||
1443 | { | 1445 | { |
1444 | if (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (rd[i].data, | 1446 | for (le = tih->attrs->list_head; NULL != le; le = le->next) |
1445 | &le->attribute->id)) | 1447 | { |
1446 | found_attrs_cnt++; | 1448 | if (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (rd[i].data, |
1449 | &le->attribute->id)) | ||
1450 | found_attrs_cnt++; | ||
1451 | } | ||
1447 | } | 1452 | } |
1448 | for (le = tih->attrs->list_head; NULL != le; le = le->next) | 1453 | if (GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION == rd[i].record_type) |
1449 | { | 1454 | { |
1450 | if (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (rd[i].data, | 1455 | for (le = tih->attrs->list_head; NULL != le; le = le->next) |
1451 | &le->attribute->attestation)) | 1456 | { |
1452 | found_attests_cnt++; | 1457 | pres = rd[i].data; |
1458 | if (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (pres->credential_id, | ||
1459 | &le->attribute->credential)) | ||
1460 | found_pres_cnt++; | ||
1461 | // FIXME should we store credentials here for later use?? | ||
1462 | } | ||
1453 | } | 1463 | } |
1454 | } | 1464 | } |
1455 | 1465 | ||
@@ -1458,7 +1468,7 @@ filter_tickets_cb (void *cls, | |||
1458 | * we are done. | 1468 | * we are done. |
1459 | */ | 1469 | */ |
1460 | if ((attr_cnt == found_attrs_cnt) && | 1470 | if ((attr_cnt == found_attrs_cnt) && |
1461 | (attest_cnt == found_attests_cnt) && | 1471 | (pres_cnt == found_pres_cnt) && |
1462 | (NULL != ticket)) | 1472 | (NULL != ticket)) |
1463 | { | 1473 | { |
1464 | GNUNET_NAMESTORE_zone_iteration_stop (tih->ns_it); | 1474 | GNUNET_NAMESTORE_zone_iteration_stop (tih->ns_it); |
diff --git a/src/reclaim/gnunet-service-reclaim_tickets.h b/src/reclaim/gnunet-service-reclaim_tickets.h index 1c7214d42..404b9c837 100644 --- a/src/reclaim/gnunet-service-reclaim_tickets.h +++ b/src/reclaim/gnunet-service-reclaim_tickets.h | |||
@@ -137,7 +137,7 @@ typedef void (*RECLAIM_TICKETS_ConsumeCallback) ( | |||
137 | void *cls, | 137 | void *cls, |
138 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, | 138 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, |
139 | const struct GNUNET_RECLAIM_AttributeList *attributes, | 139 | const struct GNUNET_RECLAIM_AttributeList *attributes, |
140 | const struct GNUNET_RECLAIM_AttestationList *attestations, | 140 | const struct GNUNET_RECLAIM_CredentialList *credentials, |
141 | int32_t success, | 141 | int32_t success, |
142 | const char *emsg); | 142 | const char *emsg); |
143 | 143 | ||
diff --git a/src/reclaim/json_reclaim.c b/src/reclaim/json_reclaim.c index c470ea567..c8b944326 100644 --- a/src/reclaim/json_reclaim.c +++ b/src/reclaim/json_reclaim.c | |||
@@ -46,7 +46,7 @@ parse_attr (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec) | |||
46 | const char *val_str = NULL; | 46 | const char *val_str = NULL; |
47 | const char *type_str = NULL; | 47 | const char *type_str = NULL; |
48 | const char *id_str = NULL; | 48 | const char *id_str = NULL; |
49 | const char *attest_str = NULL; | 49 | const char *cred_str = NULL; |
50 | const char *flag_str = NULL; | 50 | const char *flag_str = NULL; |
51 | char *data; | 51 | char *data; |
52 | int unpack_state; | 52 | int unpack_state; |
@@ -68,8 +68,8 @@ parse_attr (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec) | |||
68 | &name_str, | 68 | &name_str, |
69 | "id", | 69 | "id", |
70 | &id_str, | 70 | &id_str, |
71 | "attestation", | 71 | "credential", |
72 | &attest_str, | 72 | &cred_str, |
73 | "type", | 73 | "type", |
74 | &type_str, | 74 | &type_str, |
75 | "value", | 75 | "value", |
@@ -95,12 +95,12 @@ parse_attr (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec) | |||
95 | } | 95 | } |
96 | attr = GNUNET_RECLAIM_attribute_new (name_str, NULL, | 96 | attr = GNUNET_RECLAIM_attribute_new (name_str, NULL, |
97 | type, data, data_size); | 97 | type, data, data_size); |
98 | if ((NULL != attest_str) && (0 != strlen (attest_str))) | 98 | if ((NULL != cred_str) && (0 != strlen (cred_str))) |
99 | { | 99 | { |
100 | GNUNET_STRINGS_string_to_data (attest_str, | 100 | GNUNET_STRINGS_string_to_data (cred_str, |
101 | strlen (attest_str), | 101 | strlen (cred_str), |
102 | &attr->attestation, | 102 | &attr->credential, |
103 | sizeof(attr->attestation)); | 103 | sizeof(attr->credential)); |
104 | } | 104 | } |
105 | if ((NULL == id_str) || (0 == strlen (id_str))) | 105 | if ((NULL == id_str) || (0 == strlen (id_str))) |
106 | memset (&attr->id, 0, sizeof (attr->id)); | 106 | memset (&attr->id, 0, sizeof (attr->id)); |
@@ -142,7 +142,7 @@ clean_attr (void *cls, struct GNUNET_JSON_Specification *spec) | |||
142 | * @return JSON Specification | 142 | * @return JSON Specification |
143 | */ | 143 | */ |
144 | struct GNUNET_JSON_Specification | 144 | struct GNUNET_JSON_Specification |
145 | GNUNET_RECLAIM_JSON_spec_claim (struct GNUNET_RECLAIM_Attribute **attr) | 145 | GNUNET_RECLAIM_JSON_spec_attribute (struct GNUNET_RECLAIM_Attribute **attr) |
146 | { | 146 | { |
147 | struct GNUNET_JSON_Specification ret = { .parser = &parse_attr, | 147 | struct GNUNET_JSON_Specification ret = { .parser = &parse_attr, |
148 | .cleaner = &clean_attr, | 148 | .cleaner = &clean_attr, |
@@ -279,7 +279,7 @@ GNUNET_RECLAIM_JSON_spec_ticket (struct GNUNET_RECLAIM_Ticket **ticket) | |||
279 | 279 | ||
280 | 280 | ||
281 | /** | 281 | /** |
282 | * Parse given JSON object to an attestation claim | 282 | * Parse given JSON object to a credential claim |
283 | * | 283 | * |
284 | * @param cls closure, NULL | 284 | * @param cls closure, NULL |
285 | * @param root the json object representing data | 285 | * @param root the json object representing data |
@@ -287,9 +287,9 @@ GNUNET_RECLAIM_JSON_spec_ticket (struct GNUNET_RECLAIM_Ticket **ticket) | |||
287 | * @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error | 287 | * @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error |
288 | */ | 288 | */ |
289 | static int | 289 | static int |
290 | parse_attest (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec) | 290 | parse_credential (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec) |
291 | { | 291 | { |
292 | struct GNUNET_RECLAIM_Attestation *attr; | 292 | struct GNUNET_RECLAIM_Credential *cred; |
293 | const char *name_str = NULL; | 293 | const char *name_str = NULL; |
294 | const char *val_str = NULL; | 294 | const char *val_str = NULL; |
295 | const char *type_str = NULL; | 295 | const char *type_str = NULL; |
@@ -325,17 +325,17 @@ parse_attest (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec) | |||
325 | "Error json object has a wrong format!\n"); | 325 | "Error json object has a wrong format!\n"); |
326 | return GNUNET_SYSERR; | 326 | return GNUNET_SYSERR; |
327 | } | 327 | } |
328 | type = GNUNET_RECLAIM_attestation_typename_to_number (type_str); | 328 | type = GNUNET_RECLAIM_credential_typename_to_number (type_str); |
329 | if (GNUNET_SYSERR == | 329 | if (GNUNET_SYSERR == |
330 | (GNUNET_RECLAIM_attestation_string_to_value (type, | 330 | (GNUNET_RECLAIM_credential_string_to_value (type, |
331 | val_str, | 331 | val_str, |
332 | (void **) &data, | 332 | (void **) &data, |
333 | &data_size))) | 333 | &data_size))) |
334 | { | 334 | { |
335 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Attestation value invalid!\n"); | 335 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Credential value invalid!\n"); |
336 | return GNUNET_SYSERR; | 336 | return GNUNET_SYSERR; |
337 | } | 337 | } |
338 | attr = GNUNET_RECLAIM_attestation_new (name_str, type, data, data_size); | 338 | attr = GNUNET_RECLAIM_credential_new (name_str, type, data, data_size); |
339 | if ((NULL == id_str) || (0 == strlen (id_str))) | 339 | if ((NULL == id_str) || (0 == strlen (id_str))) |
340 | memset (&attr->id, 0, sizeof (attr->id)); | 340 | memset (&attr->id, 0, sizeof (attr->id)); |
341 | else | 341 | else |
@@ -344,7 +344,7 @@ parse_attest (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec) | |||
344 | &attr->id, | 344 | &attr->id, |
345 | sizeof(attr->id)); | 345 | sizeof(attr->id)); |
346 | 346 | ||
347 | *(struct GNUNET_RECLAIM_Attestation **) spec->ptr = attr; | 347 | *(struct GNUNET_RECLAIM_Credential **) spec->ptr = attr; |
348 | return GNUNET_OK; | 348 | return GNUNET_OK; |
349 | } | 349 | } |
350 | 350 | ||
@@ -356,11 +356,11 @@ parse_attest (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec) | |||
356 | * @param[out] spec where to free the data | 356 | * @param[out] spec where to free the data |
357 | */ | 357 | */ |
358 | static void | 358 | static void |
359 | clean_attest (void *cls, struct GNUNET_JSON_Specification *spec) | 359 | clean_credential (void *cls, struct GNUNET_JSON_Specification *spec) |
360 | { | 360 | { |
361 | struct GNUNET_RECLAIM_Attestation **attr; | 361 | struct GNUNET_RECLAIM_Credential **attr; |
362 | 362 | ||
363 | attr = (struct GNUNET_RECLAIM_Attestation **) spec->ptr; | 363 | attr = (struct GNUNET_RECLAIM_Credential **) spec->ptr; |
364 | if (NULL != *attr) | 364 | if (NULL != *attr) |
365 | { | 365 | { |
366 | GNUNET_free (*attr); | 366 | GNUNET_free (*attr); |
@@ -370,23 +370,23 @@ clean_attest (void *cls, struct GNUNET_JSON_Specification *spec) | |||
370 | 370 | ||
371 | 371 | ||
372 | /** | 372 | /** |
373 | * JSON Specification for Reclaim attestation claims. | 373 | * JSON Specification for credential claims. |
374 | * | 374 | * |
375 | * @param ticket struct of GNUNET_RECLAIM_ATTESTATION_Claim to fill | 375 | * @param attr struct of GNUNET_RECLAIM_Credential to fill |
376 | * @return JSON Specification | 376 | * @return JSON Specification |
377 | */ | 377 | */ |
378 | struct GNUNET_JSON_Specification | 378 | struct GNUNET_JSON_Specification |
379 | GNUNET_RECLAIM_JSON_spec_claim_attest (struct | 379 | GNUNET_RECLAIM_JSON_spec_credential (struct |
380 | GNUNET_RECLAIM_Attestation **attr) | 380 | GNUNET_RECLAIM_Credential **cred) |
381 | { | 381 | { |
382 | struct GNUNET_JSON_Specification ret = { .parser = &parse_attest, | 382 | struct GNUNET_JSON_Specification ret = { .parser = &parse_credential, |
383 | .cleaner = &clean_attest, | 383 | .cleaner = &clean_credential, |
384 | .cls = NULL, | 384 | .cls = NULL, |
385 | .field = NULL, | 385 | .field = NULL, |
386 | .ptr = attr, | 386 | .ptr = attr, |
387 | .ptr_size = 0, | 387 | .ptr_size = 0, |
388 | .size_ptr = NULL }; | 388 | .size_ptr = NULL }; |
389 | 389 | ||
390 | *attr = NULL; | 390 | *cred = NULL; |
391 | return ret; | 391 | return ret; |
392 | } | 392 | } |
diff --git a/src/reclaim/json_reclaim.h b/src/reclaim/json_reclaim.h index c57971dcb..8911cf92d 100644 --- a/src/reclaim/json_reclaim.h +++ b/src/reclaim/json_reclaim.h | |||
@@ -32,11 +32,11 @@ | |||
32 | /** | 32 | /** |
33 | * JSON Specification for Reclaim claims. | 33 | * JSON Specification for Reclaim claims. |
34 | * | 34 | * |
35 | * @param ticket struct of GNUNET_RECLAIM_ATTRIBUTE_Claim to fill | 35 | * @param attr struct of GNUNET_RECLAIM_Attribute to fill |
36 | * @return JSON Specification | 36 | * @return JSON Specification |
37 | */ | 37 | */ |
38 | struct GNUNET_JSON_Specification | 38 | struct GNUNET_JSON_Specification |
39 | GNUNET_RECLAIM_JSON_spec_claim (struct GNUNET_RECLAIM_Attribute **attr); | 39 | GNUNET_RECLAIM_JSON_spec_attribute (struct GNUNET_RECLAIM_Attribute **attr); |
40 | 40 | ||
41 | /** | 41 | /** |
42 | * JSON Specification for Reclaim tickets. | 42 | * JSON Specification for Reclaim tickets. |
@@ -48,11 +48,10 @@ struct GNUNET_JSON_Specification | |||
48 | GNUNET_RECLAIM_JSON_spec_ticket (struct GNUNET_RECLAIM_Ticket **ticket); | 48 | GNUNET_RECLAIM_JSON_spec_ticket (struct GNUNET_RECLAIM_Ticket **ticket); |
49 | 49 | ||
50 | /** | 50 | /** |
51 | * JSON Specification for Reclaim attestation claims. | 51 | * JSON Specification for credentials. |
52 | * | 52 | * |
53 | * @param ticket struct of GNUNET_RECLAIM_Attestation to fill | 53 | * @param cred struct of GNUNET_RECLAIM_Credential to fill |
54 | * @return JSON Specification | 54 | * @return JSON Specification |
55 | */ | 55 | */ |
56 | struct GNUNET_JSON_Specification | 56 | struct GNUNET_JSON_Specification |
57 | GNUNET_RECLAIM_JSON_spec_claim_attest (struct | 57 | GNUNET_RECLAIM_JSON_spec_credential (struct GNUNET_RECLAIM_Attestation **cred); |
58 | GNUNET_RECLAIM_Attestation **attr); | ||
diff --git a/src/reclaim/oidc_helper.c b/src/reclaim/oidc_helper.c index eab12db33..9c7e79c41 100644 --- a/src/reclaim/oidc_helper.c +++ b/src/reclaim/oidc_helper.c | |||
@@ -62,9 +62,9 @@ struct OIDC_Parameters | |||
62 | uint32_t attr_list_len GNUNET_PACKED; | 62 | uint32_t attr_list_len GNUNET_PACKED; |
63 | 63 | ||
64 | /** | 64 | /** |
65 | * The length of the attestation list | 65 | * The length of the presentation list |
66 | */ | 66 | */ |
67 | uint32_t attest_list_len GNUNET_PACKED; | 67 | uint32_t pres_list_len GNUNET_PACKED; |
68 | }; | 68 | }; |
69 | 69 | ||
70 | GNUNET_NETWORK_STRUCT_END | 70 | GNUNET_NETWORK_STRUCT_END |
@@ -157,24 +157,24 @@ fix_base64 (char *str) | |||
157 | static json_t* | 157 | static json_t* |
158 | generate_userinfo_json(const struct GNUNET_CRYPTO_EcdsaPublicKey *sub_key, | 158 | generate_userinfo_json(const struct GNUNET_CRYPTO_EcdsaPublicKey *sub_key, |
159 | struct GNUNET_RECLAIM_AttributeList *attrs, | 159 | struct GNUNET_RECLAIM_AttributeList *attrs, |
160 | struct GNUNET_RECLAIM_AttestationList *attests) | 160 | struct GNUNET_RECLAIM_PresentationList *presentations) |
161 | { | 161 | { |
162 | struct GNUNET_RECLAIM_AttributeListEntry *le; | 162 | struct GNUNET_RECLAIM_AttributeListEntry *le; |
163 | struct GNUNET_RECLAIM_AttestationListEntry *ale; | 163 | struct GNUNET_RECLAIM_PresentationListEntry *ple; |
164 | char *subject; | 164 | char *subject; |
165 | char *source_name; | 165 | char *source_name; |
166 | char *attr_val_str; | 166 | char *attr_val_str; |
167 | char *attest_val_str; | 167 | char *pres_val_str; |
168 | json_t *body; | 168 | json_t *body; |
169 | json_t *aggr_names; | 169 | json_t *aggr_names; |
170 | json_t *aggr_sources; | 170 | json_t *aggr_sources; |
171 | json_t *aggr_sources_jwt; | 171 | json_t *aggr_sources_jwt; |
172 | json_t *addr_claim = NULL; | 172 | json_t *addr_claim = NULL; |
173 | int num_attestations = 0; | 173 | int num_presentations = 0; |
174 | for (le = attrs->list_head; NULL != le; le = le->next) | 174 | for (le = attrs->list_head; NULL != le; le = le->next) |
175 | { | 175 | { |
176 | if (GNUNET_NO == GNUNET_RECLAIM_id_is_zero (&le->attribute->attestation)) | 176 | if (GNUNET_NO == GNUNET_RECLAIM_id_is_zero (&le->attribute->credential)) |
177 | num_attestations++; | 177 | num_presentations++; |
178 | } | 178 | } |
179 | 179 | ||
180 | subject = | 180 | subject = |
@@ -191,23 +191,25 @@ generate_userinfo_json(const struct GNUNET_CRYPTO_EcdsaPublicKey *sub_key, | |||
191 | json_object_set_new (body, "iss", json_string (SERVER_ADDRESS)); | 191 | json_object_set_new (body, "iss", json_string (SERVER_ADDRESS)); |
192 | // sub REQUIRED public key identity, not exceed 255 ASCII length | 192 | // sub REQUIRED public key identity, not exceed 255 ASCII length |
193 | json_object_set_new (body, "sub", json_string (subject)); | 193 | json_object_set_new (body, "sub", json_string (subject)); |
194 | attest_val_str = NULL; | 194 | pres_val_str = NULL; |
195 | source_name = NULL; | 195 | source_name = NULL; |
196 | int i = 0; | 196 | int i = 0; |
197 | for (ale = attests->list_head; NULL != ale; ale = ale->next) | 197 | for (ple = presentations->list_head; NULL != ple; ple = ple->next) |
198 | { | 198 | { |
199 | // New Attestation | 199 | // New presentation |
200 | GNUNET_asprintf (&source_name, | 200 | GNUNET_asprintf (&source_name, |
201 | "src%d", | 201 | "src%d", |
202 | i); | 202 | i); |
203 | aggr_sources_jwt = json_object (); | 203 | aggr_sources_jwt = json_object (); |
204 | attest_val_str = | 204 | pres_val_str = |
205 | GNUNET_RECLAIM_attestation_value_to_string (ale->attestation->type, | 205 | GNUNET_RECLAIM_presentation_value_to_string (ple->presentation->type, |
206 | ale->attestation->data, | 206 | ple->presentation->data, |
207 | ale->attestation->data_size); | 207 | ple->presentation->data_size); |
208 | json_object_set_new (aggr_sources_jwt, "JWT", | 208 | json_object_set_new (aggr_sources_jwt, |
209 | json_string (attest_val_str) ); | 209 | GNUNET_RECLAIM_presentation_number_to_typename (ple->presentation->type), |
210 | json_string (pres_val_str) ); | ||
210 | json_object_set_new (aggr_sources, source_name, aggr_sources_jwt); | 211 | json_object_set_new (aggr_sources, source_name, aggr_sources_jwt); |
212 | GNUNET_free (pres_val_str); | ||
211 | GNUNET_free (source_name); | 213 | GNUNET_free (source_name); |
212 | source_name = NULL; | 214 | source_name = NULL; |
213 | i++; | 215 | i++; |
@@ -216,7 +218,7 @@ generate_userinfo_json(const struct GNUNET_CRYPTO_EcdsaPublicKey *sub_key, | |||
216 | for (le = attrs->list_head; NULL != le; le = le->next) | 218 | for (le = attrs->list_head; NULL != le; le = le->next) |
217 | { | 219 | { |
218 | 220 | ||
219 | if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&le->attribute->attestation)) | 221 | if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&le->attribute->credential)) |
220 | { | 222 | { |
221 | 223 | ||
222 | attr_val_str = | 224 | attr_val_str = |
@@ -247,18 +249,24 @@ generate_userinfo_json(const struct GNUNET_CRYPTO_EcdsaPublicKey *sub_key, | |||
247 | } | 249 | } |
248 | else | 250 | else |
249 | { | 251 | { |
250 | // Check if attest is there | 252 | // Check if presentation is there |
251 | int j = 0; | 253 | int j = 0; |
252 | for (ale = attests->list_head; NULL != ale; ale = ale->next) | 254 | for (ple = presentations->list_head; NULL != ple; ple = ple->next) |
253 | { | 255 | { |
254 | if (GNUNET_YES == | 256 | if (GNUNET_YES == |
255 | GNUNET_RECLAIM_id_is_equal (&ale->attestation->id, | 257 | GNUNET_RECLAIM_id_is_equal (&ple->presentation->credential_id, |
256 | &le->attribute->attestation)) | 258 | &le->attribute->credential)) |
257 | break; | 259 | break; |
258 | j++; | 260 | j++; |
259 | } | 261 | } |
260 | GNUNET_assert (NULL != ale); | 262 | if (NULL == ple) |
261 | // Attestation is existing, hence take the respective source str | 263 | { |
264 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
265 | "Presentation for `%s' missing...\n", | ||
266 | le->attribute->name); | ||
267 | continue; | ||
268 | } | ||
269 | // Presentation exists, hence take the respective source str | ||
262 | GNUNET_asprintf (&source_name, | 270 | GNUNET_asprintf (&source_name, |
263 | "src%d", | 271 | "src%d", |
264 | j); | 272 | j); |
@@ -269,9 +277,6 @@ generate_userinfo_json(const struct GNUNET_CRYPTO_EcdsaPublicKey *sub_key, | |||
269 | } | 277 | } |
270 | if (NULL != addr_claim) | 278 | if (NULL != addr_claim) |
271 | json_object_set_new (body, "address", addr_claim); | 279 | json_object_set_new (body, "address", addr_claim); |
272 | |||
273 | if (NULL != attest_val_str) | ||
274 | GNUNET_free (attest_val_str); | ||
275 | if (0 != i) | 280 | if (0 != i) |
276 | { | 281 | { |
277 | json_object_set_new (body, "_claim_names", aggr_names); | 282 | json_object_set_new (body, "_claim_names", aggr_names); |
@@ -286,18 +291,18 @@ generate_userinfo_json(const struct GNUNET_CRYPTO_EcdsaPublicKey *sub_key, | |||
286 | * | 291 | * |
287 | * @param sub_key the subject (user) | 292 | * @param sub_key the subject (user) |
288 | * @param attrs user attribute list | 293 | * @param attrs user attribute list |
289 | * @param attests user attribute attestation list (may be empty) | 294 | * @param presentations credential presentation list (may be empty) |
290 | * @return Userinfo JSON | 295 | * @return Userinfo JSON |
291 | */ | 296 | */ |
292 | char * | 297 | char * |
293 | OIDC_generate_userinfo (const struct GNUNET_CRYPTO_EcdsaPublicKey *sub_key, | 298 | OIDC_generate_userinfo (const struct GNUNET_CRYPTO_EcdsaPublicKey *sub_key, |
294 | struct GNUNET_RECLAIM_AttributeList *attrs, | 299 | struct GNUNET_RECLAIM_AttributeList *attrs, |
295 | struct GNUNET_RECLAIM_AttestationList *attests) | 300 | struct GNUNET_RECLAIM_PresentationList *presentations) |
296 | { | 301 | { |
297 | char *body_str; | 302 | char *body_str; |
298 | json_t* body = generate_userinfo_json (sub_key, | 303 | json_t* body = generate_userinfo_json (sub_key, |
299 | attrs, | 304 | attrs, |
300 | attests); | 305 | presentations); |
301 | body_str = json_dumps (body, JSON_INDENT (0) | JSON_COMPACT); | 306 | body_str = json_dumps (body, JSON_INDENT (0) | JSON_COMPACT); |
302 | json_decref (body); | 307 | json_decref (body); |
303 | return body_str; | 308 | return body_str; |
@@ -310,6 +315,7 @@ OIDC_generate_userinfo (const struct GNUNET_CRYPTO_EcdsaPublicKey *sub_key, | |||
310 | * @param aud_key the public of the audience | 315 | * @param aud_key the public of the audience |
311 | * @param sub_key the public key of the subject | 316 | * @param sub_key the public key of the subject |
312 | * @param attrs the attribute list | 317 | * @param attrs the attribute list |
318 | * @param presentations credential presentation list (may be empty) | ||
313 | * @param expiration_time the validity of the token | 319 | * @param expiration_time the validity of the token |
314 | * @param secret_key the key used to sign the JWT | 320 | * @param secret_key the key used to sign the JWT |
315 | * @return a new base64-encoded JWT string. | 321 | * @return a new base64-encoded JWT string. |
@@ -318,7 +324,7 @@ char * | |||
318 | OIDC_generate_id_token (const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key, | 324 | OIDC_generate_id_token (const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key, |
319 | const struct GNUNET_CRYPTO_EcdsaPublicKey *sub_key, | 325 | const struct GNUNET_CRYPTO_EcdsaPublicKey *sub_key, |
320 | struct GNUNET_RECLAIM_AttributeList *attrs, | 326 | struct GNUNET_RECLAIM_AttributeList *attrs, |
321 | struct GNUNET_RECLAIM_AttestationList *attests, | 327 | struct GNUNET_RECLAIM_PresentationList *presentations, |
322 | const struct GNUNET_TIME_Relative *expiration_time, | 328 | const struct GNUNET_TIME_Relative *expiration_time, |
323 | const char *nonce, | 329 | const char *nonce, |
324 | const char *secret_key) | 330 | const char *secret_key) |
@@ -339,7 +345,7 @@ OIDC_generate_id_token (const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key, | |||
339 | 345 | ||
340 | body = generate_userinfo_json (sub_key, | 346 | body = generate_userinfo_json (sub_key, |
341 | attrs, | 347 | attrs, |
342 | attests); | 348 | presentations); |
343 | // iat REQUIRED time now | 349 | // iat REQUIRED time now |
344 | time_now = GNUNET_TIME_absolute_get (); | 350 | time_now = GNUNET_TIME_absolute_get (); |
345 | // exp REQUIRED time expired from config | 351 | // exp REQUIRED time expired from config |
@@ -426,6 +432,7 @@ OIDC_generate_id_token (const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key, | |||
426 | * @param issuer the issuer of the ticket, used to sign the ticket and nonce | 432 | * @param issuer the issuer of the ticket, used to sign the ticket and nonce |
427 | * @param ticket the ticket to include in the code | 433 | * @param ticket the ticket to include in the code |
428 | * @param attrs list of attributes which are shared | 434 | * @param attrs list of attributes which are shared |
435 | * @param presentations credential presentation list (may be empty) | ||
429 | * @param nonce the nonce to include in the code | 436 | * @param nonce the nonce to include in the code |
430 | * @param code_challenge PKCE code challenge | 437 | * @param code_challenge PKCE code challenge |
431 | * @return a new authorization code (caller must free) | 438 | * @return a new authorization code (caller must free) |
@@ -434,7 +441,7 @@ char * | |||
434 | OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer, | 441 | OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer, |
435 | const struct GNUNET_RECLAIM_Ticket *ticket, | 442 | const struct GNUNET_RECLAIM_Ticket *ticket, |
436 | struct GNUNET_RECLAIM_AttributeList *attrs, | 443 | struct GNUNET_RECLAIM_AttributeList *attrs, |
437 | struct GNUNET_RECLAIM_AttestationList *attests, | 444 | struct GNUNET_RECLAIM_PresentationList *presentations, |
438 | const char *nonce_str, | 445 | const char *nonce_str, |
439 | const char *code_challenge) | 446 | const char *code_challenge) |
440 | { | 447 | { |
@@ -447,7 +454,7 @@ OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer, | |||
447 | size_t payload_len; | 454 | size_t payload_len; |
448 | size_t code_payload_len; | 455 | size_t code_payload_len; |
449 | size_t attr_list_len = 0; | 456 | size_t attr_list_len = 0; |
450 | size_t attests_list_len = 0; | 457 | size_t pres_list_len = 0; |
451 | size_t code_challenge_len = 0; | 458 | size_t code_challenge_len = 0; |
452 | uint32_t nonce_len = 0; | 459 | uint32_t nonce_len = 0; |
453 | struct GNUNET_CRYPTO_EccSignaturePurpose *purpose; | 460 | struct GNUNET_CRYPTO_EccSignaturePurpose *purpose; |
@@ -481,17 +488,17 @@ OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer, | |||
481 | // Get serialized attributes | 488 | // Get serialized attributes |
482 | payload_len += attr_list_len; | 489 | payload_len += attr_list_len; |
483 | } | 490 | } |
484 | if (NULL != attests) | 491 | if (NULL != presentations) |
485 | { | 492 | { |
486 | // Get length | 493 | // Get length |
487 | attests_list_len = | 494 | pres_list_len = |
488 | GNUNET_RECLAIM_attestation_list_serialize_get_size (attests); | 495 | GNUNET_RECLAIM_presentation_list_serialize_get_size (presentations); |
489 | params.attest_list_len = htonl (attests_list_len); | 496 | params.pres_list_len = htonl (pres_list_len); |
490 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 497 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
491 | "Length of serialized attestations: %lu\n", | 498 | "Length of serialized presentations: %lu\n", |
492 | attests_list_len); | 499 | pres_list_len); |
493 | // Get serialized attributes | 500 | // Get serialized attributes |
494 | payload_len += attests_list_len; | 501 | payload_len += pres_list_len; |
495 | } | 502 | } |
496 | 503 | ||
497 | // Get plaintext length | 504 | // Get plaintext length |
@@ -510,8 +517,8 @@ OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer, | |||
510 | } | 517 | } |
511 | if (0 < attr_list_len) | 518 | if (0 < attr_list_len) |
512 | GNUNET_RECLAIM_attribute_list_serialize (attrs, tmp); | 519 | GNUNET_RECLAIM_attribute_list_serialize (attrs, tmp); |
513 | if (0 < attests_list_len) | 520 | if (0 < pres_list_len) |
514 | GNUNET_RECLAIM_attestation_list_serialize (attests, tmp); | 521 | GNUNET_RECLAIM_presentation_list_serialize (presentations, tmp); |
515 | 522 | ||
516 | /** END **/ | 523 | /** END **/ |
517 | 524 | ||
@@ -564,7 +571,7 @@ OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer, | |||
564 | * if used in request. | 571 | * if used in request. |
565 | * @param ticket where to store the ticket | 572 | * @param ticket where to store the ticket |
566 | * @param attrs the attributes in the code | 573 | * @param attrs the attributes in the code |
567 | * @param attests the attestations in the code (if any) | 574 | * @param presentations credential presentation list |
568 | * @param nonce_str where to store the nonce (if contained) | 575 | * @param nonce_str where to store the nonce (if contained) |
569 | * @return GNUNET_OK if successful, else GNUNET_SYSERR | 576 | * @return GNUNET_OK if successful, else GNUNET_SYSERR |
570 | */ | 577 | */ |
@@ -574,14 +581,14 @@ OIDC_parse_authz_code (const struct GNUNET_CRYPTO_EcdsaPublicKey *audience, | |||
574 | const char *code_verifier, | 581 | const char *code_verifier, |
575 | struct GNUNET_RECLAIM_Ticket *ticket, | 582 | struct GNUNET_RECLAIM_Ticket *ticket, |
576 | struct GNUNET_RECLAIM_AttributeList **attrs, | 583 | struct GNUNET_RECLAIM_AttributeList **attrs, |
577 | struct GNUNET_RECLAIM_AttestationList **attests, | 584 | struct GNUNET_RECLAIM_PresentationList **presentations, |
578 | char **nonce_str) | 585 | char **nonce_str) |
579 | { | 586 | { |
580 | char *code_payload; | 587 | char *code_payload; |
581 | char *ptr; | 588 | char *ptr; |
582 | char *plaintext; | 589 | char *plaintext; |
583 | char *attrs_ser; | 590 | char *attrs_ser; |
584 | char *attests_ser; | 591 | char *presentations_ser; |
585 | char *expected_code_challenge; | 592 | char *expected_code_challenge; |
586 | char *code_challenge; | 593 | char *code_challenge; |
587 | char *code_verifier_hash; | 594 | char *code_verifier_hash; |
@@ -589,7 +596,7 @@ OIDC_parse_authz_code (const struct GNUNET_CRYPTO_EcdsaPublicKey *audience, | |||
589 | struct GNUNET_CRYPTO_EcdsaSignature *signature; | 596 | struct GNUNET_CRYPTO_EcdsaSignature *signature; |
590 | uint32_t code_challenge_len; | 597 | uint32_t code_challenge_len; |
591 | uint32_t attrs_ser_len; | 598 | uint32_t attrs_ser_len; |
592 | uint32_t attests_ser_len; | 599 | uint32_t presentations_ser_len; |
593 | size_t plaintext_len; | 600 | size_t plaintext_len; |
594 | size_t code_payload_len; | 601 | size_t code_payload_len; |
595 | uint32_t nonce_len = 0; | 602 | uint32_t nonce_len = 0; |
@@ -692,10 +699,11 @@ OIDC_parse_authz_code (const struct GNUNET_CRYPTO_EcdsaPublicKey *audience, | |||
692 | attrs_ser = ((char *) ¶ms[1]) + code_challenge_len + nonce_len; | 699 | attrs_ser = ((char *) ¶ms[1]) + code_challenge_len + nonce_len; |
693 | attrs_ser_len = ntohl (params->attr_list_len); | 700 | attrs_ser_len = ntohl (params->attr_list_len); |
694 | *attrs = GNUNET_RECLAIM_attribute_list_deserialize (attrs_ser, attrs_ser_len); | 701 | *attrs = GNUNET_RECLAIM_attribute_list_deserialize (attrs_ser, attrs_ser_len); |
695 | attests_ser = ((char*) attrs_ser) + attrs_ser_len; | 702 | presentations_ser = ((char*) attrs_ser) + attrs_ser_len; |
696 | attests_ser_len = ntohl (params->attest_list_len); | 703 | pres_ser_len = ntohl (params->pres_list_len); |
697 | *attests = GNUNET_RECLAIM_attestation_list_deserialize (attests_ser, | 704 | *presentations = |
698 | attests_ser_len); | 705 | GNUNET_RECLAIM_presentations_list_deserialize (presentations_ser, |
706 | pres_ser_len); | ||
699 | 707 | ||
700 | GNUNET_free (code_payload); | 708 | GNUNET_free (code_payload); |
701 | return GNUNET_OK; | 709 | return GNUNET_OK; |
diff --git a/src/reclaim/oidc_helper.h b/src/reclaim/oidc_helper.h index e713dab62..789a2acc7 100644 --- a/src/reclaim/oidc_helper.h +++ b/src/reclaim/oidc_helper.h | |||
@@ -44,6 +44,7 @@ | |||
44 | * @param aud_key the public of the audience | 44 | * @param aud_key the public of the audience |
45 | * @param sub_key the public key of the subject | 45 | * @param sub_key the public key of the subject |
46 | * @param attrs the attribute list | 46 | * @param attrs the attribute list |
47 | * @param presentations credential presentation list (may be empty) | ||
47 | * @param expiration_time the validity of the token | 48 | * @param expiration_time the validity of the token |
48 | * @param secret_key the key used to sign the JWT | 49 | * @param secret_key the key used to sign the JWT |
49 | * @return a new base64-encoded JWT string. | 50 | * @return a new base64-encoded JWT string. |
@@ -52,7 +53,7 @@ char* | |||
52 | OIDC_generate_id_token (const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key, | 53 | OIDC_generate_id_token (const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key, |
53 | const struct GNUNET_CRYPTO_EcdsaPublicKey *sub_key, | 54 | const struct GNUNET_CRYPTO_EcdsaPublicKey *sub_key, |
54 | struct GNUNET_RECLAIM_AttributeList *attrs, | 55 | struct GNUNET_RECLAIM_AttributeList *attrs, |
55 | struct GNUNET_RECLAIM_AttestationList *attests, | 56 | struct GNUNET_RECLAIM_PresentationList *presentations, |
56 | const struct GNUNET_TIME_Relative *expiration_time, | 57 | const struct GNUNET_TIME_Relative *expiration_time, |
57 | const char *nonce, | 58 | const char *nonce, |
58 | const char *secret_key); | 59 | const char *secret_key); |
@@ -64,6 +65,7 @@ OIDC_generate_id_token (const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key, | |||
64 | * @param issuer the issuer of the ticket, used to sign the ticket and nonce | 65 | * @param issuer the issuer of the ticket, used to sign the ticket and nonce |
65 | * @param ticket the ticket to include in the code | 66 | * @param ticket the ticket to include in the code |
66 | * @param attrs list of attributes to share | 67 | * @param attrs list of attributes to share |
68 | * @param presentations credential presentation list | ||
67 | * @param nonce the nonce to include in the code | 69 | * @param nonce the nonce to include in the code |
68 | * @param code_challenge PKCE code challenge | 70 | * @param code_challenge PKCE code challenge |
69 | * @return a new authorization code (caller must free) | 71 | * @return a new authorization code (caller must free) |
@@ -72,7 +74,7 @@ char* | |||
72 | OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer, | 74 | OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer, |
73 | const struct GNUNET_RECLAIM_Ticket *ticket, | 75 | const struct GNUNET_RECLAIM_Ticket *ticket, |
74 | struct GNUNET_RECLAIM_AttributeList *attrs, | 76 | struct GNUNET_RECLAIM_AttributeList *attrs, |
75 | struct GNUNET_RECLAIM_AttestationList *attests, | 77 | struct GNUNET_RECLAIM_PresentationList *presentations, |
76 | const char *nonce, | 78 | const char *nonce, |
77 | const char *code_challenge); | 79 | const char *code_challenge); |
78 | 80 | ||
@@ -86,6 +88,7 @@ OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer, | |||
86 | * @param code_verfier PKCE code verifier | 88 | * @param code_verfier PKCE code verifier |
87 | * @param ticket where to store the ticket | 89 | * @param ticket where to store the ticket |
88 | * @param attrs the attributes found in the code | 90 | * @param attrs the attributes found in the code |
91 | * @param presentations credential presentation list | ||
89 | * @param nonce where to store the nonce | 92 | * @param nonce where to store the nonce |
90 | * @return GNUNET_OK if successful, else GNUNET_SYSERR | 93 | * @return GNUNET_OK if successful, else GNUNET_SYSERR |
91 | */ | 94 | */ |
@@ -95,7 +98,7 @@ OIDC_parse_authz_code (const struct GNUNET_CRYPTO_EcdsaPublicKey *ecdsa_pub, | |||
95 | const char *code_verifier, | 98 | const char *code_verifier, |
96 | struct GNUNET_RECLAIM_Ticket *ticket, | 99 | struct GNUNET_RECLAIM_Ticket *ticket, |
97 | struct GNUNET_RECLAIM_AttributeList **attrs, | 100 | struct GNUNET_RECLAIM_AttributeList **attrs, |
98 | struct GNUNET_RECLAIM_AttestationList **attests, | 101 | struct GNUNET_RECLAIM_PresentationList **presentations, |
99 | char **nonce); | 102 | char **nonce); |
100 | 103 | ||
101 | /** | 104 | /** |
@@ -145,12 +148,12 @@ OIDC_check_scopes_for_claim_request (const char*scopes, | |||
145 | * | 148 | * |
146 | * @param sub_key the subject (user) | 149 | * @param sub_key the subject (user) |
147 | * @param attrs user attribute list | 150 | * @param attrs user attribute list |
148 | * @param attests user attribute attestation list (may be empty) | 151 | * @param presentations credential presentation list |
149 | * @return Userinfo JSON | 152 | * @return Userinfo JSON |
150 | */ | 153 | */ |
151 | char * | 154 | char * |
152 | OIDC_generate_userinfo (const struct GNUNET_CRYPTO_EcdsaPublicKey *sub_key, | 155 | OIDC_generate_userinfo (const struct GNUNET_CRYPTO_EcdsaPublicKey *sub_key, |
153 | struct GNUNET_RECLAIM_AttributeList *attrs, | 156 | struct GNUNET_RECLAIM_AttributeList *attrs, |
154 | struct GNUNET_RECLAIM_AttestationList *attests); | 157 | struct GNUNET_RECLAIM_PresentationList *presentations); |
155 | 158 | ||
156 | #endif | 159 | #endif |
diff --git a/src/reclaim/plugin_reclaim_attestation_jwt.c b/src/reclaim/plugin_reclaim_credential_jwt.c index c87d3e61a..38effcf78 100644 --- a/src/reclaim/plugin_reclaim_attestation_jwt.c +++ b/src/reclaim/plugin_reclaim_credential_jwt.c | |||
@@ -19,10 +19,9 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file reclaim-attribute/plugin_reclaim_attestation_gnuid.c | 22 | * @file reclaim/plugin_reclaim_credential_jwt.c |
23 | * @brief reclaim-attribute-plugin-gnuid attribute plugin to provide the API for | 23 | * @brief reclaim-credential-plugin-jwt attribute plugin to provide the API for |
24 | * fundamental | 24 | * JWT credentials. |
25 | * attribute types. | ||
26 | * | 25 | * |
27 | * @author Martin Schanzenbach | 26 | * @author Martin Schanzenbach |
28 | */ | 27 | */ |
@@ -33,10 +32,10 @@ | |||
33 | #include <jansson.h> | 32 | #include <jansson.h> |
34 | 33 | ||
35 | /** | 34 | /** |
36 | * Convert the 'value' of an attestation to a string. | 35 | * Convert the 'value' of an credential to a string. |
37 | * | 36 | * |
38 | * @param cls closure, unused | 37 | * @param cls closure, unused |
39 | * @param type type of the attestation | 38 | * @param type type of the credential |
40 | * @param data value in binary encoding | 39 | * @param data value in binary encoding |
41 | * @param data_size number of bytes in @a data | 40 | * @param data_size number of bytes in @a data |
42 | * @return NULL on error, otherwise human-readable representation of the value | 41 | * @return NULL on error, otherwise human-readable representation of the value |
@@ -49,7 +48,7 @@ jwt_value_to_string (void *cls, | |||
49 | { | 48 | { |
50 | switch (type) | 49 | switch (type) |
51 | { | 50 | { |
52 | case GNUNET_RECLAIM_ATTESTATION_TYPE_JWT: | 51 | case GNUNET_RECLAIM_credential_TYPE_JWT: |
53 | return GNUNET_strndup (data, data_size); | 52 | return GNUNET_strndup (data, data_size); |
54 | 53 | ||
55 | default: | 54 | default: |
@@ -59,11 +58,11 @@ jwt_value_to_string (void *cls, | |||
59 | 58 | ||
60 | 59 | ||
61 | /** | 60 | /** |
62 | * Convert human-readable version of a 'value' of an attestation to the binary | 61 | * Convert human-readable version of a 'value' of an credential to the binary |
63 | * representation. | 62 | * representation. |
64 | * | 63 | * |
65 | * @param cls closure, unused | 64 | * @param cls closure, unused |
66 | * @param type type of the attestation | 65 | * @param type type of the credential |
67 | * @param s human-readable string | 66 | * @param s human-readable string |
68 | * @param data set to value in binary encoding (will be allocated) | 67 | * @param data set to value in binary encoding (will be allocated) |
69 | * @param data_size set to number of bytes in @a data | 68 | * @param data_size set to number of bytes in @a data |
@@ -80,7 +79,7 @@ jwt_string_to_value (void *cls, | |||
80 | return GNUNET_SYSERR; | 79 | return GNUNET_SYSERR; |
81 | switch (type) | 80 | switch (type) |
82 | { | 81 | { |
83 | case GNUNET_RECLAIM_ATTESTATION_TYPE_JWT: | 82 | case GNUNET_RECLAIM_credential_TYPE_JWT: |
84 | *data = GNUNET_strdup (s); | 83 | *data = GNUNET_strdup (s); |
85 | *data_size = strlen (s); | 84 | *data_size = strlen (s); |
86 | return GNUNET_OK; | 85 | return GNUNET_OK; |
@@ -92,14 +91,14 @@ jwt_string_to_value (void *cls, | |||
92 | 91 | ||
93 | 92 | ||
94 | /** | 93 | /** |
95 | * Mapping of attestation type numbers to human-readable | 94 | * Mapping of credential type numbers to human-readable |
96 | * attestation type names. | 95 | * credential type names. |
97 | */ | 96 | */ |
98 | static struct | 97 | static struct |
99 | { | 98 | { |
100 | const char *name; | 99 | const char *name; |
101 | uint32_t number; | 100 | uint32_t number; |
102 | } jwt_attest_name_map[] = { { "JWT", GNUNET_RECLAIM_ATTESTATION_TYPE_JWT }, | 101 | } jwt_cred_name_map[] = { { "JWT", GNUNET_RECLAIM_credential_TYPE_JWT }, |
103 | { NULL, UINT32_MAX } }; | 102 | { NULL, UINT32_MAX } }; |
104 | 103 | ||
105 | /** | 104 | /** |
@@ -115,10 +114,10 @@ jwt_typename_to_number (void *cls, const char *jwt_typename) | |||
115 | unsigned int i; | 114 | unsigned int i; |
116 | 115 | ||
117 | i = 0; | 116 | i = 0; |
118 | while ((NULL != jwt_attest_name_map[i].name) && | 117 | while ((NULL != jwt_cred_name_map[i].name) && |
119 | (0 != strcasecmp (jwt_typename, jwt_attest_name_map[i].name))) | 118 | (0 != strcasecmp (jwt_typename, jwt_cred_name_map[i].name))) |
120 | i++; | 119 | i++; |
121 | return jwt_attest_name_map[i].number; | 120 | return jwt_cred_name_map[i].number; |
122 | } | 121 | } |
123 | 122 | ||
124 | 123 | ||
@@ -135,11 +134,11 @@ jwt_number_to_typename (void *cls, uint32_t type) | |||
135 | unsigned int i; | 134 | unsigned int i; |
136 | 135 | ||
137 | i = 0; | 136 | i = 0; |
138 | while ((NULL != jwt_attest_name_map[i].name) && (type != | 137 | while ((NULL != jwt_cred_name_map[i].name) && (type != |
139 | jwt_attest_name_map[i]. | 138 | jwt_cred_name_map[i]. |
140 | number)) | 139 | number)) |
141 | i++; | 140 | i++; |
142 | return jwt_attest_name_map[i].name; | 141 | return jwt_cred_name_map[i].name; |
143 | } | 142 | } |
144 | 143 | ||
145 | 144 | ||
@@ -147,12 +146,12 @@ jwt_number_to_typename (void *cls, uint32_t type) | |||
147 | * Parse a JWT and return the respective claim value as Attribute | 146 | * Parse a JWT and return the respective claim value as Attribute |
148 | * | 147 | * |
149 | * @param cls the plugin | 148 | * @param cls the plugin |
150 | * @param attest the jwt attestation | 149 | * @param cred the jwt credential |
151 | * @return a GNUNET_RECLAIM_Attribute, containing the new value | 150 | * @return a GNUNET_RECLAIM_Attribute, containing the new value |
152 | */ | 151 | */ |
153 | struct GNUNET_RECLAIM_AttributeList * | 152 | struct GNUNET_RECLAIM_AttributeList * |
154 | jwt_parse_attributes (void *cls, | 153 | jwt_parse_attributes (void *cls, |
155 | const struct GNUNET_RECLAIM_Attestation *attest) | 154 | const struct GNUNET_RECLAIM_Credential *cred) |
156 | { | 155 | { |
157 | char *jwt_string; | 156 | char *jwt_string; |
158 | struct GNUNET_RECLAIM_AttributeList *attrs; | 157 | struct GNUNET_RECLAIM_AttributeList *attrs; |
@@ -163,12 +162,12 @@ jwt_parse_attributes (void *cls, | |||
163 | json_t *json_val; | 162 | json_t *json_val; |
164 | json_error_t *json_err = NULL; | 163 | json_error_t *json_err = NULL; |
165 | 164 | ||
166 | /* GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "%s\n", attest->data); (not OK: 'data' is not defined as 0-terminated text, but binary) */ | 165 | /* GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "%s\n", cred->data); (not OK: 'data' is not defined as 0-terminated text, but binary) */ |
167 | if (GNUNET_RECLAIM_ATTESTATION_TYPE_JWT != attest->type) | 166 | if (GNUNET_RECLAIM_credential_TYPE_JWT != cred->type) |
168 | return NULL; | 167 | return NULL; |
169 | attrs = GNUNET_new (struct GNUNET_RECLAIM_AttributeList); | 168 | attrs = GNUNET_new (struct GNUNET_RECLAIM_AttributeList); |
170 | 169 | ||
171 | jwt_string = GNUNET_strdup (attest->data); | 170 | jwt_string = GNUNET_strdup (cred->data); |
172 | const char *jwt_body = strtok (jwt_string, delim); | 171 | const char *jwt_body = strtok (jwt_string, delim); |
173 | jwt_body = strtok (NULL, delim); | 172 | jwt_body = strtok (NULL, delim); |
174 | GNUNET_STRINGS_base64url_decode (jwt_body, strlen (jwt_body), | 173 | GNUNET_STRINGS_base64url_decode (jwt_body, strlen (jwt_body), |
@@ -207,12 +206,12 @@ jwt_parse_attributes (void *cls, | |||
207 | * Parse a JWT and return the issuer | 206 | * Parse a JWT and return the issuer |
208 | * | 207 | * |
209 | * @param cls the plugin | 208 | * @param cls the plugin |
210 | * @param attest the jwt attestation | 209 | * @param cred the jwt credential |
211 | * @return a string, containing the isser | 210 | * @return a string, containing the isser |
212 | */ | 211 | */ |
213 | char * | 212 | char * |
214 | jwt_get_issuer (void *cls, | 213 | jwt_get_issuer (void *cls, |
215 | const struct GNUNET_RECLAIM_Attestation *attest) | 214 | const struct GNUNET_RECLAIM_Credential *cred) |
216 | { | 215 | { |
217 | const char *jwt_body; | 216 | const char *jwt_body; |
218 | char *jwt_string; | 217 | char *jwt_string; |
@@ -224,9 +223,9 @@ jwt_get_issuer (void *cls, | |||
224 | json_t *json_val; | 223 | json_t *json_val; |
225 | json_error_t *json_err = NULL; | 224 | json_error_t *json_err = NULL; |
226 | 225 | ||
227 | if (GNUNET_RECLAIM_ATTESTATION_TYPE_JWT != attest->type) | 226 | if (GNUNET_RECLAIM_credential_TYPE_JWT != cred->type) |
228 | return NULL; | 227 | return NULL; |
229 | jwt_string = GNUNET_strdup (attest->data); | 228 | jwt_string = GNUNET_strdup (cred->data); |
230 | jwt_body = strtok (jwt_string, delim); | 229 | jwt_body = strtok (jwt_string, delim); |
231 | jwt_body = strtok (NULL, delim); | 230 | jwt_body = strtok (NULL, delim); |
232 | GNUNET_STRINGS_base64url_decode (jwt_body, strlen (jwt_body), | 231 | GNUNET_STRINGS_base64url_decode (jwt_body, strlen (jwt_body), |
@@ -245,12 +244,12 @@ jwt_get_issuer (void *cls, | |||
245 | * Parse a JWT and return the expiration | 244 | * Parse a JWT and return the expiration |
246 | * | 245 | * |
247 | * @param cls the plugin | 246 | * @param cls the plugin |
248 | * @param attest the jwt attestation | 247 | * @param cred the jwt credential |
249 | * @return a string, containing the isser | 248 | * @return a string, containing the isser |
250 | */ | 249 | */ |
251 | int | 250 | int |
252 | jwt_get_expiration (void *cls, | 251 | jwt_get_expiration (void *cls, |
253 | const struct GNUNET_RECLAIM_Attestation *attest, | 252 | const struct GNUNET_RECLAIM_Credential *cred, |
254 | struct GNUNET_TIME_Absolute *exp) | 253 | struct GNUNET_TIME_Absolute *exp) |
255 | { | 254 | { |
256 | const char *jwt_body; | 255 | const char *jwt_body; |
@@ -262,9 +261,9 @@ jwt_get_expiration (void *cls, | |||
262 | json_t *json_val; | 261 | json_t *json_val; |
263 | json_error_t *json_err = NULL; | 262 | json_error_t *json_err = NULL; |
264 | 263 | ||
265 | if (GNUNET_RECLAIM_ATTESTATION_TYPE_JWT != attest->type) | 264 | if (GNUNET_RECLAIM_credential_TYPE_JWT != cred->type) |
266 | return GNUNET_NO; | 265 | return GNUNET_NO; |
267 | jwt_string = GNUNET_strdup (attest->data); | 266 | jwt_string = GNUNET_strdup (cred->data); |
268 | jwt_body = strtok (jwt_string, delim); | 267 | jwt_body = strtok (jwt_string, delim); |
269 | jwt_body = strtok (NULL, delim); | 268 | jwt_body = strtok (NULL, delim); |
270 | GNUNET_STRINGS_base64url_decode (jwt_body, strlen (jwt_body), | 269 | GNUNET_STRINGS_base64url_decode (jwt_body, strlen (jwt_body), |
@@ -286,11 +285,11 @@ jwt_get_expiration (void *cls, | |||
286 | * @return the exported block API | 285 | * @return the exported block API |
287 | */ | 286 | */ |
288 | void * | 287 | void * |
289 | libgnunet_plugin_reclaim_attestation_jwt_init (void *cls) | 288 | libgnunet_plugin_reclaim_credential_jwt_init (void *cls) |
290 | { | 289 | { |
291 | struct GNUNET_RECLAIM_AttestationPluginFunctions *api; | 290 | struct GNUNET_RECLAIM_CredentialPluginFunctions *api; |
292 | 291 | ||
293 | api = GNUNET_new (struct GNUNET_RECLAIM_AttestationPluginFunctions); | 292 | api = GNUNET_new (struct GNUNET_RECLAIM_CredentialPluginFunctions); |
294 | api->value_to_string = &jwt_value_to_string; | 293 | api->value_to_string = &jwt_value_to_string; |
295 | api->string_to_value = &jwt_string_to_value; | 294 | api->string_to_value = &jwt_string_to_value; |
296 | api->typename_to_number = &jwt_typename_to_number; | 295 | api->typename_to_number = &jwt_typename_to_number; |
@@ -309,13 +308,13 @@ libgnunet_plugin_reclaim_attestation_jwt_init (void *cls) | |||
309 | * @return NULL | 308 | * @return NULL |
310 | */ | 309 | */ |
311 | void * | 310 | void * |
312 | libgnunet_plugin_reclaim_attestation_jwt_done (void *cls) | 311 | libgnunet_plugin_reclaim_credential_jwt_done (void *cls) |
313 | { | 312 | { |
314 | struct GNUNET_RECLAIM_AttestationPluginFunctions *api = cls; | 313 | struct GNUNET_RECLAIM_CredentialPluginFunctions *api = cls; |
315 | 314 | ||
316 | GNUNET_free (api); | 315 | GNUNET_free (api); |
317 | return NULL; | 316 | return NULL; |
318 | } | 317 | } |
319 | 318 | ||
320 | 319 | ||
321 | /* end of plugin_reclaim_attestation_type_gnuid.c */ | 320 | /* end of plugin_reclaim_credential_type_jwt.c */ |
diff --git a/src/reclaim/plugin_rest_openid_connect.c b/src/reclaim/plugin_rest_openid_connect.c index 2f44917c9..5ae6565af 100644 --- a/src/reclaim/plugin_rest_openid_connect.c +++ b/src/reclaim/plugin_rest_openid_connect.c | |||
@@ -439,9 +439,9 @@ struct RequestHandle | |||
439 | struct GNUNET_RECLAIM_AttributeList *attr_userinfo_list; | 439 | struct GNUNET_RECLAIM_AttributeList *attr_userinfo_list; |
440 | 440 | ||
441 | /** | 441 | /** |
442 | * Attestation list | 442 | * Credential list |
443 | */ | 443 | */ |
444 | struct GNUNET_RECLAIM_AttestationList *attests_list; | 444 | struct GNUNET_RECLAIM_CredentialList *creds_list; |
445 | 445 | ||
446 | 446 | ||
447 | /** | 447 | /** |
@@ -461,9 +461,9 @@ struct RequestHandle | |||
461 | struct GNUNET_RECLAIM_AttributeIterator *attr_it; | 461 | struct GNUNET_RECLAIM_AttributeIterator *attr_it; |
462 | 462 | ||
463 | /** | 463 | /** |
464 | * Attestation iterator | 464 | * Credential iterator |
465 | */ | 465 | */ |
466 | struct GNUNET_RECLAIM_AttestationIterator *attest_it; | 466 | struct GNUNET_RECLAIM_CredentialIterator *cred_it; |
467 | 467 | ||
468 | 468 | ||
469 | /** | 469 | /** |
@@ -561,8 +561,8 @@ cleanup_handle (struct RequestHandle *handle) | |||
561 | GNUNET_SCHEDULER_cancel (handle->timeout_task); | 561 | GNUNET_SCHEDULER_cancel (handle->timeout_task); |
562 | if (NULL != handle->attr_it) | 562 | if (NULL != handle->attr_it) |
563 | GNUNET_RECLAIM_get_attributes_stop (handle->attr_it); | 563 | GNUNET_RECLAIM_get_attributes_stop (handle->attr_it); |
564 | if (NULL != handle->attest_it) | 564 | if (NULL != handle->cred_it) |
565 | GNUNET_RECLAIM_get_attestations_stop (handle->attest_it); | 565 | GNUNET_RECLAIM_get_credentials_stop (handle->cred_it); |
566 | if (NULL != handle->ticket_it) | 566 | if (NULL != handle->ticket_it) |
567 | GNUNET_RECLAIM_ticket_iteration_stop (handle->ticket_it); | 567 | GNUNET_RECLAIM_ticket_iteration_stop (handle->ticket_it); |
568 | if (NULL != handle->idp_op) | 568 | if (NULL != handle->idp_op) |
@@ -590,8 +590,8 @@ cleanup_handle (struct RequestHandle *handle) | |||
590 | GNUNET_RECLAIM_attribute_list_destroy (handle->attr_idtoken_list); | 590 | GNUNET_RECLAIM_attribute_list_destroy (handle->attr_idtoken_list); |
591 | if (NULL!=handle->attr_userinfo_list) | 591 | if (NULL!=handle->attr_userinfo_list) |
592 | GNUNET_RECLAIM_attribute_list_destroy (handle->attr_userinfo_list); | 592 | GNUNET_RECLAIM_attribute_list_destroy (handle->attr_userinfo_list); |
593 | if (NULL!=handle->attests_list) | 593 | if (NULL!=handle->creds_list) |
594 | GNUNET_RECLAIM_attestation_list_destroy (handle->attests_list); | 594 | GNUNET_RECLAIM_credential_list_destroy (handle->creds_list); |
595 | GNUNET_CONTAINER_DLL_remove (requests_head, | 595 | GNUNET_CONTAINER_DLL_remove (requests_head, |
596 | requests_tail, | 596 | requests_tail, |
597 | handle); | 597 | handle); |
@@ -957,7 +957,7 @@ oidc_ticket_issue_cb (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket) | |||
957 | code_string = OIDC_build_authz_code (&handle->priv_key, | 957 | code_string = OIDC_build_authz_code (&handle->priv_key, |
958 | &handle->ticket, | 958 | &handle->ticket, |
959 | handle->attr_idtoken_list, | 959 | handle->attr_idtoken_list, |
960 | handle->attests_list, | 960 | handle->creds_list, |
961 | handle->oidc->nonce, | 961 | handle->oidc->nonce, |
962 | handle->oidc->code_challenge); | 962 | handle->oidc->code_challenge); |
963 | if ((NULL != handle->redirect_prefix) && (NULL != handle->redirect_suffix) && | 963 | if ((NULL != handle->redirect_prefix) && (NULL != handle->redirect_suffix) && |
@@ -1010,13 +1010,13 @@ attribute_list_merge (struct GNUNET_RECLAIM_AttributeList *list_a, | |||
1010 | le_m = GNUNET_new (struct GNUNET_RECLAIM_AttributeListEntry); | 1010 | le_m = GNUNET_new (struct GNUNET_RECLAIM_AttributeListEntry); |
1011 | le_m->attribute = GNUNET_RECLAIM_attribute_new (le_a->attribute->name, | 1011 | le_m->attribute = GNUNET_RECLAIM_attribute_new (le_a->attribute->name, |
1012 | &le_a->attribute-> | 1012 | &le_a->attribute-> |
1013 | attestation, | 1013 | credential, |
1014 | le_a->attribute->type, | 1014 | le_a->attribute->type, |
1015 | le_a->attribute->data, | 1015 | le_a->attribute->data, |
1016 | le_a->attribute->data_size); | 1016 | le_a->attribute->data_size); |
1017 | le_m->attribute->id = le_a->attribute->id; | 1017 | le_m->attribute->id = le_a->attribute->id; |
1018 | le_m->attribute->flag = le_a->attribute->flag; | 1018 | le_m->attribute->flag = le_a->attribute->flag; |
1019 | le_m->attribute->attestation = le_a->attribute->attestation; | 1019 | le_m->attribute->credential = le_a->attribute->credential; |
1020 | GNUNET_CONTAINER_DLL_insert (merged_list->list_head, | 1020 | GNUNET_CONTAINER_DLL_insert (merged_list->list_head, |
1021 | merged_list->list_tail, | 1021 | merged_list->list_tail, |
1022 | le_m); | 1022 | le_m); |
@@ -1035,13 +1035,13 @@ attribute_list_merge (struct GNUNET_RECLAIM_AttributeList *list_a, | |||
1035 | le_m = GNUNET_new (struct GNUNET_RECLAIM_AttributeListEntry); | 1035 | le_m = GNUNET_new (struct GNUNET_RECLAIM_AttributeListEntry); |
1036 | le_m->attribute = GNUNET_RECLAIM_attribute_new (le_b->attribute->name, | 1036 | le_m->attribute = GNUNET_RECLAIM_attribute_new (le_b->attribute->name, |
1037 | &le_b->attribute-> | 1037 | &le_b->attribute-> |
1038 | attestation, | 1038 | credential, |
1039 | le_b->attribute->type, | 1039 | le_b->attribute->type, |
1040 | le_b->attribute->data, | 1040 | le_b->attribute->data, |
1041 | le_b->attribute->data_size); | 1041 | le_b->attribute->data_size); |
1042 | le_m->attribute->id = le_b->attribute->id; | 1042 | le_m->attribute->id = le_b->attribute->id; |
1043 | le_m->attribute->flag = le_b->attribute->flag; | 1043 | le_m->attribute->flag = le_b->attribute->flag; |
1044 | le_m->attribute->attestation = le_b->attribute->attestation; | 1044 | le_m->attribute->credential = le_b->attribute->credential; |
1045 | GNUNET_CONTAINER_DLL_insert (merged_list->list_head, | 1045 | GNUNET_CONTAINER_DLL_insert (merged_list->list_head, |
1046 | merged_list->list_tail, | 1046 | merged_list->list_tail, |
1047 | le_m); | 1047 | le_m); |
@@ -1051,13 +1051,13 @@ attribute_list_merge (struct GNUNET_RECLAIM_AttributeList *list_a, | |||
1051 | 1051 | ||
1052 | 1052 | ||
1053 | static void | 1053 | static void |
1054 | oidc_attest_collect_finished_cb (void *cls) | 1054 | oidc_cred_collect_finished_cb (void *cls) |
1055 | { | 1055 | { |
1056 | struct RequestHandle *handle = cls; | 1056 | struct RequestHandle *handle = cls; |
1057 | struct GNUNET_RECLAIM_AttributeList *merged_list; | 1057 | struct GNUNET_RECLAIM_AttributeList *merged_list; |
1058 | struct GNUNET_RECLAIM_AttributeListEntry *le_m; | 1058 | struct GNUNET_RECLAIM_AttributeListEntry *le_m; |
1059 | 1059 | ||
1060 | handle->attest_it = NULL; | 1060 | handle->cred_it = NULL; |
1061 | merged_list = attribute_list_merge (handle->attr_idtoken_list, | 1061 | merged_list = attribute_list_merge (handle->attr_idtoken_list, |
1062 | handle->attr_userinfo_list); | 1062 | handle->attr_userinfo_list); |
1063 | for (le_m = merged_list->list_head; NULL != le_m; le_m = le_m->next) | 1063 | for (le_m = merged_list->list_head; NULL != le_m; le_m = le_m->next) |
@@ -1078,40 +1078,40 @@ oidc_attest_collect_finished_cb (void *cls) | |||
1078 | * Collects all attributes for an ego if in scope parameter | 1078 | * Collects all attributes for an ego if in scope parameter |
1079 | */ | 1079 | */ |
1080 | static void | 1080 | static void |
1081 | oidc_attest_collect (void *cls, | 1081 | oidc_cred_collect (void *cls, |
1082 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, | 1082 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, |
1083 | const struct GNUNET_RECLAIM_Attestation *attest) | 1083 | const struct GNUNET_RECLAIM_Credential *cred) |
1084 | { | 1084 | { |
1085 | struct RequestHandle *handle = cls; | 1085 | struct RequestHandle *handle = cls; |
1086 | struct GNUNET_RECLAIM_AttributeListEntry *le; | 1086 | struct GNUNET_RECLAIM_AttributeListEntry *le; |
1087 | struct GNUNET_RECLAIM_AttestationListEntry *ale; | 1087 | struct GNUNET_RECLAIM_CredentialListEntry *ale; |
1088 | 1088 | ||
1089 | for (ale = handle->attests_list->list_head; NULL != ale; ale = ale->next) | 1089 | for (ale = handle->creds_list->list_head; NULL != ale; ale = ale->next) |
1090 | { | 1090 | { |
1091 | if (GNUNET_NO == GNUNET_RECLAIM_id_is_equal (&ale->attestation->id, | 1091 | if (GNUNET_NO == GNUNET_RECLAIM_id_is_equal (&ale->credential->id, |
1092 | &attest->id)) | 1092 | &cred->id)) |
1093 | continue; | 1093 | continue; |
1094 | /** Attestation already in list **/ | 1094 | /** Credential already in list **/ |
1095 | GNUNET_RECLAIM_get_attestations_next (handle->attest_it); | 1095 | GNUNET_RECLAIM_get_credentials_next (handle->cred_it); |
1096 | return; | 1096 | return; |
1097 | } | 1097 | } |
1098 | 1098 | ||
1099 | for (le = handle->attr_idtoken_list->list_head; NULL != le; le = le->next) | 1099 | for (le = handle->attr_idtoken_list->list_head; NULL != le; le = le->next) |
1100 | { | 1100 | { |
1101 | if (GNUNET_NO == GNUNET_RECLAIM_id_is_equal (&le->attribute->attestation, | 1101 | if (GNUNET_NO == GNUNET_RECLAIM_id_is_equal (&le->attribute->credential, |
1102 | &attest->id)) | 1102 | &cred->id)) |
1103 | continue; | 1103 | continue; |
1104 | /** Attestation matches for attribute, add **/ | 1104 | /** Credential matches for attribute, add **/ |
1105 | ale = GNUNET_new (struct GNUNET_RECLAIM_AttestationListEntry); | 1105 | ale = GNUNET_new (struct GNUNET_RECLAIM_CredentialListEntry); |
1106 | ale->attestation = GNUNET_RECLAIM_attestation_new (attest->name, | 1106 | ale->credential = GNUNET_RECLAIM_credential_new (cred->name, |
1107 | attest->type, | 1107 | cred->type, |
1108 | attest->data, | 1108 | cred->data, |
1109 | attest->data_size); | 1109 | cred->data_size); |
1110 | GNUNET_CONTAINER_DLL_insert (handle->attests_list->list_head, | 1110 | GNUNET_CONTAINER_DLL_insert (handle->creds_list->list_head, |
1111 | handle->attests_list->list_tail, | 1111 | handle->creds_list->list_tail, |
1112 | ale); | 1112 | ale); |
1113 | } | 1113 | } |
1114 | GNUNET_RECLAIM_get_attestations_next (handle->attest_it); | 1114 | GNUNET_RECLAIM_get_credentials_next (handle->cred_it); |
1115 | } | 1115 | } |
1116 | 1116 | ||
1117 | 1117 | ||
@@ -1129,16 +1129,16 @@ oidc_attr_collect_finished_cb (void *cls) | |||
1129 | GNUNET_SCHEDULER_add_now (&do_redirect_error, handle); | 1129 | GNUNET_SCHEDULER_add_now (&do_redirect_error, handle); |
1130 | return; | 1130 | return; |
1131 | } | 1131 | } |
1132 | handle->attests_list = GNUNET_new (struct GNUNET_RECLAIM_AttestationList); | 1132 | handle->creds_list = GNUNET_new (struct GNUNET_RECLAIM_CredentialList); |
1133 | handle->attest_it = | 1133 | handle->cred_it = |
1134 | GNUNET_RECLAIM_get_attestations_start (idp, | 1134 | GNUNET_RECLAIM_get_credentials_start (idp, |
1135 | &handle->priv_key, | 1135 | &handle->priv_key, |
1136 | &oidc_iteration_error, | 1136 | &oidc_iteration_error, |
1137 | handle, | 1137 | handle, |
1138 | &oidc_attest_collect, | 1138 | &oidc_cred_collect, |
1139 | handle, | 1139 | handle, |
1140 | &oidc_attest_collect_finished_cb, | 1140 | &oidc_cred_collect_finished_cb, |
1141 | handle); | 1141 | handle); |
1142 | 1142 | ||
1143 | } | 1143 | } |
1144 | 1144 | ||
@@ -1212,13 +1212,13 @@ oidc_attr_collect (void *cls, | |||
1212 | { | 1212 | { |
1213 | le = GNUNET_new (struct GNUNET_RECLAIM_AttributeListEntry); | 1213 | le = GNUNET_new (struct GNUNET_RECLAIM_AttributeListEntry); |
1214 | le->attribute = GNUNET_RECLAIM_attribute_new (attr->name, | 1214 | le->attribute = GNUNET_RECLAIM_attribute_new (attr->name, |
1215 | &attr->attestation, | 1215 | &attr->credential, |
1216 | attr->type, | 1216 | attr->type, |
1217 | attr->data, | 1217 | attr->data, |
1218 | attr->data_size); | 1218 | attr->data_size); |
1219 | le->attribute->id = attr->id; | 1219 | le->attribute->id = attr->id; |
1220 | le->attribute->flag = attr->flag; | 1220 | le->attribute->flag = attr->flag; |
1221 | le->attribute->attestation = attr->attestation; | 1221 | le->attribute->credential = attr->credential; |
1222 | GNUNET_CONTAINER_DLL_insert (handle->attr_idtoken_list->list_head, | 1222 | GNUNET_CONTAINER_DLL_insert (handle->attr_idtoken_list->list_head, |
1223 | handle->attr_idtoken_list->list_tail, | 1223 | handle->attr_idtoken_list->list_tail, |
1224 | le); | 1224 | le); |
@@ -1227,13 +1227,13 @@ oidc_attr_collect (void *cls, | |||
1227 | { | 1227 | { |
1228 | le = GNUNET_new (struct GNUNET_RECLAIM_AttributeListEntry); | 1228 | le = GNUNET_new (struct GNUNET_RECLAIM_AttributeListEntry); |
1229 | le->attribute = GNUNET_RECLAIM_attribute_new (attr->name, | 1229 | le->attribute = GNUNET_RECLAIM_attribute_new (attr->name, |
1230 | &attr->attestation, | 1230 | &attr->credential, |
1231 | attr->type, | 1231 | attr->type, |
1232 | attr->data, | 1232 | attr->data, |
1233 | attr->data_size); | 1233 | attr->data_size); |
1234 | le->attribute->id = attr->id; | 1234 | le->attribute->id = attr->id; |
1235 | le->attribute->flag = attr->flag; | 1235 | le->attribute->flag = attr->flag; |
1236 | le->attribute->attestation = attr->attestation; | 1236 | le->attribute->credential = attr->credential; |
1237 | GNUNET_CONTAINER_DLL_insert (handle->attr_userinfo_list->list_head, | 1237 | GNUNET_CONTAINER_DLL_insert (handle->attr_userinfo_list->list_head, |
1238 | handle->attr_userinfo_list->list_tail, | 1238 | handle->attr_userinfo_list->list_tail, |
1239 | le); | 1239 | le); |
@@ -1982,7 +1982,7 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle, | |||
1982 | const struct EgoEntry *ego_entry; | 1982 | const struct EgoEntry *ego_entry; |
1983 | struct GNUNET_TIME_Relative expiration_time; | 1983 | struct GNUNET_TIME_Relative expiration_time; |
1984 | struct GNUNET_RECLAIM_AttributeList *cl = NULL; | 1984 | struct GNUNET_RECLAIM_AttributeList *cl = NULL; |
1985 | struct GNUNET_RECLAIM_AttestationList *al = NULL; | 1985 | struct GNUNET_RECLAIM_CredentialList *al = NULL; |
1986 | struct GNUNET_RECLAIM_Ticket ticket; | 1986 | struct GNUNET_RECLAIM_Ticket ticket; |
1987 | struct GNUNET_CRYPTO_EcdsaPublicKey cid; | 1987 | struct GNUNET_CRYPTO_EcdsaPublicKey cid; |
1988 | struct GNUNET_HashCode cache_key; | 1988 | struct GNUNET_HashCode cache_key; |
@@ -2124,7 +2124,7 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle, | |||
2124 | MHD_add_response_header (resp, "Content-Type", "application/json"); | 2124 | MHD_add_response_header (resp, "Content-Type", "application/json"); |
2125 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); | 2125 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); |
2126 | GNUNET_RECLAIM_attribute_list_destroy (cl); | 2126 | GNUNET_RECLAIM_attribute_list_destroy (cl); |
2127 | GNUNET_RECLAIM_attestation_list_destroy (al); | 2127 | GNUNET_RECLAIM_credential_list_destroy (al); |
2128 | GNUNET_free (access_token); | 2128 | GNUNET_free (access_token); |
2129 | GNUNET_free (json_response); | 2129 | GNUNET_free (json_response); |
2130 | GNUNET_free (id_token); | 2130 | GNUNET_free (id_token); |
@@ -2139,11 +2139,11 @@ static void | |||
2139 | consume_ticket (void *cls, | 2139 | consume_ticket (void *cls, |
2140 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, | 2140 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, |
2141 | const struct GNUNET_RECLAIM_Attribute *attr, | 2141 | const struct GNUNET_RECLAIM_Attribute *attr, |
2142 | const struct GNUNET_RECLAIM_Attestation *attest) | 2142 | const struct GNUNET_RECLAIM_Credential *cred) |
2143 | { | 2143 | { |
2144 | struct RequestHandle *handle = cls; | 2144 | struct RequestHandle *handle = cls; |
2145 | struct GNUNET_RECLAIM_AttributeListEntry *ale; | 2145 | struct GNUNET_RECLAIM_AttributeListEntry *ale; |
2146 | struct GNUNET_RECLAIM_AttestationListEntry *atle; | 2146 | struct GNUNET_RECLAIM_CredentialListEntry *atle; |
2147 | struct MHD_Response *resp; | 2147 | struct MHD_Response *resp; |
2148 | char *result_str; | 2148 | char *result_str; |
2149 | handle->idp_op = NULL; | 2149 | handle->idp_op = NULL; |
@@ -2152,7 +2152,7 @@ consume_ticket (void *cls, | |||
2152 | { | 2152 | { |
2153 | result_str = OIDC_generate_userinfo (&handle->ticket.identity, | 2153 | result_str = OIDC_generate_userinfo (&handle->ticket.identity, |
2154 | handle->attr_userinfo_list, | 2154 | handle->attr_userinfo_list, |
2155 | handle->attests_list); | 2155 | handle->creds_list); |
2156 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Userinfo: %s\n", result_str); | 2156 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Userinfo: %s\n", result_str); |
2157 | resp = GNUNET_REST_create_response (result_str); | 2157 | resp = GNUNET_REST_create_response (result_str); |
2158 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); | 2158 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); |
@@ -2162,35 +2162,35 @@ consume_ticket (void *cls, | |||
2162 | } | 2162 | } |
2163 | ale = GNUNET_new (struct GNUNET_RECLAIM_AttributeListEntry); | 2163 | ale = GNUNET_new (struct GNUNET_RECLAIM_AttributeListEntry); |
2164 | ale->attribute = GNUNET_RECLAIM_attribute_new (attr->name, | 2164 | ale->attribute = GNUNET_RECLAIM_attribute_new (attr->name, |
2165 | &attr->attestation, | 2165 | &attr->credential, |
2166 | attr->type, | 2166 | attr->type, |
2167 | attr->data, | 2167 | attr->data, |
2168 | attr->data_size); | 2168 | attr->data_size); |
2169 | ale->attribute->id = attr->id; | 2169 | ale->attribute->id = attr->id; |
2170 | ale->attribute->flag = attr->flag; | 2170 | ale->attribute->flag = attr->flag; |
2171 | ale->attribute->attestation = attr->attestation; | 2171 | ale->attribute->credential = attr->credential; |
2172 | GNUNET_CONTAINER_DLL_insert (handle->attr_userinfo_list->list_head, | 2172 | GNUNET_CONTAINER_DLL_insert (handle->attr_userinfo_list->list_head, |
2173 | handle->attr_userinfo_list->list_tail, | 2173 | handle->attr_userinfo_list->list_tail, |
2174 | ale); | 2174 | ale); |
2175 | if (NULL == attest) | 2175 | if (NULL == cred) |
2176 | return; | 2176 | return; |
2177 | for (atle = handle->attests_list->list_head; NULL != atle; atle = atle->next) | 2177 | for (atle = handle->creds_list->list_head; NULL != atle; atle = atle->next) |
2178 | { | 2178 | { |
2179 | if (GNUNET_NO == GNUNET_RECLAIM_id_is_equal (&atle->attestation->id, | 2179 | if (GNUNET_NO == GNUNET_RECLAIM_id_is_equal (&atle->credential->id, |
2180 | &attest->id)) | 2180 | &cred->id)) |
2181 | continue; | 2181 | continue; |
2182 | break; /** already in list **/ | 2182 | break; /** already in list **/ |
2183 | } | 2183 | } |
2184 | if (NULL == atle) | 2184 | if (NULL == atle) |
2185 | { | 2185 | { |
2186 | /** Attestation matches for attribute, add **/ | 2186 | /** Credential matches for attribute, add **/ |
2187 | atle = GNUNET_new (struct GNUNET_RECLAIM_AttestationListEntry); | 2187 | atle = GNUNET_new (struct GNUNET_RECLAIM_CredentialListEntry); |
2188 | atle->attestation = GNUNET_RECLAIM_attestation_new (attest->name, | 2188 | atle->credential = GNUNET_RECLAIM_credential_new (cred->name, |
2189 | attest->type, | 2189 | cred->type, |
2190 | attest->data, | 2190 | cred->data, |
2191 | attest->data_size); | 2191 | cred->data_size); |
2192 | GNUNET_CONTAINER_DLL_insert (handle->attests_list->list_head, | 2192 | GNUNET_CONTAINER_DLL_insert (handle->creds_list->list_head, |
2193 | handle->attests_list->list_tail, | 2193 | handle->creds_list->list_tail, |
2194 | atle); | 2194 | atle); |
2195 | } | 2195 | } |
2196 | } | 2196 | } |
@@ -2289,8 +2289,8 @@ userinfo_endpoint (struct GNUNET_REST_RequestHandle *con_handle, | |||
2289 | privkey = GNUNET_IDENTITY_ego_get_private_key (aud_ego->ego); | 2289 | privkey = GNUNET_IDENTITY_ego_get_private_key (aud_ego->ego); |
2290 | handle->attr_userinfo_list = | 2290 | handle->attr_userinfo_list = |
2291 | GNUNET_new (struct GNUNET_RECLAIM_AttributeList); | 2291 | GNUNET_new (struct GNUNET_RECLAIM_AttributeList); |
2292 | handle->attests_list = | 2292 | handle->creds_list = |
2293 | GNUNET_new (struct GNUNET_RECLAIM_AttestationList); | 2293 | GNUNET_new (struct GNUNET_RECLAIM_CredentialList); |
2294 | 2294 | ||
2295 | handle->idp_op = GNUNET_RECLAIM_ticket_consume (idp, | 2295 | handle->idp_op = GNUNET_RECLAIM_ticket_consume (idp, |
2296 | privkey, | 2296 | privkey, |
@@ -2611,6 +2611,7 @@ libgnunet_plugin_rest_openid_connect_init (void *cls) | |||
2611 | return api; | 2611 | return api; |
2612 | } | 2612 | } |
2613 | 2613 | ||
2614 | |||
2614 | static int | 2615 | static int |
2615 | cleanup_hashmap (void *cls, const struct GNUNET_HashCode *key, void *value) | 2616 | cleanup_hashmap (void *cls, const struct GNUNET_HashCode *key, void *value) |
2616 | { | 2617 | { |
@@ -2618,6 +2619,7 @@ cleanup_hashmap (void *cls, const struct GNUNET_HashCode *key, void *value) | |||
2618 | return GNUNET_YES; | 2619 | return GNUNET_YES; |
2619 | } | 2620 | } |
2620 | 2621 | ||
2622 | |||
2621 | /** | 2623 | /** |
2622 | * Exit point from the plugin. | 2624 | * Exit point from the plugin. |
2623 | * | 2625 | * |
diff --git a/src/reclaim/plugin_rest_reclaim.c b/src/reclaim/plugin_rest_reclaim.c index 870baa7f3..a51d992e1 100644 --- a/src/reclaim/plugin_rest_reclaim.c +++ b/src/reclaim/plugin_rest_reclaim.c | |||
@@ -48,9 +48,9 @@ | |||
48 | #define GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES "/reclaim/attributes" | 48 | #define GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES "/reclaim/attributes" |
49 | 49 | ||
50 | /** | 50 | /** |
51 | * Attestation namespace | 51 | * Credential namespace |
52 | */ | 52 | */ |
53 | #define GNUNET_REST_API_NS_RECLAIM_ATTESTATION "/reclaim/attestation" | 53 | #define GNUNET_REST_API_NS_RECLAIM_CREDENTIAL "/reclaim/credential" |
54 | 54 | ||
55 | /** | 55 | /** |
56 | * Ticket namespace | 56 | * Ticket namespace |
@@ -202,7 +202,7 @@ struct RequestHandle | |||
202 | /** | 202 | /** |
203 | * Attribute iterator | 203 | * Attribute iterator |
204 | */ | 204 | */ |
205 | struct GNUNET_RECLAIM_AttestationIterator *attest_it; | 205 | struct GNUNET_RECLAIM_CredentialIterator *cred_it; |
206 | 206 | ||
207 | /** | 207 | /** |
208 | * Ticket iterator | 208 | * Ticket iterator |
@@ -282,8 +282,8 @@ cleanup_handle (void *cls) | |||
282 | GNUNET_SCHEDULER_cancel (handle->timeout_task); | 282 | GNUNET_SCHEDULER_cancel (handle->timeout_task); |
283 | if (NULL != handle->attr_it) | 283 | if (NULL != handle->attr_it) |
284 | GNUNET_RECLAIM_get_attributes_stop (handle->attr_it); | 284 | GNUNET_RECLAIM_get_attributes_stop (handle->attr_it); |
285 | if (NULL != handle->attest_it) | 285 | if (NULL != handle->cred_it) |
286 | GNUNET_RECLAIM_get_attestations_stop (handle->attest_it); | 286 | GNUNET_RECLAIM_get_credentials_stop (handle->cred_it); |
287 | if (NULL != handle->ticket_it) | 287 | if (NULL != handle->ticket_it) |
288 | GNUNET_RECLAIM_ticket_iteration_stop (handle->ticket_it); | 288 | GNUNET_RECLAIM_ticket_iteration_stop (handle->ticket_it); |
289 | if (NULL != handle->url) | 289 | if (NULL != handle->url) |
@@ -413,7 +413,7 @@ collect_finished_cb (void *cls) | |||
413 | 413 | ||
414 | // Done | 414 | // Done |
415 | handle->attr_it = NULL; | 415 | handle->attr_it = NULL; |
416 | handle->attest_it = NULL; | 416 | handle->cred_it = NULL; |
417 | handle->ticket_it = NULL; | 417 | handle->ticket_it = NULL; |
418 | GNUNET_SCHEDULER_add_now (&return_response, handle); | 418 | GNUNET_SCHEDULER_add_now (&return_response, handle); |
419 | } | 419 | } |
@@ -460,7 +460,7 @@ ticket_collect (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket) | |||
460 | 460 | ||
461 | 461 | ||
462 | static void | 462 | static void |
463 | add_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle, | 463 | add_credential_cont (struct GNUNET_REST_RequestHandle *con_handle, |
464 | const char *url, | 464 | const char *url, |
465 | void *cls) | 465 | void *cls) |
466 | { | 466 | { |
@@ -468,19 +468,19 @@ add_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
468 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity_priv; | 468 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity_priv; |
469 | const char *identity; | 469 | const char *identity; |
470 | struct EgoEntry *ego_entry; | 470 | struct EgoEntry *ego_entry; |
471 | struct GNUNET_RECLAIM_Attestation *attribute; | 471 | struct GNUNET_RECLAIM_Credential *attribute; |
472 | struct GNUNET_TIME_Relative exp; | 472 | struct GNUNET_TIME_Relative exp; |
473 | char term_data[handle->rest_handle->data_size + 1]; | 473 | char term_data[handle->rest_handle->data_size + 1]; |
474 | json_t *data_json; | 474 | json_t *data_json; |
475 | json_error_t err; | 475 | json_error_t err; |
476 | struct GNUNET_JSON_Specification attrspec[] = | 476 | struct GNUNET_JSON_Specification attrspec[] = |
477 | { GNUNET_RECLAIM_JSON_spec_claim_attest (&attribute), | 477 | { GNUNET_RECLAIM_JSON_spec_claim_cred (&attribute), |
478 | GNUNET_JSON_spec_end () }; | 478 | GNUNET_JSON_spec_end () }; |
479 | 479 | ||
480 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 480 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
481 | "Adding an attestation for %s.\n", | 481 | "Adding an credential for %s.\n", |
482 | handle->url); | 482 | handle->url); |
483 | if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION) >= strlen ( | 483 | if (strlen (GNUNET_REST_API_NS_RECLAIM_CREDENTIAL) >= strlen ( |
484 | handle->url)) | 484 | handle->url)) |
485 | { | 485 | { |
486 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No identity given.\n"); | 486 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No identity given.\n"); |
@@ -488,7 +488,7 @@ add_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
488 | return; | 488 | return; |
489 | } | 489 | } |
490 | identity = handle->url + strlen ( | 490 | identity = handle->url + strlen ( |
491 | GNUNET_REST_API_NS_RECLAIM_ATTESTATION) + 1; | 491 | GNUNET_REST_API_NS_RECLAIM_CREDENTIAL) + 1; |
492 | 492 | ||
493 | for (ego_entry = ego_head; NULL != ego_entry; | 493 | for (ego_entry = ego_head; NULL != ego_entry; |
494 | ego_entry = ego_entry->next) | 494 | ego_entry = ego_entry->next) |
@@ -518,7 +518,7 @@ add_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
518 | if (NULL == attribute) | 518 | if (NULL == attribute) |
519 | { | 519 | { |
520 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 520 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
521 | "Unable to parse attestation from %s\n", | 521 | "Unable to parse credential from %s\n", |
522 | term_data); | 522 | term_data); |
523 | GNUNET_SCHEDULER_add_now (&do_error, handle); | 523 | GNUNET_SCHEDULER_add_now (&do_error, handle); |
524 | return; | 524 | return; |
@@ -529,7 +529,7 @@ add_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
529 | if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&attribute->id)) | 529 | if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&attribute->id)) |
530 | GNUNET_RECLAIM_id_generate (&attribute->id); | 530 | GNUNET_RECLAIM_id_generate (&attribute->id); |
531 | exp = GNUNET_TIME_UNIT_HOURS; | 531 | exp = GNUNET_TIME_UNIT_HOURS; |
532 | handle->idp_op = GNUNET_RECLAIM_attestation_store (idp, | 532 | handle->idp_op = GNUNET_RECLAIM_credential_store (idp, |
533 | identity_priv, | 533 | identity_priv, |
534 | attribute, | 534 | attribute, |
535 | &exp, | 535 | &exp, |
@@ -540,52 +540,52 @@ add_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
540 | 540 | ||
541 | 541 | ||
542 | /** | 542 | /** |
543 | * Collect all attestations for an ego | 543 | * Collect all credentials for an ego |
544 | * | 544 | * |
545 | */ | 545 | */ |
546 | static void | 546 | static void |
547 | attest_collect (void *cls, | 547 | cred_collect (void *cls, |
548 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, | 548 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, |
549 | const struct GNUNET_RECLAIM_Attestation *attest) | 549 | const struct GNUNET_RECLAIM_Credential *cred) |
550 | { | 550 | { |
551 | struct RequestHandle *handle = cls; | 551 | struct RequestHandle *handle = cls; |
552 | struct GNUNET_RECLAIM_AttributeList *attrs; | 552 | struct GNUNET_RECLAIM_AttributeList *attrs; |
553 | struct GNUNET_RECLAIM_AttributeListEntry *ale; | 553 | struct GNUNET_RECLAIM_AttributeListEntry *ale; |
554 | struct GNUNET_TIME_Absolute exp; | 554 | struct GNUNET_TIME_Absolute exp; |
555 | json_t *attr_obj; | 555 | json_t *attr_obj; |
556 | json_t *attest_obj; | 556 | json_t *cred_obj; |
557 | const char *type; | 557 | const char *type; |
558 | char *tmp_value; | 558 | char *tmp_value; |
559 | char *id_str; | 559 | char *id_str; |
560 | char *issuer; | 560 | char *issuer; |
561 | 561 | ||
562 | 562 | ||
563 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attestation: %s\n", | 563 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding credential: %s\n", |
564 | attest->name); | 564 | cred->name); |
565 | attrs = GNUNET_RECLAIM_attestation_get_attributes (attest); | 565 | attrs = GNUNET_RECLAIM_credential_get_attributes (cred); |
566 | issuer = GNUNET_RECLAIM_attestation_get_issuer (attest); | 566 | issuer = GNUNET_RECLAIM_credential_get_issuer (cred); |
567 | tmp_value = GNUNET_RECLAIM_attestation_value_to_string (attest->type, | 567 | tmp_value = GNUNET_RECLAIM_credential_value_to_string (cred->type, |
568 | attest->data, | 568 | cred->data, |
569 | attest->data_size); | 569 | cred->data_size); |
570 | attest_obj = json_object (); | 570 | cred_obj = json_object (); |
571 | json_object_set_new (attest_obj, "value", json_string (tmp_value)); | 571 | json_object_set_new (cred_obj, "value", json_string (tmp_value)); |
572 | json_object_set_new (attest_obj, "name", json_string (attest->name)); | 572 | json_object_set_new (cred_obj, "name", json_string (cred->name)); |
573 | type = GNUNET_RECLAIM_attestation_number_to_typename (attest->type); | 573 | type = GNUNET_RECLAIM_credential_number_to_typename (cred->type); |
574 | json_object_set_new (attest_obj, "type", json_string (type)); | 574 | json_object_set_new (cred_obj, "type", json_string (type)); |
575 | if (NULL != issuer) | 575 | if (NULL != issuer) |
576 | { | 576 | { |
577 | json_object_set_new (attest_obj, "issuer", json_string (issuer)); | 577 | json_object_set_new (cred_obj, "issuer", json_string (issuer)); |
578 | GNUNET_free (issuer); | 578 | GNUNET_free (issuer); |
579 | } | 579 | } |
580 | if (GNUNET_OK == GNUNET_RECLAIM_attestation_get_expiration (attest, | 580 | if (GNUNET_OK == GNUNET_RECLAIM_credential_get_expiration (cred, |
581 | &exp)) | 581 | &exp)) |
582 | { | 582 | { |
583 | json_object_set_new (attest_obj, "expiration", json_integer ( | 583 | json_object_set_new (cred_obj, "expiration", json_integer ( |
584 | exp.abs_value_us)); | 584 | exp.abs_value_us)); |
585 | } | 585 | } |
586 | id_str = GNUNET_STRINGS_data_to_string_alloc (&attest->id, | 586 | id_str = GNUNET_STRINGS_data_to_string_alloc (&cred->id, |
587 | sizeof(attest->id)); | 587 | sizeof(cred->id)); |
588 | json_object_set_new (attest_obj, "id", json_string (id_str)); | 588 | json_object_set_new (cred_obj, "id", json_string (id_str)); |
589 | GNUNET_free (tmp_value); | 589 | GNUNET_free (tmp_value); |
590 | GNUNET_free (id_str); | 590 | GNUNET_free (id_str); |
591 | if (NULL != attrs) | 591 | if (NULL != attrs) |
@@ -606,27 +606,27 @@ attest_collect (void *cls, | |||
606 | type = GNUNET_RECLAIM_attribute_number_to_typename (ale->attribute->type); | 606 | type = GNUNET_RECLAIM_attribute_number_to_typename (ale->attribute->type); |
607 | json_object_set_new (attr_obj, "type", json_string (type)); | 607 | json_object_set_new (attr_obj, "type", json_string (type)); |
608 | json_object_set_new (attr_obj, "id", json_string ("")); | 608 | json_object_set_new (attr_obj, "id", json_string ("")); |
609 | json_object_set_new (attr_obj, "attestation", json_string ("")); | 609 | json_object_set_new (attr_obj, "credential", json_string ("")); |
610 | json_array_append_new (attr_arr, attr_obj); | 610 | json_array_append_new (attr_arr, attr_obj); |
611 | GNUNET_free (tmp_value); | 611 | GNUNET_free (tmp_value); |
612 | } | 612 | } |
613 | json_object_set_new (attest_obj, "attributes", attr_arr); | 613 | json_object_set_new (cred_obj, "attributes", attr_arr); |
614 | } | 614 | } |
615 | json_array_append_new (handle->resp_object, attest_obj); | 615 | json_array_append_new (handle->resp_object, cred_obj); |
616 | GNUNET_RECLAIM_attribute_list_destroy (attrs); | 616 | GNUNET_RECLAIM_attribute_list_destroy (attrs); |
617 | GNUNET_RECLAIM_get_attestations_next (handle->attest_it); | 617 | GNUNET_RECLAIM_get_credentials_next (handle->cred_it); |
618 | } | 618 | } |
619 | 619 | ||
620 | 620 | ||
621 | /** | 621 | /** |
622 | * Lists attestation for identity request | 622 | * Lists credential for identity request |
623 | * | 623 | * |
624 | * @param con_handle the connection handle | 624 | * @param con_handle the connection handle |
625 | * @param url the url | 625 | * @param url the url |
626 | * @param cls the RequestHandle | 626 | * @param cls the RequestHandle |
627 | */ | 627 | */ |
628 | static void | 628 | static void |
629 | list_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle, | 629 | list_credential_cont (struct GNUNET_REST_RequestHandle *con_handle, |
630 | const char *url, | 630 | const char *url, |
631 | void *cls) | 631 | void *cls) |
632 | { | 632 | { |
@@ -636,9 +636,9 @@ list_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
636 | char *identity; | 636 | char *identity; |
637 | 637 | ||
638 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 638 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
639 | "Getting attestations for %s.\n", | 639 | "Getting credentials for %s.\n", |
640 | handle->url); | 640 | handle->url); |
641 | if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION) >= strlen ( | 641 | if (strlen (GNUNET_REST_API_NS_RECLAIM_CREDENTIAL) >= strlen ( |
642 | handle->url)) | 642 | handle->url)) |
643 | { | 643 | { |
644 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No identity given.\n"); | 644 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No identity given.\n"); |
@@ -646,7 +646,7 @@ list_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
646 | return; | 646 | return; |
647 | } | 647 | } |
648 | identity = handle->url + strlen ( | 648 | identity = handle->url + strlen ( |
649 | GNUNET_REST_API_NS_RECLAIM_ATTESTATION) + 1; | 649 | GNUNET_REST_API_NS_RECLAIM_CREDENTIAL) + 1; |
650 | 650 | ||
651 | for (ego_entry = ego_head; NULL != ego_entry; | 651 | for (ego_entry = ego_head; NULL != ego_entry; |
652 | ego_entry = ego_entry->next) | 652 | ego_entry = ego_entry->next) |
@@ -663,11 +663,11 @@ list_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
663 | return; | 663 | return; |
664 | } | 664 | } |
665 | priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego); | 665 | priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego); |
666 | handle->attest_it = GNUNET_RECLAIM_get_attestations_start (idp, | 666 | handle->cred_it = GNUNET_RECLAIM_get_credentials_start (idp, |
667 | priv_key, | 667 | priv_key, |
668 | &collect_error_cb, | 668 | &collect_error_cb, |
669 | handle, | 669 | handle, |
670 | &attest_collect, | 670 | &cred_collect, |
671 | handle, | 671 | handle, |
672 | & | 672 | & |
673 | collect_finished_cb, | 673 | collect_finished_cb, |
@@ -676,27 +676,27 @@ list_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
676 | 676 | ||
677 | 677 | ||
678 | /** | 678 | /** |
679 | * Deletes attestation from an identity | 679 | * Deletes credential from an identity |
680 | * | 680 | * |
681 | * @param con_handle the connection handle | 681 | * @param con_handle the connection handle |
682 | * @param url the url | 682 | * @param url the url |
683 | * @param cls the RequestHandle | 683 | * @param cls the RequestHandle |
684 | */ | 684 | */ |
685 | static void | 685 | static void |
686 | delete_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle, | 686 | delete_credential_cont (struct GNUNET_REST_RequestHandle *con_handle, |
687 | const char *url, | 687 | const char *url, |
688 | void *cls) | 688 | void *cls) |
689 | { | 689 | { |
690 | struct RequestHandle *handle = cls; | 690 | struct RequestHandle *handle = cls; |
691 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key; | 691 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key; |
692 | struct GNUNET_RECLAIM_Attestation attr; | 692 | struct GNUNET_RECLAIM_Credential attr; |
693 | struct EgoEntry *ego_entry; | 693 | struct EgoEntry *ego_entry; |
694 | char *identity_id_str; | 694 | char *identity_id_str; |
695 | char *identity; | 695 | char *identity; |
696 | char *id; | 696 | char *id; |
697 | 697 | ||
698 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Deleting attestation.\n"); | 698 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Deleting credential.\n"); |
699 | if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION) >= strlen ( | 699 | if (strlen (GNUNET_REST_API_NS_RECLAIM_CREDENTIAL) >= strlen ( |
700 | handle->url)) | 700 | handle->url)) |
701 | { | 701 | { |
702 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No identity given.\n"); | 702 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No identity given.\n"); |
@@ -705,7 +705,7 @@ delete_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
705 | } | 705 | } |
706 | identity_id_str = | 706 | identity_id_str = |
707 | strdup (handle->url + strlen ( | 707 | strdup (handle->url + strlen ( |
708 | GNUNET_REST_API_NS_RECLAIM_ATTESTATION) + 1); | 708 | GNUNET_REST_API_NS_RECLAIM_CREDENTIAL) + 1); |
709 | identity = strtok (identity_id_str, "/"); | 709 | identity = strtok (identity_id_str, "/"); |
710 | id = strtok (NULL, "/"); | 710 | id = strtok (NULL, "/"); |
711 | if ((NULL == identity) || (NULL == id)) | 711 | if ((NULL == identity) || (NULL == id)) |
@@ -730,10 +730,10 @@ delete_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
730 | return; | 730 | return; |
731 | } | 731 | } |
732 | priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego); | 732 | priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego); |
733 | memset (&attr, 0, sizeof(struct GNUNET_RECLAIM_Attestation)); | 733 | memset (&attr, 0, sizeof(struct GNUNET_RECLAIM_Credential)); |
734 | GNUNET_STRINGS_string_to_data (id, strlen (id), &attr.id, sizeof(attr.id)); | 734 | GNUNET_STRINGS_string_to_data (id, strlen (id), &attr.id, sizeof(attr.id)); |
735 | attr.name = ""; | 735 | attr.name = ""; |
736 | handle->idp_op = GNUNET_RECLAIM_attestation_delete (idp, | 736 | handle->idp_op = GNUNET_RECLAIM_credential_delete (idp, |
737 | priv_key, | 737 | priv_key, |
738 | &attr, | 738 | &attr, |
739 | &delete_finished_cb, | 739 | &delete_finished_cb, |
@@ -877,13 +877,13 @@ add_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
877 | /** | 877 | /** |
878 | * Parse a JWT and return the respective claim value as Attribute | 878 | * Parse a JWT and return the respective claim value as Attribute |
879 | * | 879 | * |
880 | * @param attest the jwt attestation | 880 | * @param cred the jwt credential |
881 | * @param claim the name of the claim in the JWT | 881 | * @param claim the name of the claim in the JWT |
882 | * | 882 | * |
883 | * @return a GNUNET_RECLAIM_Attribute, containing the new value | 883 | * @return a GNUNET_RECLAIM_Attribute, containing the new value |
884 | */ | 884 | */ |
885 | struct GNUNET_RECLAIM_Attribute * | 885 | struct GNUNET_RECLAIM_Attribute * |
886 | parse_jwt (const struct GNUNET_RECLAIM_Attestation *attest, | 886 | parse_jwt (const struct GNUNET_RECLAIM_Credential *cred, |
887 | const char *claim) | 887 | const char *claim) |
888 | { | 888 | { |
889 | char *jwt_string; | 889 | char *jwt_string; |
@@ -899,9 +899,9 @@ parse_jwt (const struct GNUNET_RECLAIM_Attestation *attest, | |||
899 | json_t *json_val; | 899 | json_t *json_val; |
900 | json_error_t *json_err = NULL; | 900 | json_error_t *json_err = NULL; |
901 | 901 | ||
902 | jwt_string = GNUNET_RECLAIM_attestation_value_to_string (attest->type, | 902 | jwt_string = GNUNET_RECLAIM_credential_value_to_string (cred->type, |
903 | attest->data, | 903 | cred->data, |
904 | attest->data_size); | 904 | cred->data_size); |
905 | char *jwt_body = strtok (jwt_string, delim); | 905 | char *jwt_body = strtok (jwt_string, delim); |
906 | jwt_body = strtok (NULL, delim); | 906 | jwt_body = strtok (NULL, delim); |
907 | GNUNET_STRINGS_base64_decode (jwt_body, strlen (jwt_body), | 907 | GNUNET_STRINGS_base64_decode (jwt_body, strlen (jwt_body), |
@@ -927,16 +927,16 @@ parse_jwt (const struct GNUNET_RECLAIM_Attestation *attest, | |||
927 | "Error: Referenced Claim Name not Found", | 927 | "Error: Referenced Claim Name not Found", |
928 | (void **) &data, | 928 | (void **) &data, |
929 | &data_size); | 929 | &data_size); |
930 | attr = GNUNET_RECLAIM_attribute_new (claim, &attest->id, | 930 | attr = GNUNET_RECLAIM_attribute_new (claim, &cred->id, |
931 | type, data, data_size); | 931 | type, data, data_size); |
932 | attr->id = attest->id; | 932 | attr->id = cred->id; |
933 | attr->flag = 1; | 933 | attr->flag = 1; |
934 | } | 934 | } |
935 | else | 935 | else |
936 | { | 936 | { |
937 | attr = GNUNET_RECLAIM_attribute_new (claim, &attest->id, | 937 | attr = GNUNET_RECLAIM_attribute_new (claim, &cred->id, |
938 | type, data, data_size); | 938 | type, data, data_size); |
939 | attr->id = attest->id; | 939 | attr->id = cred->id; |
940 | attr->flag = 1; | 940 | attr->flag = 1; |
941 | } | 941 | } |
942 | return attr; | 942 | return attr; |
@@ -965,7 +965,7 @@ attr_collect (void *cls, | |||
965 | json_object_set_new (attr_obj, "value", json_string (tmp_value)); | 965 | json_object_set_new (attr_obj, "value", json_string (tmp_value)); |
966 | json_object_set_new (attr_obj, "name", json_string (attr->name)); | 966 | json_object_set_new (attr_obj, "name", json_string (attr->name)); |
967 | 967 | ||
968 | if (GNUNET_RECLAIM_id_is_zero (&attr->attestation)) | 968 | if (GNUNET_RECLAIM_id_is_zero (&attr->credential)) |
969 | json_object_set_new (attr_obj, "flag", json_string ("0")); | 969 | json_object_set_new (attr_obj, "flag", json_string ("0")); |
970 | else | 970 | else |
971 | json_object_set_new (attr_obj, "flag", json_string ("1")); | 971 | json_object_set_new (attr_obj, "flag", json_string ("1")); |
@@ -974,9 +974,9 @@ attr_collect (void *cls, | |||
974 | id_str = GNUNET_STRINGS_data_to_string_alloc (&attr->id, | 974 | id_str = GNUNET_STRINGS_data_to_string_alloc (&attr->id, |
975 | sizeof(attr->id)); | 975 | sizeof(attr->id)); |
976 | json_object_set_new (attr_obj, "id", json_string (id_str)); | 976 | json_object_set_new (attr_obj, "id", json_string (id_str)); |
977 | id_str = GNUNET_STRINGS_data_to_string_alloc (&attr->attestation, | 977 | id_str = GNUNET_STRINGS_data_to_string_alloc (&attr->credential, |
978 | sizeof(attr->attestation)); | 978 | sizeof(attr->credential)); |
979 | json_object_set_new (attr_obj, "attestation", json_string (id_str)); | 979 | json_object_set_new (attr_obj, "credential", json_string (id_str)); |
980 | json_array_append (handle->resp_object, attr_obj); | 980 | json_array_append (handle->resp_object, attr_obj); |
981 | json_decref (attr_obj); | 981 | json_decref (attr_obj); |
982 | GNUNET_free (tmp_value); | 982 | GNUNET_free (tmp_value); |
@@ -1180,7 +1180,7 @@ static void | |||
1180 | consume_cont (void *cls, | 1180 | consume_cont (void *cls, |
1181 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, | 1181 | const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, |
1182 | const struct GNUNET_RECLAIM_Attribute *attr, | 1182 | const struct GNUNET_RECLAIM_Attribute *attr, |
1183 | const struct GNUNET_RECLAIM_Attestation *attest) | 1183 | const struct GNUNET_RECLAIM_Credential *cred) |
1184 | { | 1184 | { |
1185 | struct RequestHandle *handle = cls; | 1185 | struct RequestHandle *handle = cls; |
1186 | char *val_str; | 1186 | char *val_str; |
@@ -1427,11 +1427,11 @@ rest_identity_process_request (struct GNUNET_REST_RequestHandle *rest_handle, | |||
1427 | { MHD_HTTP_METHOD_DELETE, | 1427 | { MHD_HTTP_METHOD_DELETE, |
1428 | GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES, &delete_attribute_cont }, | 1428 | GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES, &delete_attribute_cont }, |
1429 | { MHD_HTTP_METHOD_GET, | 1429 | { MHD_HTTP_METHOD_GET, |
1430 | GNUNET_REST_API_NS_RECLAIM_ATTESTATION, &list_attestation_cont }, | 1430 | GNUNET_REST_API_NS_RECLAIM_CREDENTIAL, &list_credential_cont }, |
1431 | { MHD_HTTP_METHOD_POST, | 1431 | { MHD_HTTP_METHOD_POST, |
1432 | GNUNET_REST_API_NS_RECLAIM_ATTESTATION, &add_attestation_cont }, | 1432 | GNUNET_REST_API_NS_RECLAIM_CREDENTIAL, &add_credential_cont }, |
1433 | { MHD_HTTP_METHOD_DELETE, | 1433 | { MHD_HTTP_METHOD_DELETE, |
1434 | GNUNET_REST_API_NS_RECLAIM_ATTESTATION, &delete_attestation_cont }, | 1434 | GNUNET_REST_API_NS_RECLAIM_CREDENTIAL, &delete_credential_cont }, |
1435 | { MHD_HTTP_METHOD_GET, | 1435 | { MHD_HTTP_METHOD_GET, |
1436 | GNUNET_REST_API_NS_IDENTITY_TICKETS, &list_tickets_cont }, | 1436 | GNUNET_REST_API_NS_IDENTITY_TICKETS, &list_tickets_cont }, |
1437 | { MHD_HTTP_METHOD_POST, | 1437 | { MHD_HTTP_METHOD_POST, |
diff --git a/src/reclaim/reclaim.h b/src/reclaim/reclaim.h index 7b5d7ab19..6ba9fdcd7 100644 --- a/src/reclaim/reclaim.h +++ b/src/reclaim/reclaim.h | |||
@@ -139,9 +139,9 @@ struct AttributeResultMessage | |||
139 | uint16_t attr_len GNUNET_PACKED; | 139 | uint16_t attr_len GNUNET_PACKED; |
140 | 140 | ||
141 | /** | 141 | /** |
142 | * Length of serialized attestation data | 142 | * Length of serialized credential data |
143 | */ | 143 | */ |
144 | uint16_t attestation_len GNUNET_PACKED; | 144 | uint16_t credential_len GNUNET_PACKED; |
145 | 145 | ||
146 | /** | 146 | /** |
147 | * always zero (for alignment) | 147 | * always zero (for alignment) |
@@ -159,9 +159,9 @@ struct AttributeResultMessage | |||
159 | }; | 159 | }; |
160 | 160 | ||
161 | /** | 161 | /** |
162 | * Attestation is returned from the idp. | 162 | * Credential is returned from the idp. |
163 | */ | 163 | */ |
164 | struct AttestationResultMessage | 164 | struct CredentialResultMessage |
165 | { | 165 | { |
166 | /** | 166 | /** |
167 | * Message header | 167 | * Message header |
@@ -176,7 +176,7 @@ struct AttestationResultMessage | |||
176 | /** | 176 | /** |
177 | * Length of serialized attribute data | 177 | * Length of serialized attribute data |
178 | */ | 178 | */ |
179 | uint16_t attestation_len GNUNET_PACKED; | 179 | uint16_t credential_len GNUNET_PACKED; |
180 | 180 | ||
181 | /** | 181 | /** |
182 | * always zero (for alignment) | 182 | * always zero (for alignment) |
@@ -189,7 +189,7 @@ struct AttestationResultMessage | |||
189 | struct GNUNET_CRYPTO_EcdsaPublicKey identity; | 189 | struct GNUNET_CRYPTO_EcdsaPublicKey identity; |
190 | 190 | ||
191 | /* followed by: | 191 | /* followed by: |
192 | * serialized attestation data | 192 | * serialized credential data |
193 | */ | 193 | */ |
194 | }; | 194 | }; |
195 | 195 | ||
@@ -234,9 +234,9 @@ struct AttributeIterationNextMessage | |||
234 | 234 | ||
235 | 235 | ||
236 | /** | 236 | /** |
237 | * Start a attestation iteration for the given identity | 237 | * Start a credential iteration for the given identity |
238 | */ | 238 | */ |
239 | struct AttestationIterationStartMessage | 239 | struct CredentialIterationStartMessage |
240 | { | 240 | { |
241 | /** | 241 | /** |
242 | * Message | 242 | * Message |
@@ -256,9 +256,9 @@ struct AttestationIterationStartMessage | |||
256 | 256 | ||
257 | 257 | ||
258 | /** | 258 | /** |
259 | * Ask for next result of attestation iteration for the given operation | 259 | * Ask for next result of credential iteration for the given operation |
260 | */ | 260 | */ |
261 | struct AttestationIterationNextMessage | 261 | struct CredentialIterationNextMessage |
262 | { | 262 | { |
263 | /** | 263 | /** |
264 | * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT | 264 | * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT |
@@ -273,9 +273,9 @@ struct AttestationIterationNextMessage | |||
273 | 273 | ||
274 | 274 | ||
275 | /** | 275 | /** |
276 | * Stop attestation iteration for the given operation | 276 | * Stop credential iteration for the given operation |
277 | */ | 277 | */ |
278 | struct AttestationIterationStopMessage | 278 | struct CredentialIterationStopMessage |
279 | { | 279 | { |
280 | /** | 280 | /** |
281 | * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP | 281 | * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP |
@@ -520,9 +520,9 @@ struct ConsumeTicketResultMessage | |||
520 | uint16_t attrs_len GNUNET_PACKED; | 520 | uint16_t attrs_len GNUNET_PACKED; |
521 | 521 | ||
522 | /** | 522 | /** |
523 | * Length of attestation data | 523 | * Length of presentation data |
524 | */ | 524 | */ |
525 | uint16_t attestations_len; | 525 | uint16_t presentations_len; |
526 | 526 | ||
527 | /** | 527 | /** |
528 | * always zero (for alignment) | 528 | * always zero (for alignment) |
diff --git a/src/reclaim/reclaim_api.c b/src/reclaim/reclaim_api.c index b432b4f2a..2cfcbad09 100644 --- a/src/reclaim/reclaim_api.c +++ b/src/reclaim/reclaim_api.c | |||
@@ -77,9 +77,9 @@ struct GNUNET_RECLAIM_Operation | |||
77 | GNUNET_RECLAIM_AttributeTicketResult atr_cb; | 77 | GNUNET_RECLAIM_AttributeTicketResult atr_cb; |
78 | 78 | ||
79 | /** | 79 | /** |
80 | * Attestation result callback | 80 | * Credential result callback |
81 | */ | 81 | */ |
82 | GNUNET_RECLAIM_AttestationResult at_cb; | 82 | GNUNET_RECLAIM_CredentialResult at_cb; |
83 | 83 | ||
84 | /** | 84 | /** |
85 | * Revocation result callback | 85 | * Revocation result callback |
@@ -239,19 +239,19 @@ struct GNUNET_RECLAIM_AttributeIterator | |||
239 | }; | 239 | }; |
240 | 240 | ||
241 | /** | 241 | /** |
242 | * Handle for a attestation iterator operation | 242 | * Handle for a credential iterator operation |
243 | */ | 243 | */ |
244 | struct GNUNET_RECLAIM_AttestationIterator | 244 | struct GNUNET_RECLAIM_CredentialIterator |
245 | { | 245 | { |
246 | /** | 246 | /** |
247 | * Kept in a DLL. | 247 | * Kept in a DLL. |
248 | */ | 248 | */ |
249 | struct GNUNET_RECLAIM_AttestationIterator *next; | 249 | struct GNUNET_RECLAIM_CredentialIterator *next; |
250 | 250 | ||
251 | /** | 251 | /** |
252 | * Kept in a DLL. | 252 | * Kept in a DLL. |
253 | */ | 253 | */ |
254 | struct GNUNET_RECLAIM_AttestationIterator *prev; | 254 | struct GNUNET_RECLAIM_CredentialIterator *prev; |
255 | 255 | ||
256 | /** | 256 | /** |
257 | * Main handle to access the service. | 257 | * Main handle to access the service. |
@@ -271,7 +271,7 @@ struct GNUNET_RECLAIM_AttestationIterator | |||
271 | /** | 271 | /** |
272 | * The continuation to call with the results | 272 | * The continuation to call with the results |
273 | */ | 273 | */ |
274 | GNUNET_RECLAIM_AttestationResult proc; | 274 | GNUNET_RECLAIM_CredentialResult proc; |
275 | 275 | ||
276 | /** | 276 | /** |
277 | * Closure for @e proc. | 277 | * Closure for @e proc. |
@@ -349,12 +349,12 @@ struct GNUNET_RECLAIM_Handle | |||
349 | /** | 349 | /** |
350 | * Head of active iterations | 350 | * Head of active iterations |
351 | */ | 351 | */ |
352 | struct GNUNET_RECLAIM_AttestationIterator *ait_head; | 352 | struct GNUNET_RECLAIM_CredentialIterator *ait_head; |
353 | 353 | ||
354 | /** | 354 | /** |
355 | * Tail of active iterations | 355 | * Tail of active iterations |
356 | */ | 356 | */ |
357 | struct GNUNET_RECLAIM_AttestationIterator *ait_tail; | 357 | struct GNUNET_RECLAIM_CredentialIterator *ait_tail; |
358 | 358 | ||
359 | /** | 359 | /** |
360 | * Head of active iterations | 360 | * Head of active iterations |
@@ -464,7 +464,7 @@ free_it (struct GNUNET_RECLAIM_AttributeIterator *it) | |||
464 | * @param ait entry to free | 464 | * @param ait entry to free |
465 | */ | 465 | */ |
466 | static void | 466 | static void |
467 | free_ait (struct GNUNET_RECLAIM_AttestationIterator *ait) | 467 | free_ait (struct GNUNET_RECLAIM_CredentialIterator *ait) |
468 | { | 468 | { |
469 | struct GNUNET_RECLAIM_Handle *h = ait->h; | 469 | struct GNUNET_RECLAIM_Handle *h = ait->h; |
470 | 470 | ||
@@ -561,13 +561,13 @@ check_consume_ticket_result (void *cls, | |||
561 | { | 561 | { |
562 | size_t msg_len; | 562 | size_t msg_len; |
563 | size_t attrs_len; | 563 | size_t attrs_len; |
564 | size_t attests_len; | 564 | size_t pl_len; |
565 | 565 | ||
566 | msg_len = ntohs (msg->header.size); | 566 | msg_len = ntohs (msg->header.size); |
567 | attrs_len = ntohs (msg->attrs_len); | 567 | attrs_len = ntohs (msg->attrs_len); |
568 | attests_len = ntohs (msg->attestations_len); | 568 | pl_len = ntohs (msg->presentations_len); |
569 | if (msg_len != | 569 | if (msg_len != |
570 | sizeof(struct ConsumeTicketResultMessage) + attrs_len + attests_len) | 570 | sizeof(struct ConsumeTicketResultMessage) + attrs_len + pl_len) |
571 | { | 571 | { |
572 | GNUNET_break (0); | 572 | GNUNET_break (0); |
573 | return GNUNET_SYSERR; | 573 | return GNUNET_SYSERR; |
@@ -590,12 +590,12 @@ handle_consume_ticket_result (void *cls, | |||
590 | struct GNUNET_RECLAIM_Handle *h = cls; | 590 | struct GNUNET_RECLAIM_Handle *h = cls; |
591 | struct GNUNET_RECLAIM_Operation *op; | 591 | struct GNUNET_RECLAIM_Operation *op; |
592 | size_t attrs_len; | 592 | size_t attrs_len; |
593 | size_t attests_len; | 593 | size_t pl_len; |
594 | uint32_t r_id = ntohl (msg->id); | 594 | uint32_t r_id = ntohl (msg->id); |
595 | char *read_ptr; | 595 | char *read_ptr; |
596 | 596 | ||
597 | attrs_len = ntohs (msg->attrs_len); | 597 | attrs_len = ntohs (msg->attrs_len); |
598 | attests_len = ntohs (msg->attestations_len); | 598 | pl_len = ntohs (msg->presentations_len); |
599 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Processing ticket result.\n"); | 599 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Processing ticket result.\n"); |
600 | 600 | ||
601 | 601 | ||
@@ -608,13 +608,12 @@ handle_consume_ticket_result (void *cls, | |||
608 | { | 608 | { |
609 | struct GNUNET_RECLAIM_AttributeList *attrs; | 609 | struct GNUNET_RECLAIM_AttributeList *attrs; |
610 | struct GNUNET_RECLAIM_AttributeListEntry *le; | 610 | struct GNUNET_RECLAIM_AttributeListEntry *le; |
611 | struct GNUNET_RECLAIM_AttestationList *attests; | 611 | struct GNUNET_RECLAIM_PresentationList *pl; |
612 | struct GNUNET_RECLAIM_AttestationListEntry *ale; | 612 | struct GNUNET_RECLAIM_PresentationListEntry *ple; |
613 | attrs = | 613 | attrs = |
614 | GNUNET_RECLAIM_attribute_list_deserialize ((char *) &msg[1], attrs_len); | 614 | GNUNET_RECLAIM_attribute_list_deserialize ((char *) &msg[1], attrs_len); |
615 | read_ptr = ((char *) &msg[1]) + attrs_len; | 615 | read_ptr = ((char *) &msg[1]) + attrs_len; |
616 | attests = | 616 | pl = GNUNET_RECLAIM_presentation_list_deserialize (read_ptr, pl_len); |
617 | GNUNET_RECLAIM_attestation_list_deserialize (read_ptr, attests_len); | ||
618 | if (NULL != op->atr_cb) | 617 | if (NULL != op->atr_cb) |
619 | { | 618 | { |
620 | if (NULL == attrs) | 619 | if (NULL == attrs) |
@@ -626,22 +625,22 @@ handle_consume_ticket_result (void *cls, | |||
626 | for (le = attrs->list_head; NULL != le; le = le->next) | 625 | for (le = attrs->list_head; NULL != le; le = le->next) |
627 | { | 626 | { |
628 | if (GNUNET_NO == | 627 | if (GNUNET_NO == |
629 | GNUNET_RECLAIM_id_is_zero (&le->attribute->attestation)) | 628 | GNUNET_RECLAIM_id_is_zero (&le->attribute->credential)) |
630 | { | 629 | { |
631 | for (ale = attests->list_head; NULL != ale; ale = ale->next) | 630 | for (ple = pl->list_head; NULL != ple; ple = ple->next) |
632 | { | 631 | { |
633 | if (GNUNET_YES == | 632 | if (GNUNET_YES == |
634 | GNUNET_RECLAIM_id_is_equal (&le->attribute->attestation, | 633 | GNUNET_RECLAIM_id_is_equal (&le->attribute->credential, |
635 | &ale->attestation->id)) | 634 | &ple->presentation->credential_id)) |
636 | { | 635 | { |
637 | op->atr_cb (op->cls, &msg->identity, | 636 | op->atr_cb (op->cls, &msg->identity, |
638 | le->attribute, ale->attestation); | 637 | le->attribute, ple->presentation); |
639 | break; | 638 | break; |
640 | } | 639 | } |
641 | 640 | ||
642 | } | 641 | } |
643 | } | 642 | } |
644 | else // No attestations | 643 | else // No credentials |
645 | { | 644 | { |
646 | op->atr_cb (op->cls, &msg->identity, | 645 | op->atr_cb (op->cls, &msg->identity, |
647 | le->attribute, NULL); | 646 | le->attribute, NULL); |
@@ -649,10 +648,10 @@ handle_consume_ticket_result (void *cls, | |||
649 | } | 648 | } |
650 | if (NULL != attrs) | 649 | if (NULL != attrs) |
651 | GNUNET_RECLAIM_attribute_list_destroy (attrs); | 650 | GNUNET_RECLAIM_attribute_list_destroy (attrs); |
652 | if (NULL != attests) | 651 | if (NULL != pl) |
653 | GNUNET_RECLAIM_attestation_list_destroy (attests); | 652 | GNUNET_RECLAIM_presentation_list_destroy (pl); |
654 | attrs = NULL; | 653 | attrs = NULL; |
655 | attests = NULL; | 654 | pl = NULL; |
656 | } | 655 | } |
657 | op->atr_cb (op->cls, NULL, NULL, NULL); | 656 | op->atr_cb (op->cls, NULL, NULL, NULL); |
658 | } | 657 | } |
@@ -768,21 +767,21 @@ handle_attribute_result (void *cls, const struct AttributeResultMessage *msg) | |||
768 | 767 | ||
769 | /** | 768 | /** |
770 | * Handle an incoming message of type | 769 | * Handle an incoming message of type |
771 | * #GNUNET_MESSAGE_TYPE_RECLAIM_attestation_RESULT | 770 | * #GNUNET_MESSAGE_TYPE_RECLAIM_credential_RESULT |
772 | * | 771 | * |
773 | * @param cls | 772 | * @param cls |
774 | * @param msg the message we received | 773 | * @param msg the message we received |
775 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 774 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
776 | */ | 775 | */ |
777 | static int | 776 | static int |
778 | check_attestation_result (void *cls, const struct AttestationResultMessage *msg) | 777 | check_credential_result (void *cls, const struct CredentialResultMessage *msg) |
779 | { | 778 | { |
780 | size_t msg_len; | 779 | size_t msg_len; |
781 | size_t attest_len; | 780 | size_t cred_len; |
782 | 781 | ||
783 | msg_len = ntohs (msg->header.size); | 782 | msg_len = ntohs (msg->header.size); |
784 | attest_len = ntohs (msg->attestation_len); | 783 | cred_len = ntohs (msg->credential_len); |
785 | if (msg_len != sizeof(struct AttestationResultMessage) + attest_len) | 784 | if (msg_len != sizeof(struct CredentialResultMessage) + cred_len) |
786 | { | 785 | { |
787 | GNUNET_break (0); | 786 | GNUNET_break (0); |
788 | return GNUNET_SYSERR; | 787 | return GNUNET_SYSERR; |
@@ -793,24 +792,24 @@ check_attestation_result (void *cls, const struct AttestationResultMessage *msg) | |||
793 | 792 | ||
794 | /** | 793 | /** |
795 | * Handle an incoming message of type | 794 | * Handle an incoming message of type |
796 | * #GNUNET_MESSAGE_TYPE_RECLAIM_attestation_RESULT | 795 | * #GNUNET_MESSAGE_TYPE_RECLAIM_credential_RESULT |
797 | * | 796 | * |
798 | * @param cls | 797 | * @param cls |
799 | * @param msg the message we received | 798 | * @param msg the message we received |
800 | */ | 799 | */ |
801 | static void | 800 | static void |
802 | handle_attestation_result (void *cls, const struct | 801 | handle_credential_result (void *cls, const struct |
803 | AttestationResultMessage *msg) | 802 | CredentialResultMessage *msg) |
804 | { | 803 | { |
805 | static struct GNUNET_CRYPTO_EcdsaPrivateKey identity_dummy; | 804 | static struct GNUNET_CRYPTO_EcdsaPrivateKey identity_dummy; |
806 | struct GNUNET_RECLAIM_Handle *h = cls; | 805 | struct GNUNET_RECLAIM_Handle *h = cls; |
807 | struct GNUNET_RECLAIM_AttestationIterator *it; | 806 | struct GNUNET_RECLAIM_CredentialIterator *it; |
808 | struct GNUNET_RECLAIM_Operation *op; | 807 | struct GNUNET_RECLAIM_Operation *op; |
809 | size_t att_len; | 808 | size_t att_len; |
810 | uint32_t r_id = ntohl (msg->id); | 809 | uint32_t r_id = ntohl (msg->id); |
811 | 810 | ||
812 | att_len = ntohs (msg->attestation_len); | 811 | att_len = ntohs (msg->credential_len); |
813 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing attestation result.\n"); | 812 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing credential result.\n"); |
814 | 813 | ||
815 | 814 | ||
816 | for (it = h->ait_head; NULL != it; it = it->next) | 815 | for (it = h->ait_head; NULL != it; it = it->next) |
@@ -848,8 +847,8 @@ handle_attestation_result (void *cls, const struct | |||
848 | } | 847 | } |
849 | 848 | ||
850 | { | 849 | { |
851 | struct GNUNET_RECLAIM_Attestation *att; | 850 | struct GNUNET_RECLAIM_Credential *att; |
852 | att = GNUNET_RECLAIM_attestation_deserialize ((char *) &msg[1], att_len); | 851 | att = GNUNET_RECLAIM_credential_deserialize ((char *) &msg[1], att_len); |
853 | 852 | ||
854 | if (NULL != it) | 853 | if (NULL != it) |
855 | { | 854 | { |
@@ -986,9 +985,9 @@ reconnect (struct GNUNET_RECLAIM_Handle *h) | |||
986 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT, | 985 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT, |
987 | struct AttributeResultMessage, | 986 | struct AttributeResultMessage, |
988 | h), | 987 | h), |
989 | GNUNET_MQ_hd_var_size (attestation_result, | 988 | GNUNET_MQ_hd_var_size (credential_result, |
990 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT, | 989 | GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_RESULT, |
991 | struct AttestationResultMessage, | 990 | struct CredentialResultMessage, |
992 | h), | 991 | h), |
993 | GNUNET_MQ_hd_fixed_size (ticket_result, | 992 | GNUNET_MQ_hd_fixed_size (ticket_result, |
994 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT, | 993 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT, |
@@ -1175,22 +1174,22 @@ GNUNET_RECLAIM_attribute_delete ( | |||
1175 | 1174 | ||
1176 | 1175 | ||
1177 | /** | 1176 | /** |
1178 | * Store an attestation. If the attestation is already present, | 1177 | * Store an credential. If the credential is already present, |
1179 | * it is replaced with the new attestation. | 1178 | * it is replaced with the new credential. |
1180 | * | 1179 | * |
1181 | * @param h handle to the re:claimID service | 1180 | * @param h handle to the re:claimID service |
1182 | * @param pkey private key of the identity | 1181 | * @param pkey private key of the identity |
1183 | * @param attr the attestation value | 1182 | * @param attr the credential value |
1184 | * @param exp_interval the relative expiration interval for the attestation | 1183 | * @param exp_interval the relative expiration interval for the credential |
1185 | * @param cont continuation to call when done | 1184 | * @param cont continuation to call when done |
1186 | * @param cont_cls closure for @a cont | 1185 | * @param cont_cls closure for @a cont |
1187 | * @return handle to abort the request | 1186 | * @return handle to abort the request |
1188 | */ | 1187 | */ |
1189 | struct GNUNET_RECLAIM_Operation * | 1188 | struct GNUNET_RECLAIM_Operation * |
1190 | GNUNET_RECLAIM_attestation_store ( | 1189 | GNUNET_RECLAIM_credential_store ( |
1191 | struct GNUNET_RECLAIM_Handle *h, | 1190 | struct GNUNET_RECLAIM_Handle *h, |
1192 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, | 1191 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, |
1193 | const struct GNUNET_RECLAIM_Attestation *attr, | 1192 | const struct GNUNET_RECLAIM_Credential *attr, |
1194 | const struct GNUNET_TIME_Relative *exp_interval, | 1193 | const struct GNUNET_TIME_Relative *exp_interval, |
1195 | GNUNET_RECLAIM_ContinuationWithStatus cont, | 1194 | GNUNET_RECLAIM_ContinuationWithStatus cont, |
1196 | void *cont_cls) | 1195 | void *cont_cls) |
@@ -1205,15 +1204,15 @@ GNUNET_RECLAIM_attestation_store ( | |||
1205 | op->cls = cont_cls; | 1204 | op->cls = cont_cls; |
1206 | op->r_id = h->r_id_gen++; | 1205 | op->r_id = h->r_id_gen++; |
1207 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); | 1206 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); |
1208 | attr_len = GNUNET_RECLAIM_attestation_serialize_get_size (attr); | 1207 | attr_len = GNUNET_RECLAIM_credential_serialize_get_size (attr); |
1209 | op->env = GNUNET_MQ_msg_extra (sam, | 1208 | op->env = GNUNET_MQ_msg_extra (sam, |
1210 | attr_len, | 1209 | attr_len, |
1211 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_STORE); | 1210 | GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_STORE); |
1212 | sam->identity = *pkey; | 1211 | sam->identity = *pkey; |
1213 | sam->id = htonl (op->r_id); | 1212 | sam->id = htonl (op->r_id); |
1214 | sam->exp = GNUNET_htonll (exp_interval->rel_value_us); | 1213 | sam->exp = GNUNET_htonll (exp_interval->rel_value_us); |
1215 | 1214 | ||
1216 | GNUNET_RECLAIM_attestation_serialize (attr, (char *) &sam[1]); | 1215 | GNUNET_RECLAIM_credential_serialize (attr, (char *) &sam[1]); |
1217 | 1216 | ||
1218 | sam->attr_len = htons (attr_len); | 1217 | sam->attr_len = htons (attr_len); |
1219 | if (NULL != h->mq) | 1218 | if (NULL != h->mq) |
@@ -1223,21 +1222,21 @@ GNUNET_RECLAIM_attestation_store ( | |||
1223 | 1222 | ||
1224 | 1223 | ||
1225 | /** | 1224 | /** |
1226 | * Delete an attestation. Tickets used to share this attestation are updated | 1225 | * Delete an credential. Tickets used to share this credential are updated |
1227 | * accordingly. | 1226 | * accordingly. |
1228 | * | 1227 | * |
1229 | * @param h handle to the re:claimID service | 1228 | * @param h handle to the re:claimID service |
1230 | * @param pkey Private key of the identity to add an attribute to | 1229 | * @param pkey Private key of the identity to add an attribute to |
1231 | * @param attr The attestation | 1230 | * @param attr The credential |
1232 | * @param cont Continuation to call when done | 1231 | * @param cont Continuation to call when done |
1233 | * @param cont_cls Closure for @a cont | 1232 | * @param cont_cls Closure for @a cont |
1234 | * @return handle Used to to abort the request | 1233 | * @return handle Used to to abort the request |
1235 | */ | 1234 | */ |
1236 | struct GNUNET_RECLAIM_Operation * | 1235 | struct GNUNET_RECLAIM_Operation * |
1237 | GNUNET_RECLAIM_attestation_delete ( | 1236 | GNUNET_RECLAIM_credential_delete ( |
1238 | struct GNUNET_RECLAIM_Handle *h, | 1237 | struct GNUNET_RECLAIM_Handle *h, |
1239 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, | 1238 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, |
1240 | const struct GNUNET_RECLAIM_Attestation *attr, | 1239 | const struct GNUNET_RECLAIM_Credential *attr, |
1241 | GNUNET_RECLAIM_ContinuationWithStatus cont, | 1240 | GNUNET_RECLAIM_ContinuationWithStatus cont, |
1242 | void *cont_cls) | 1241 | void *cont_cls) |
1243 | { | 1242 | { |
@@ -1251,13 +1250,13 @@ GNUNET_RECLAIM_attestation_delete ( | |||
1251 | op->cls = cont_cls; | 1250 | op->cls = cont_cls; |
1252 | op->r_id = h->r_id_gen++; | 1251 | op->r_id = h->r_id_gen++; |
1253 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); | 1252 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); |
1254 | attr_len = GNUNET_RECLAIM_attestation_serialize_get_size (attr); | 1253 | attr_len = GNUNET_RECLAIM_credential_serialize_get_size (attr); |
1255 | op->env = GNUNET_MQ_msg_extra (dam, | 1254 | op->env = GNUNET_MQ_msg_extra (dam, |
1256 | attr_len, | 1255 | attr_len, |
1257 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_DELETE); | 1256 | GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_DELETE); |
1258 | dam->identity = *pkey; | 1257 | dam->identity = *pkey; |
1259 | dam->id = htonl (op->r_id); | 1258 | dam->id = htonl (op->r_id); |
1260 | GNUNET_RECLAIM_attestation_serialize (attr, (char *) &dam[1]); | 1259 | GNUNET_RECLAIM_credential_serialize (attr, (char *) &dam[1]); |
1261 | 1260 | ||
1262 | dam->attr_len = htons (attr_len); | 1261 | dam->attr_len = htons (attr_len); |
1263 | if (NULL != h->mq) | 1262 | if (NULL != h->mq) |
@@ -1376,12 +1375,12 @@ GNUNET_RECLAIM_get_attributes_stop (struct GNUNET_RECLAIM_AttributeIterator *it) | |||
1376 | 1375 | ||
1377 | 1376 | ||
1378 | /** | 1377 | /** |
1379 | * List all attestations for a local identity. | 1378 | * List all credentials for a local identity. |
1380 | * This MUST lock the `struct GNUNET_RECLAIM_Handle` | 1379 | * This MUST lock the `struct GNUNET_RECLAIM_Handle` |
1381 | * for any other calls than #GNUNET_RECLAIM_get_attestations_next() and | 1380 | * for any other calls than #GNUNET_RECLAIM_get_credentials_next() and |
1382 | * #GNUNET_RECLAIM_get_attestations_stop. @a proc will be called once | 1381 | * #GNUNET_RECLAIM_get_credentials_stop. @a proc will be called once |
1383 | * immediately, and then again after | 1382 | * immediately, and then again after |
1384 | * #GNUNET_RECLAIM_get_attestations_next() is invoked. | 1383 | * #GNUNET_RECLAIM_get_credentials_next() is invoked. |
1385 | * | 1384 | * |
1386 | * On error (disconnect), @a error_cb will be invoked. | 1385 | * On error (disconnect), @a error_cb will be invoked. |
1387 | * On normal completion, @a finish_cb proc will be | 1386 | * On normal completion, @a finish_cb proc will be |
@@ -1392,31 +1391,31 @@ GNUNET_RECLAIM_get_attributes_stop (struct GNUNET_RECLAIM_AttributeIterator *it) | |||
1392 | * @param error_cb Function to call on error (i.e. disconnect), | 1391 | * @param error_cb Function to call on error (i.e. disconnect), |
1393 | * the handle is afterwards invalid | 1392 | * the handle is afterwards invalid |
1394 | * @param error_cb_cls Closure for @a error_cb | 1393 | * @param error_cb_cls Closure for @a error_cb |
1395 | * @param proc Function to call on each attestation | 1394 | * @param proc Function to call on each credential |
1396 | * @param proc_cls Closure for @a proc | 1395 | * @param proc_cls Closure for @a proc |
1397 | * @param finish_cb Function to call on completion | 1396 | * @param finish_cb Function to call on completion |
1398 | * the handle is afterwards invalid | 1397 | * the handle is afterwards invalid |
1399 | * @param finish_cb_cls Closure for @a finish_cb | 1398 | * @param finish_cb_cls Closure for @a finish_cb |
1400 | * @return an iterator Handle to use for iteration | 1399 | * @return an iterator Handle to use for iteration |
1401 | */ | 1400 | */ |
1402 | struct GNUNET_RECLAIM_AttestationIterator * | 1401 | struct GNUNET_RECLAIM_CredentialIterator * |
1403 | GNUNET_RECLAIM_get_attestations_start ( | 1402 | GNUNET_RECLAIM_get_credentials_start ( |
1404 | struct GNUNET_RECLAIM_Handle *h, | 1403 | struct GNUNET_RECLAIM_Handle *h, |
1405 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, | 1404 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, |
1406 | GNUNET_SCHEDULER_TaskCallback error_cb, | 1405 | GNUNET_SCHEDULER_TaskCallback error_cb, |
1407 | void *error_cb_cls, | 1406 | void *error_cb_cls, |
1408 | GNUNET_RECLAIM_AttestationResult proc, | 1407 | GNUNET_RECLAIM_CredentialResult proc, |
1409 | void *proc_cls, | 1408 | void *proc_cls, |
1410 | GNUNET_SCHEDULER_TaskCallback finish_cb, | 1409 | GNUNET_SCHEDULER_TaskCallback finish_cb, |
1411 | void *finish_cb_cls) | 1410 | void *finish_cb_cls) |
1412 | { | 1411 | { |
1413 | struct GNUNET_RECLAIM_AttestationIterator *ait; | 1412 | struct GNUNET_RECLAIM_CredentialIterator *ait; |
1414 | struct GNUNET_MQ_Envelope *env; | 1413 | struct GNUNET_MQ_Envelope *env; |
1415 | struct AttestationIterationStartMessage *msg; | 1414 | struct CredentialIterationStartMessage *msg; |
1416 | uint32_t rid; | 1415 | uint32_t rid; |
1417 | 1416 | ||
1418 | rid = h->r_id_gen++; | 1417 | rid = h->r_id_gen++; |
1419 | ait = GNUNET_new (struct GNUNET_RECLAIM_AttestationIterator); | 1418 | ait = GNUNET_new (struct GNUNET_RECLAIM_CredentialIterator); |
1420 | ait->h = h; | 1419 | ait->h = h; |
1421 | ait->error_cb = error_cb; | 1420 | ait->error_cb = error_cb; |
1422 | ait->error_cb_cls = error_cb_cls; | 1421 | ait->error_cb_cls = error_cb_cls; |
@@ -1429,7 +1428,7 @@ GNUNET_RECLAIM_get_attestations_start ( | |||
1429 | GNUNET_CONTAINER_DLL_insert_tail (h->ait_head, h->ait_tail, ait); | 1428 | GNUNET_CONTAINER_DLL_insert_tail (h->ait_head, h->ait_tail, ait); |
1430 | env = | 1429 | env = |
1431 | GNUNET_MQ_msg (msg, | 1430 | GNUNET_MQ_msg (msg, |
1432 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_START); | 1431 | GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_START); |
1433 | msg->id = htonl (rid); | 1432 | msg->id = htonl (rid); |
1434 | msg->identity = *identity; | 1433 | msg->identity = *identity; |
1435 | if (NULL == h->mq) | 1434 | if (NULL == h->mq) |
@@ -1441,21 +1440,21 @@ GNUNET_RECLAIM_get_attestations_start ( | |||
1441 | 1440 | ||
1442 | 1441 | ||
1443 | /** | 1442 | /** |
1444 | * Calls the record processor specified in #GNUNET_RECLAIM_get_attestation_start | 1443 | * Calls the record processor specified in #GNUNET_RECLAIM_get_credential_start |
1445 | * for the next record. | 1444 | * for the next record. |
1446 | * | 1445 | * |
1447 | * @param it the iterator | 1446 | * @param it the iterator |
1448 | */ | 1447 | */ |
1449 | void | 1448 | void |
1450 | GNUNET_RECLAIM_get_attestations_next (struct | 1449 | GNUNET_RECLAIM_get_credentials_next (struct |
1451 | GNUNET_RECLAIM_AttestationIterator *ait) | 1450 | GNUNET_RECLAIM_CredentialIterator *ait) |
1452 | { | 1451 | { |
1453 | struct GNUNET_RECLAIM_Handle *h = ait->h; | 1452 | struct GNUNET_RECLAIM_Handle *h = ait->h; |
1454 | struct AttestationIterationNextMessage *msg; | 1453 | struct CredentialIterationNextMessage *msg; |
1455 | struct GNUNET_MQ_Envelope *env; | 1454 | struct GNUNET_MQ_Envelope *env; |
1456 | 1455 | ||
1457 | env = | 1456 | env = |
1458 | GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_NEXT); | 1457 | GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_NEXT); |
1459 | msg->id = htonl (ait->r_id); | 1458 | msg->id = htonl (ait->r_id); |
1460 | GNUNET_MQ_send (h->mq, env); | 1459 | GNUNET_MQ_send (h->mq, env); |
1461 | } | 1460 | } |
@@ -1469,18 +1468,18 @@ GNUNET_RECLAIM_get_attestations_next (struct | |||
1469 | * @param it the iterator | 1468 | * @param it the iterator |
1470 | */ | 1469 | */ |
1471 | void | 1470 | void |
1472 | GNUNET_RECLAIM_get_attestations_stop (struct | 1471 | GNUNET_RECLAIM_get_credentials_stop (struct |
1473 | GNUNET_RECLAIM_AttestationIterator *ait) | 1472 | GNUNET_RECLAIM_CredentialIterator *ait) |
1474 | { | 1473 | { |
1475 | struct GNUNET_RECLAIM_Handle *h = ait->h; | 1474 | struct GNUNET_RECLAIM_Handle *h = ait->h; |
1476 | struct GNUNET_MQ_Envelope *env; | 1475 | struct GNUNET_MQ_Envelope *env; |
1477 | struct AttestationIterationStopMessage *msg; | 1476 | struct CredentialIterationStopMessage *msg; |
1478 | 1477 | ||
1479 | if (NULL != h->mq) | 1478 | if (NULL != h->mq) |
1480 | { | 1479 | { |
1481 | env = | 1480 | env = |
1482 | GNUNET_MQ_msg (msg, | 1481 | GNUNET_MQ_msg (msg, |
1483 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_STOP); | 1482 | GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_STOP); |
1484 | msg->id = htonl (ait->r_id); | 1483 | msg->id = htonl (ait->r_id); |
1485 | GNUNET_MQ_send (h->mq, env); | 1484 | GNUNET_MQ_send (h->mq, env); |
1486 | } | 1485 | } |
diff --git a/src/reclaim/reclaim_attribute.c b/src/reclaim/reclaim_attribute.c index 971bfce23..2217987ac 100644 --- a/src/reclaim/reclaim_attribute.c +++ b/src/reclaim/reclaim_attribute.c | |||
@@ -222,7 +222,7 @@ GNUNET_RECLAIM_attribute_value_to_string (uint32_t type, | |||
222 | * Create a new attribute. | 222 | * Create a new attribute. |
223 | * | 223 | * |
224 | * @param attr_name the attribute name | 224 | * @param attr_name the attribute name |
225 | * @param attestation attestation ID of the attribute (maybe NULL) | 225 | * @param credential credential ID of the attribute (maybe NULL) |
226 | * @param type the attribute type | 226 | * @param type the attribute type |
227 | * @param data the attribute value | 227 | * @param data the attribute value |
228 | * @param data_size the attribute value size | 228 | * @param data_size the attribute value size |
@@ -231,7 +231,7 @@ GNUNET_RECLAIM_attribute_value_to_string (uint32_t type, | |||
231 | struct GNUNET_RECLAIM_Attribute * | 231 | struct GNUNET_RECLAIM_Attribute * |
232 | GNUNET_RECLAIM_attribute_new (const char *attr_name, | 232 | GNUNET_RECLAIM_attribute_new (const char *attr_name, |
233 | const struct | 233 | const struct |
234 | GNUNET_RECLAIM_Identifier *attestation, | 234 | GNUNET_RECLAIM_Identifier *credential, |
235 | uint32_t type, | 235 | uint32_t type, |
236 | const void *data, | 236 | const void *data, |
237 | size_t data_size) | 237 | size_t data_size) |
@@ -244,8 +244,8 @@ GNUNET_RECLAIM_attribute_new (const char *attr_name, | |||
244 | 244 | ||
245 | attr = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_Attribute) | 245 | attr = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_Attribute) |
246 | + strlen (attr_name_tmp) + 1 + data_size); | 246 | + strlen (attr_name_tmp) + 1 + data_size); |
247 | if (NULL != attestation) | 247 | if (NULL != credential) |
248 | attr->attestation = *attestation; | 248 | attr->credential = *credential; |
249 | attr->type = type; | 249 | attr->type = type; |
250 | attr->data_size = data_size; | 250 | attr->data_size = data_size; |
251 | attr->flag = 0; | 251 | attr->flag = 0; |
@@ -272,7 +272,7 @@ void | |||
272 | GNUNET_RECLAIM_attribute_list_add ( | 272 | GNUNET_RECLAIM_attribute_list_add ( |
273 | struct GNUNET_RECLAIM_AttributeList *al, | 273 | struct GNUNET_RECLAIM_AttributeList *al, |
274 | const char *attr_name, | 274 | const char *attr_name, |
275 | const struct GNUNET_RECLAIM_Identifier *attestation, | 275 | const struct GNUNET_RECLAIM_Identifier *credential, |
276 | uint32_t type, | 276 | uint32_t type, |
277 | const void *data, | 277 | const void *data, |
278 | size_t data_size) | 278 | size_t data_size) |
@@ -281,7 +281,7 @@ GNUNET_RECLAIM_attribute_list_add ( | |||
281 | 281 | ||
282 | ale = GNUNET_new (struct GNUNET_RECLAIM_AttributeListEntry); | 282 | ale = GNUNET_new (struct GNUNET_RECLAIM_AttributeListEntry); |
283 | ale->attribute = | 283 | ale->attribute = |
284 | GNUNET_RECLAIM_attribute_new (attr_name, attestation, | 284 | GNUNET_RECLAIM_attribute_new (attr_name, credential, |
285 | type, data, data_size); | 285 | type, data, data_size); |
286 | GNUNET_CONTAINER_DLL_insert (al->list_head, | 286 | GNUNET_CONTAINER_DLL_insert (al->list_head, |
287 | al->list_tail, | 287 | al->list_tail, |
@@ -403,7 +403,7 @@ GNUNET_RECLAIM_attribute_list_dup ( | |||
403 | { | 403 | { |
404 | result_ale->attribute = | 404 | result_ale->attribute = |
405 | GNUNET_RECLAIM_attribute_new (ale->attribute->name, | 405 | GNUNET_RECLAIM_attribute_new (ale->attribute->name, |
406 | &ale->attribute->attestation, | 406 | &ale->attribute->credential, |
407 | ale->attribute->type, | 407 | ale->attribute->type, |
408 | ale->attribute->data, | 408 | ale->attribute->data, |
409 | ale->attribute->data_size); | 409 | ale->attribute->data_size); |
@@ -478,7 +478,7 @@ GNUNET_RECLAIM_attribute_serialize ( | |||
478 | attr_ser->attribute_type = htons (attr->type); | 478 | attr_ser->attribute_type = htons (attr->type); |
479 | attr_ser->attribute_flag = htonl (attr->flag); | 479 | attr_ser->attribute_flag = htonl (attr->flag); |
480 | attr_ser->attribute_id = attr->id; | 480 | attr_ser->attribute_id = attr->id; |
481 | attr_ser->attestation_id = attr->attestation; | 481 | attr_ser->credential_id = attr->credential; |
482 | name_len = strlen (attr->name); | 482 | name_len = strlen (attr->name); |
483 | attr_ser->name_len = htons (name_len); | 483 | attr_ser->name_len = htons (name_len); |
484 | write_ptr = (char *) &attr_ser[1]; | 484 | write_ptr = (char *) &attr_ser[1]; |
@@ -530,7 +530,7 @@ GNUNET_RECLAIM_attribute_deserialize (const char *data, size_t data_size, | |||
530 | attribute->type = ntohs (attr_ser->attribute_type); | 530 | attribute->type = ntohs (attr_ser->attribute_type); |
531 | attribute->flag = ntohl (attr_ser->attribute_flag); | 531 | attribute->flag = ntohl (attr_ser->attribute_flag); |
532 | attribute->id = attr_ser->attribute_id; | 532 | attribute->id = attr_ser->attribute_id; |
533 | attribute->attestation = attr_ser->attestation_id; | 533 | attribute->credential = attr_ser->credential_id; |
534 | attribute->data_size = data_len; | 534 | attribute->data_size = data_len; |
535 | 535 | ||
536 | write_ptr = (char *) &attribute[1]; | 536 | write_ptr = (char *) &attribute[1]; |
diff --git a/src/reclaim/reclaim_attribute.h b/src/reclaim/reclaim_attribute.h index 203c88a34..285d75d83 100644 --- a/src/reclaim/reclaim_attribute.h +++ b/src/reclaim/reclaim_attribute.h | |||
@@ -51,9 +51,9 @@ struct Attribute | |||
51 | struct GNUNET_RECLAIM_Identifier attribute_id; | 51 | struct GNUNET_RECLAIM_Identifier attribute_id; |
52 | 52 | ||
53 | /** | 53 | /** |
54 | * Attestation ID | 54 | * Credential ID |
55 | */ | 55 | */ |
56 | struct GNUNET_RECLAIM_Identifier attestation_id; | 56 | struct GNUNET_RECLAIM_Identifier credential_id; |
57 | 57 | ||
58 | /** | 58 | /** |
59 | * Name length | 59 | * Name length |
@@ -68,39 +68,6 @@ struct Attribute | |||
68 | // followed by data_size Attribute value data | 68 | // followed by data_size Attribute value data |
69 | }; | 69 | }; |
70 | 70 | ||
71 | /** | ||
72 | * Serialized attestation claim | ||
73 | */ | ||
74 | struct Attestation | ||
75 | { | ||
76 | /** | ||
77 | * Attestation type | ||
78 | */ | ||
79 | uint32_t attestation_type GNUNET_PACKED; | ||
80 | |||
81 | /** | ||
82 | * Attestation flag | ||
83 | */ | ||
84 | uint32_t attestation_flag GNUNET_PACKED; | ||
85 | |||
86 | /** | ||
87 | * Attestation ID | ||
88 | */ | ||
89 | struct GNUNET_RECLAIM_Identifier attestation_id; | ||
90 | |||
91 | /** | ||
92 | * Name length | ||
93 | */ | ||
94 | uint32_t name_len GNUNET_PACKED; | ||
95 | |||
96 | /** | ||
97 | * Data size | ||
98 | */ | ||
99 | uint32_t data_size GNUNET_PACKED; | ||
100 | |||
101 | // followed by data_size Attestation value data | ||
102 | }; | ||
103 | |||
104 | GNUNET_NETWORK_STRUCT_BEGIN | 71 | GNUNET_NETWORK_STRUCT_BEGIN |
105 | 72 | ||
106 | #endif | 73 | #endif |
diff --git a/src/reclaim/reclaim_attestation.c b/src/reclaim/reclaim_credential.c index 1f2b1890b..10b17ae96 100644 --- a/src/reclaim/reclaim_attestation.c +++ b/src/reclaim/reclaim_credential.c | |||
@@ -19,14 +19,14 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file reclaim-attribute/reclaim_attestation.c | 22 | * @file reclaim/reclaim_credential.c |
23 | * @brief helper library to manage identity attribute attestations | 23 | * @brief helper library to manage identity attribute credentials |
24 | * @author Martin Schanzenbach | 24 | * @author Martin Schanzenbach |
25 | */ | 25 | */ |
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "gnunet_util_lib.h" | 27 | #include "gnunet_util_lib.h" |
28 | #include "gnunet_reclaim_plugin.h" | 28 | #include "gnunet_reclaim_plugin.h" |
29 | #include "reclaim_attestation.h" | 29 | #include "reclaim_credential.h" |
30 | 30 | ||
31 | 31 | ||
32 | /** | 32 | /** |
@@ -42,14 +42,14 @@ struct Plugin | |||
42 | /** | 42 | /** |
43 | * Plugin API | 43 | * Plugin API |
44 | */ | 44 | */ |
45 | struct GNUNET_RECLAIM_AttestationPluginFunctions *api; | 45 | struct GNUNET_RECLAIM_CredentialPluginFunctions *api; |
46 | }; | 46 | }; |
47 | 47 | ||
48 | 48 | ||
49 | /** | 49 | /** |
50 | * Plugins | 50 | * Plugins |
51 | */ | 51 | */ |
52 | static struct Plugin **attest_plugins; | 52 | static struct Plugin **credential_plugins; |
53 | 53 | ||
54 | 54 | ||
55 | /** | 55 | /** |
@@ -74,16 +74,16 @@ static int initialized; | |||
74 | static void | 74 | static void |
75 | add_plugin (void *cls, const char *library_name, void *lib_ret) | 75 | add_plugin (void *cls, const char *library_name, void *lib_ret) |
76 | { | 76 | { |
77 | struct GNUNET_RECLAIM_AttestationPluginFunctions *api = lib_ret; | 77 | struct GNUNET_RECLAIM_CredentialPluginFunctions *api = lib_ret; |
78 | struct Plugin *plugin; | 78 | struct Plugin *plugin; |
79 | 79 | ||
80 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 80 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
81 | "Loading attestation plugin `%s'\n", | 81 | "Loading credential plugin `%s'\n", |
82 | library_name); | 82 | library_name); |
83 | plugin = GNUNET_new (struct Plugin); | 83 | plugin = GNUNET_new (struct Plugin); |
84 | plugin->api = api; | 84 | plugin->api = api; |
85 | plugin->library_name = GNUNET_strdup (library_name); | 85 | plugin->library_name = GNUNET_strdup (library_name); |
86 | GNUNET_array_append (attest_plugins, num_plugins, plugin); | 86 | GNUNET_array_append (credential_plugins, num_plugins, plugin); |
87 | } | 87 | } |
88 | 88 | ||
89 | 89 | ||
@@ -96,7 +96,7 @@ init () | |||
96 | if (GNUNET_YES == initialized) | 96 | if (GNUNET_YES == initialized) |
97 | return; | 97 | return; |
98 | initialized = GNUNET_YES; | 98 | initialized = GNUNET_YES; |
99 | GNUNET_PLUGIN_load_all ("libgnunet_plugin_reclaim_attestation_", | 99 | GNUNET_PLUGIN_load_all ("libgnunet_plugin_reclaim_credential_", |
100 | NULL, | 100 | NULL, |
101 | &add_plugin, | 101 | &add_plugin, |
102 | NULL); | 102 | NULL); |
@@ -104,13 +104,13 @@ init () | |||
104 | 104 | ||
105 | 105 | ||
106 | /** | 106 | /** |
107 | * Convert an attestation type name to the corresponding number | 107 | * Convert an credential type name to the corresponding number |
108 | * | 108 | * |
109 | * @param typename name to convert | 109 | * @param typename name to convert |
110 | * @return corresponding number, UINT32_MAX on error | 110 | * @return corresponding number, UINT32_MAX on error |
111 | */ | 111 | */ |
112 | uint32_t | 112 | uint32_t |
113 | GNUNET_RECLAIM_attestation_typename_to_number (const char *typename) | 113 | GNUNET_RECLAIM_credential_typename_to_number (const char *typename) |
114 | { | 114 | { |
115 | unsigned int i; | 115 | unsigned int i; |
116 | struct Plugin *plugin; | 116 | struct Plugin *plugin; |
@@ -118,7 +118,7 @@ GNUNET_RECLAIM_attestation_typename_to_number (const char *typename) | |||
118 | init (); | 118 | init (); |
119 | for (i = 0; i < num_plugins; i++) | 119 | for (i = 0; i < num_plugins; i++) |
120 | { | 120 | { |
121 | plugin = attest_plugins[i]; | 121 | plugin = credential_plugins[i]; |
122 | if (UINT32_MAX != | 122 | if (UINT32_MAX != |
123 | (ret = plugin->api->typename_to_number (plugin->api->cls, | 123 | (ret = plugin->api->typename_to_number (plugin->api->cls, |
124 | typename))) | 124 | typename))) |
@@ -129,13 +129,13 @@ GNUNET_RECLAIM_attestation_typename_to_number (const char *typename) | |||
129 | 129 | ||
130 | 130 | ||
131 | /** | 131 | /** |
132 | * Convert an attestation type number to the corresponding attestation type string | 132 | * Convert an credential type number to the corresponding credential type string |
133 | * | 133 | * |
134 | * @param type number of a type | 134 | * @param type number of a type |
135 | * @return corresponding typestring, NULL on error | 135 | * @return corresponding typestring, NULL on error |
136 | */ | 136 | */ |
137 | const char * | 137 | const char * |
138 | GNUNET_RECLAIM_attestation_number_to_typename (uint32_t type) | 138 | GNUNET_RECLAIM_credential_number_to_typename (uint32_t type) |
139 | { | 139 | { |
140 | unsigned int i; | 140 | unsigned int i; |
141 | struct Plugin *plugin; | 141 | struct Plugin *plugin; |
@@ -144,7 +144,7 @@ GNUNET_RECLAIM_attestation_number_to_typename (uint32_t type) | |||
144 | init (); | 144 | init (); |
145 | for (i = 0; i < num_plugins; i++) | 145 | for (i = 0; i < num_plugins; i++) |
146 | { | 146 | { |
147 | plugin = attest_plugins[i]; | 147 | plugin = credential_plugins[i]; |
148 | if (NULL != | 148 | if (NULL != |
149 | (ret = plugin->api->number_to_typename (plugin->api->cls, type))) | 149 | (ret = plugin->api->number_to_typename (plugin->api->cls, type))) |
150 | return ret; | 150 | return ret; |
@@ -154,7 +154,7 @@ GNUNET_RECLAIM_attestation_number_to_typename (uint32_t type) | |||
154 | 154 | ||
155 | 155 | ||
156 | /** | 156 | /** |
157 | * Convert human-readable version of a 'claim' of an attestation to the binary | 157 | * Convert human-readable version of a 'claim' of an credential to the binary |
158 | * representation | 158 | * representation |
159 | * | 159 | * |
160 | * @param type type of the claim | 160 | * @param type type of the claim |
@@ -164,7 +164,7 @@ GNUNET_RECLAIM_attestation_number_to_typename (uint32_t type) | |||
164 | * @return #GNUNET_OK on success | 164 | * @return #GNUNET_OK on success |
165 | */ | 165 | */ |
166 | int | 166 | int |
167 | GNUNET_RECLAIM_attestation_string_to_value (uint32_t type, | 167 | GNUNET_RECLAIM_credential_string_to_value (uint32_t type, |
168 | const char *s, | 168 | const char *s, |
169 | void **data, | 169 | void **data, |
170 | size_t *data_size) | 170 | size_t *data_size) |
@@ -175,7 +175,7 @@ GNUNET_RECLAIM_attestation_string_to_value (uint32_t type, | |||
175 | init (); | 175 | init (); |
176 | for (i = 0; i < num_plugins; i++) | 176 | for (i = 0; i < num_plugins; i++) |
177 | { | 177 | { |
178 | plugin = attest_plugins[i]; | 178 | plugin = credential_plugins[i]; |
179 | if (GNUNET_OK == plugin->api->string_to_value (plugin->api->cls, | 179 | if (GNUNET_OK == plugin->api->string_to_value (plugin->api->cls, |
180 | type, | 180 | type, |
181 | s, | 181 | s, |
@@ -188,15 +188,15 @@ GNUNET_RECLAIM_attestation_string_to_value (uint32_t type, | |||
188 | 188 | ||
189 | 189 | ||
190 | /** | 190 | /** |
191 | * Convert the 'claim' of an attestation to a string | 191 | * Convert the 'claim' of an credential to a string |
192 | * | 192 | * |
193 | * @param type the type of attestation | 193 | * @param type the type of credential |
194 | * @param data claim in binary encoding | 194 | * @param data claim in binary encoding |
195 | * @param data_size number of bytes in @a data | 195 | * @param data_size number of bytes in @a data |
196 | * @return NULL on error, otherwise human-readable representation of the claim | 196 | * @return NULL on error, otherwise human-readable representation of the claim |
197 | */ | 197 | */ |
198 | char * | 198 | char * |
199 | GNUNET_RECLAIM_attestation_value_to_string (uint32_t type, | 199 | GNUNET_RECLAIM_credential_value_to_string (uint32_t type, |
200 | const void *data, | 200 | const void *data, |
201 | size_t data_size) | 201 | size_t data_size) |
202 | { | 202 | { |
@@ -207,7 +207,7 @@ GNUNET_RECLAIM_attestation_value_to_string (uint32_t type, | |||
207 | init (); | 207 | init (); |
208 | for (i = 0; i < num_plugins; i++) | 208 | for (i = 0; i < num_plugins; i++) |
209 | { | 209 | { |
210 | plugin = attest_plugins[i]; | 210 | plugin = credential_plugins[i]; |
211 | if (NULL != (ret = plugin->api->value_to_string (plugin->api->cls, | 211 | if (NULL != (ret = plugin->api->value_to_string (plugin->api->cls, |
212 | type, | 212 | type, |
213 | data, | 213 | data, |
@@ -219,27 +219,27 @@ GNUNET_RECLAIM_attestation_value_to_string (uint32_t type, | |||
219 | 219 | ||
220 | 220 | ||
221 | /** | 221 | /** |
222 | * Create a new attestation. | 222 | * Create a new credential. |
223 | * | 223 | * |
224 | * @param attr_name the attestation name | 224 | * @param attr_name the credential name |
225 | * @param type the attestation type | 225 | * @param type the credential type |
226 | * @param data the attestation value | 226 | * @param data the credential value |
227 | * @param data_size the attestation value size | 227 | * @param data_size the credential value size |
228 | * @return the new attestation | 228 | * @return the new credential |
229 | */ | 229 | */ |
230 | struct GNUNET_RECLAIM_Attestation * | 230 | struct GNUNET_RECLAIM_Credential * |
231 | GNUNET_RECLAIM_attestation_new (const char *attr_name, | 231 | GNUNET_RECLAIM_credential_new (const char *attr_name, |
232 | uint32_t type, | 232 | uint32_t type, |
233 | const void *data, | 233 | const void *data, |
234 | size_t data_size) | 234 | size_t data_size) |
235 | { | 235 | { |
236 | struct GNUNET_RECLAIM_Attestation *attr; | 236 | struct GNUNET_RECLAIM_Credential *attr; |
237 | char *write_ptr; | 237 | char *write_ptr; |
238 | char *attr_name_tmp = GNUNET_strdup (attr_name); | 238 | char *attr_name_tmp = GNUNET_strdup (attr_name); |
239 | 239 | ||
240 | GNUNET_STRINGS_utf8_tolower (attr_name, attr_name_tmp); | 240 | GNUNET_STRINGS_utf8_tolower (attr_name, attr_name_tmp); |
241 | 241 | ||
242 | attr = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_Attestation) | 242 | attr = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_Credential) |
243 | + strlen (attr_name_tmp) + 1 + data_size); | 243 | + strlen (attr_name_tmp) + 1 + data_size); |
244 | attr->type = type; | 244 | attr->type = type; |
245 | attr->data_size = data_size; | 245 | attr->data_size = data_size; |
@@ -262,17 +262,17 @@ GNUNET_RECLAIM_attestation_new (const char *attr_name, | |||
262 | * @return the required buffer size | 262 | * @return the required buffer size |
263 | */ | 263 | */ |
264 | size_t | 264 | size_t |
265 | GNUNET_RECLAIM_attestation_list_serialize_get_size ( | 265 | GNUNET_RECLAIM_credential_list_serialize_get_size ( |
266 | const struct GNUNET_RECLAIM_AttestationList *attestations) | 266 | const struct GNUNET_RECLAIM_CredentialList *credentials) |
267 | { | 267 | { |
268 | struct GNUNET_RECLAIM_AttestationListEntry *le; | 268 | struct GNUNET_RECLAIM_CredentialListEntry *le; |
269 | size_t len = 0; | 269 | size_t len = 0; |
270 | 270 | ||
271 | for (le = attestations->list_head; NULL != le; le = le->next) | 271 | for (le = credentials->list_head; NULL != le; le = le->next) |
272 | { | 272 | { |
273 | GNUNET_assert (NULL != le->attestation); | 273 | GNUNET_assert (NULL != le->credential); |
274 | len += GNUNET_RECLAIM_attestation_serialize_get_size (le->attestation); | 274 | len += GNUNET_RECLAIM_credential_serialize_get_size (le->credential); |
275 | len += sizeof(struct GNUNET_RECLAIM_AttestationListEntry); | 275 | len += sizeof(struct GNUNET_RECLAIM_CredentialListEntry); |
276 | } | 276 | } |
277 | return len; | 277 | return len; |
278 | } | 278 | } |
@@ -286,20 +286,20 @@ GNUNET_RECLAIM_attestation_list_serialize_get_size ( | |||
286 | * @return length of serialized data | 286 | * @return length of serialized data |
287 | */ | 287 | */ |
288 | size_t | 288 | size_t |
289 | GNUNET_RECLAIM_attestation_list_serialize ( | 289 | GNUNET_RECLAIM_credential_list_serialize ( |
290 | const struct GNUNET_RECLAIM_AttestationList *attestations, | 290 | const struct GNUNET_RECLAIM_CredentialList *credentials, |
291 | char *result) | 291 | char *result) |
292 | { | 292 | { |
293 | struct GNUNET_RECLAIM_AttestationListEntry *le; | 293 | struct GNUNET_RECLAIM_CredentialListEntry *le; |
294 | size_t len; | 294 | size_t len; |
295 | size_t total_len; | 295 | size_t total_len; |
296 | char *write_ptr; | 296 | char *write_ptr; |
297 | write_ptr = result; | 297 | write_ptr = result; |
298 | total_len = 0; | 298 | total_len = 0; |
299 | for (le = attestations->list_head; NULL != le; le = le->next) | 299 | for (le = credentials->list_head; NULL != le; le = le->next) |
300 | { | 300 | { |
301 | GNUNET_assert (NULL != le->attestation); | 301 | GNUNET_assert (NULL != le->credential); |
302 | len = GNUNET_RECLAIM_attestation_serialize (le->attestation, write_ptr); | 302 | len = GNUNET_RECLAIM_credential_serialize (le->credential, write_ptr); |
303 | total_len += len; | 303 | total_len += len; |
304 | write_ptr += len; | 304 | write_ptr += len; |
305 | } | 305 | } |
@@ -308,43 +308,43 @@ GNUNET_RECLAIM_attestation_list_serialize ( | |||
308 | 308 | ||
309 | 309 | ||
310 | /** | 310 | /** |
311 | * Deserialize an attestation list | 311 | * Deserialize an credential list |
312 | * | 312 | * |
313 | * @param data the serialized attribute list | 313 | * @param data the serialized attribute list |
314 | * @param data_size the length of the serialized data | 314 | * @param data_size the length of the serialized data |
315 | * @return a GNUNET_IDENTITY_PROVIDER_AttributeList, must be free'd by caller | 315 | * @return a GNUNET_IDENTITY_PROVIDER_AttributeList, must be free'd by caller |
316 | */ | 316 | */ |
317 | struct GNUNET_RECLAIM_AttestationList * | 317 | struct GNUNET_RECLAIM_CredentialList * |
318 | GNUNET_RECLAIM_attestation_list_deserialize (const char *data, size_t data_size) | 318 | GNUNET_RECLAIM_credential_list_deserialize (const char *data, size_t data_size) |
319 | { | 319 | { |
320 | struct GNUNET_RECLAIM_AttestationList *al; | 320 | struct GNUNET_RECLAIM_CredentialList *al; |
321 | struct GNUNET_RECLAIM_AttestationListEntry *ale; | 321 | struct GNUNET_RECLAIM_CredentialListEntry *ale; |
322 | size_t att_len; | 322 | size_t att_len; |
323 | const char *read_ptr; | 323 | const char *read_ptr; |
324 | 324 | ||
325 | al = GNUNET_new (struct GNUNET_RECLAIM_AttestationList); | 325 | al = GNUNET_new (struct GNUNET_RECLAIM_CredentialList); |
326 | 326 | ||
327 | if ((data_size < sizeof(struct | 327 | if ((data_size < sizeof(struct |
328 | Attestation) | 328 | Credential) |
329 | + sizeof(struct GNUNET_RECLAIM_AttestationListEntry))) | 329 | + sizeof(struct GNUNET_RECLAIM_CredentialListEntry))) |
330 | return al; | 330 | return al; |
331 | 331 | ||
332 | read_ptr = data; | 332 | read_ptr = data; |
333 | while (((data + data_size) - read_ptr) >= sizeof(struct Attestation)) | 333 | while (((data + data_size) - read_ptr) >= sizeof(struct Credential)) |
334 | { | 334 | { |
335 | ale = GNUNET_new (struct GNUNET_RECLAIM_AttestationListEntry); | 335 | ale = GNUNET_new (struct GNUNET_RECLAIM_CredentialListEntry); |
336 | ale->attestation = | 336 | ale->credential = |
337 | GNUNET_RECLAIM_attestation_deserialize (read_ptr, | 337 | GNUNET_RECLAIM_credential_deserialize (read_ptr, |
338 | data_size - (read_ptr - data)); | 338 | data_size - (read_ptr - data)); |
339 | if (NULL == ale->attestation) | 339 | if (NULL == ale->credential) |
340 | { | 340 | { |
341 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 341 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
342 | "Failed to deserialize malformed attestation.\n"); | 342 | "Failed to deserialize malformed credential.\n"); |
343 | GNUNET_free (ale); | 343 | GNUNET_free (ale); |
344 | return al; | 344 | return al; |
345 | } | 345 | } |
346 | GNUNET_CONTAINER_DLL_insert (al->list_head, al->list_tail, ale); | 346 | GNUNET_CONTAINER_DLL_insert (al->list_head, al->list_tail, ale); |
347 | att_len = GNUNET_RECLAIM_attestation_serialize_get_size (ale->attestation); | 347 | att_len = GNUNET_RECLAIM_credential_serialize_get_size (ale->credential); |
348 | read_ptr += att_len; | 348 | read_ptr += att_len; |
349 | } | 349 | } |
350 | return al; | 350 | return al; |
@@ -352,29 +352,29 @@ GNUNET_RECLAIM_attestation_list_deserialize (const char *data, size_t data_size) | |||
352 | 352 | ||
353 | 353 | ||
354 | /** | 354 | /** |
355 | * Make a (deep) copy of the attestation list | 355 | * Make a (deep) copy of the credential list |
356 | * @param attrs claim list to copy | 356 | * @param attrs claim list to copy |
357 | * @return copied claim list | 357 | * @return copied claim list |
358 | */ | 358 | */ |
359 | struct GNUNET_RECLAIM_AttestationList * | 359 | struct GNUNET_RECLAIM_CredentialList * |
360 | GNUNET_RECLAIM_attestation_list_dup ( | 360 | GNUNET_RECLAIM_credential_list_dup ( |
361 | const struct GNUNET_RECLAIM_AttestationList *al) | 361 | const struct GNUNET_RECLAIM_CredentialList *al) |
362 | { | 362 | { |
363 | struct GNUNET_RECLAIM_AttestationListEntry *ale; | 363 | struct GNUNET_RECLAIM_CredentialListEntry *ale; |
364 | struct GNUNET_RECLAIM_AttestationListEntry *result_ale; | 364 | struct GNUNET_RECLAIM_CredentialListEntry *result_ale; |
365 | struct GNUNET_RECLAIM_AttestationList *result; | 365 | struct GNUNET_RECLAIM_CredentialList *result; |
366 | 366 | ||
367 | result = GNUNET_new (struct GNUNET_RECLAIM_AttestationList); | 367 | result = GNUNET_new (struct GNUNET_RECLAIM_CredentialList); |
368 | for (ale = al->list_head; NULL != ale; ale = ale->next) | 368 | for (ale = al->list_head; NULL != ale; ale = ale->next) |
369 | { | 369 | { |
370 | result_ale = GNUNET_new (struct GNUNET_RECLAIM_AttestationListEntry); | 370 | result_ale = GNUNET_new (struct GNUNET_RECLAIM_CredentialListEntry); |
371 | GNUNET_assert (NULL != ale->attestation); | 371 | GNUNET_assert (NULL != ale->credential); |
372 | result_ale->attestation = | 372 | result_ale->credential = |
373 | GNUNET_RECLAIM_attestation_new (ale->attestation->name, | 373 | GNUNET_RECLAIM_credential_new (ale->credential->name, |
374 | ale->attestation->type, | 374 | ale->credential->type, |
375 | ale->attestation->data, | 375 | ale->credential->data, |
376 | ale->attestation->data_size); | 376 | ale->credential->data_size); |
377 | result_ale->attestation->id = ale->attestation->id; | 377 | result_ale->credential->id = ale->credential->id; |
378 | GNUNET_CONTAINER_DLL_insert (result->list_head, | 378 | GNUNET_CONTAINER_DLL_insert (result->list_head, |
379 | result->list_tail, | 379 | result->list_tail, |
380 | result_ale); | 380 | result_ale); |
@@ -384,21 +384,21 @@ GNUNET_RECLAIM_attestation_list_dup ( | |||
384 | 384 | ||
385 | 385 | ||
386 | /** | 386 | /** |
387 | * Destroy attestation list | 387 | * Destroy credential list |
388 | * | 388 | * |
389 | * @param attrs list to destroy | 389 | * @param attrs list to destroy |
390 | */ | 390 | */ |
391 | void | 391 | void |
392 | GNUNET_RECLAIM_attestation_list_destroy ( | 392 | GNUNET_RECLAIM_credential_list_destroy ( |
393 | struct GNUNET_RECLAIM_AttestationList *al) | 393 | struct GNUNET_RECLAIM_CredentialList *al) |
394 | { | 394 | { |
395 | struct GNUNET_RECLAIM_AttestationListEntry *ale; | 395 | struct GNUNET_RECLAIM_CredentialListEntry *ale; |
396 | struct GNUNET_RECLAIM_AttestationListEntry *tmp_ale; | 396 | struct GNUNET_RECLAIM_CredentialListEntry *tmp_ale; |
397 | 397 | ||
398 | for (ale = al->list_head; NULL != ale;) | 398 | for (ale = al->list_head; NULL != ale;) |
399 | { | 399 | { |
400 | if (NULL != ale->attestation) | 400 | if (NULL != ale->credential) |
401 | GNUNET_free (ale->attestation); | 401 | GNUNET_free (ale->credential); |
402 | tmp_ale = ale; | 402 | tmp_ale = ale; |
403 | ale = ale->next; | 403 | ale = ale->next; |
404 | GNUNET_free (tmp_ale); | 404 | GNUNET_free (tmp_ale); |
@@ -410,108 +410,108 @@ GNUNET_RECLAIM_attestation_list_destroy ( | |||
410 | /** | 410 | /** |
411 | * Get required size for serialization buffer | 411 | * Get required size for serialization buffer |
412 | * | 412 | * |
413 | * @param attr the attestation to serialize | 413 | * @param attr the credential to serialize |
414 | * @return the required buffer size | 414 | * @return the required buffer size |
415 | */ | 415 | */ |
416 | size_t | 416 | size_t |
417 | GNUNET_RECLAIM_attestation_serialize_get_size ( | 417 | GNUNET_RECLAIM_credential_serialize_get_size ( |
418 | const struct GNUNET_RECLAIM_Attestation *attestation) | 418 | const struct GNUNET_RECLAIM_Credential *credential) |
419 | { | 419 | { |
420 | return sizeof(struct Attestation) + strlen (attestation->name) | 420 | return sizeof(struct Credential) + strlen (credential->name) |
421 | + attestation->data_size; | 421 | + credential->data_size; |
422 | } | 422 | } |
423 | 423 | ||
424 | 424 | ||
425 | /** | 425 | /** |
426 | * Serialize an attestation | 426 | * Serialize an credential |
427 | * | 427 | * |
428 | * @param attr the attestation to serialize | 428 | * @param attr the credential to serialize |
429 | * @param result the serialized attestation | 429 | * @param result the serialized credential |
430 | * @return length of serialized data | 430 | * @return length of serialized data |
431 | */ | 431 | */ |
432 | size_t | 432 | size_t |
433 | GNUNET_RECLAIM_attestation_serialize ( | 433 | GNUNET_RECLAIM_credential_serialize ( |
434 | const struct GNUNET_RECLAIM_Attestation *attestation, | 434 | const struct GNUNET_RECLAIM_Credential *credential, |
435 | char *result) | 435 | char *result) |
436 | { | 436 | { |
437 | size_t data_len_ser; | 437 | size_t data_len_ser; |
438 | size_t name_len; | 438 | size_t name_len; |
439 | struct Attestation *atts; | 439 | struct Credential *atts; |
440 | char *write_ptr; | 440 | char *write_ptr; |
441 | 441 | ||
442 | atts = (struct Attestation *) result; | 442 | atts = (struct Credential *) result; |
443 | atts->attestation_type = htons (attestation->type); | 443 | atts->credential_type = htons (credential->type); |
444 | atts->attestation_flag = htonl (attestation->flag); | 444 | atts->credential_flag = htonl (credential->flag); |
445 | atts->attestation_id = attestation->id; | 445 | atts->credential_id = credential->id; |
446 | name_len = strlen (attestation->name); | 446 | name_len = strlen (credential->name); |
447 | atts->name_len = htons (name_len); | 447 | atts->name_len = htons (name_len); |
448 | write_ptr = (char *) &atts[1]; | 448 | write_ptr = (char *) &atts[1]; |
449 | GNUNET_memcpy (write_ptr, attestation->name, name_len); | 449 | GNUNET_memcpy (write_ptr, credential->name, name_len); |
450 | write_ptr += name_len; | 450 | write_ptr += name_len; |
451 | // TODO plugin-ize | 451 | // TODO plugin-ize |
452 | // data_len_ser = plugin->serialize_attribute_value (attr, | 452 | // data_len_ser = plugin->serialize_attribute_value (attr, |
453 | // &attr_ser[1]); | 453 | // &attr_ser[1]); |
454 | data_len_ser = attestation->data_size; | 454 | data_len_ser = credential->data_size; |
455 | GNUNET_memcpy (write_ptr, attestation->data, attestation->data_size); | 455 | GNUNET_memcpy (write_ptr, credential->data, credential->data_size); |
456 | atts->data_size = htons (data_len_ser); | 456 | atts->data_size = htons (data_len_ser); |
457 | 457 | ||
458 | return sizeof(struct Attestation) + strlen (attestation->name) | 458 | return sizeof(struct Credential) + strlen (credential->name) |
459 | + attestation->data_size; | 459 | + credential->data_size; |
460 | } | 460 | } |
461 | 461 | ||
462 | 462 | ||
463 | /** | 463 | /** |
464 | * Deserialize an attestation | 464 | * Deserialize an credential |
465 | * | 465 | * |
466 | * @param data the serialized attestation | 466 | * @param data the serialized credential |
467 | * @param data_size the length of the serialized data | 467 | * @param data_size the length of the serialized data |
468 | * | 468 | * |
469 | * @return a GNUNET_IDENTITY_PROVIDER_Attribute, must be free'd by caller | 469 | * @return a GNUNET_IDENTITY_PROVIDER_Attribute, must be free'd by caller |
470 | */ | 470 | */ |
471 | struct GNUNET_RECLAIM_Attestation * | 471 | struct GNUNET_RECLAIM_Credential * |
472 | GNUNET_RECLAIM_attestation_deserialize (const char *data, size_t data_size) | 472 | GNUNET_RECLAIM_credential_deserialize (const char *data, size_t data_size) |
473 | { | 473 | { |
474 | struct GNUNET_RECLAIM_Attestation *attestation; | 474 | struct GNUNET_RECLAIM_Credential *credential; |
475 | struct Attestation *atts; | 475 | struct Credential *atts; |
476 | size_t data_len; | 476 | size_t data_len; |
477 | size_t name_len; | 477 | size_t name_len; |
478 | char *write_ptr; | 478 | char *write_ptr; |
479 | 479 | ||
480 | if (data_size < sizeof(struct Attestation)) | 480 | if (data_size < sizeof(struct Credential)) |
481 | return NULL; | 481 | return NULL; |
482 | 482 | ||
483 | atts = (struct Attestation *) data; | 483 | atts = (struct Credential *) data; |
484 | data_len = ntohs (atts->data_size); | 484 | data_len = ntohs (atts->data_size); |
485 | name_len = ntohs (atts->name_len); | 485 | name_len = ntohs (atts->name_len); |
486 | if (data_size < sizeof(struct Attestation) + data_len + name_len) | 486 | if (data_size < sizeof(struct Credential) + data_len + name_len) |
487 | { | 487 | { |
488 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 488 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
489 | "Buffer too small to deserialize\n"); | 489 | "Buffer too small to deserialize\n"); |
490 | return NULL; | 490 | return NULL; |
491 | } | 491 | } |
492 | attestation = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_Attestation) | 492 | credential = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_Credential) |
493 | + data_len + name_len + 1); | 493 | + data_len + name_len + 1); |
494 | attestation->type = ntohs (atts->attestation_type); | 494 | credential->type = ntohs (atts->credential_type); |
495 | attestation->flag = ntohl (atts->attestation_flag); | 495 | credential->flag = ntohl (atts->credential_flag); |
496 | attestation->id = atts->attestation_id; | 496 | credential->id = atts->credential_id; |
497 | attestation->data_size = data_len; | 497 | credential->data_size = data_len; |
498 | 498 | ||
499 | write_ptr = (char *) &attestation[1]; | 499 | write_ptr = (char *) &credential[1]; |
500 | GNUNET_memcpy (write_ptr, &atts[1], name_len); | 500 | GNUNET_memcpy (write_ptr, &atts[1], name_len); |
501 | write_ptr[name_len] = '\0'; | 501 | write_ptr[name_len] = '\0'; |
502 | attestation->name = write_ptr; | 502 | credential->name = write_ptr; |
503 | 503 | ||
504 | write_ptr += name_len + 1; | 504 | write_ptr += name_len + 1; |
505 | GNUNET_memcpy (write_ptr, (char *) &atts[1] + name_len, | 505 | GNUNET_memcpy (write_ptr, (char *) &atts[1] + name_len, |
506 | attestation->data_size); | 506 | credential->data_size); |
507 | attestation->data = write_ptr; | 507 | credential->data = write_ptr; |
508 | return attestation; | 508 | return credential; |
509 | } | 509 | } |
510 | 510 | ||
511 | 511 | ||
512 | struct GNUNET_RECLAIM_AttributeList* | 512 | struct GNUNET_RECLAIM_AttributeList* |
513 | GNUNET_RECLAIM_attestation_get_attributes (const struct | 513 | GNUNET_RECLAIM_credential_get_attributes (const struct |
514 | GNUNET_RECLAIM_Attestation *attest) | 514 | GNUNET_RECLAIM_Credential *credential) |
515 | { | 515 | { |
516 | unsigned int i; | 516 | unsigned int i; |
517 | struct Plugin *plugin; | 517 | struct Plugin *plugin; |
@@ -519,10 +519,10 @@ GNUNET_RECLAIM_attestation_get_attributes (const struct | |||
519 | init (); | 519 | init (); |
520 | for (i = 0; i < num_plugins; i++) | 520 | for (i = 0; i < num_plugins; i++) |
521 | { | 521 | { |
522 | plugin = attest_plugins[i]; | 522 | plugin = credential_plugins[i]; |
523 | if (NULL != | 523 | if (NULL != |
524 | (ret = plugin->api->get_attributes (plugin->api->cls, | 524 | (ret = plugin->api->get_attributes (plugin->api->cls, |
525 | attest))) | 525 | credential))) |
526 | return ret; | 526 | return ret; |
527 | } | 527 | } |
528 | return NULL; | 528 | return NULL; |
@@ -530,8 +530,8 @@ GNUNET_RECLAIM_attestation_get_attributes (const struct | |||
530 | 530 | ||
531 | 531 | ||
532 | char* | 532 | char* |
533 | GNUNET_RECLAIM_attestation_get_issuer (const struct | 533 | GNUNET_RECLAIM_credential_get_issuer (const struct |
534 | GNUNET_RECLAIM_Attestation *attest) | 534 | GNUNET_RECLAIM_Credential *credential) |
535 | { | 535 | { |
536 | unsigned int i; | 536 | unsigned int i; |
537 | struct Plugin *plugin; | 537 | struct Plugin *plugin; |
@@ -539,10 +539,10 @@ GNUNET_RECLAIM_attestation_get_issuer (const struct | |||
539 | init (); | 539 | init (); |
540 | for (i = 0; i < num_plugins; i++) | 540 | for (i = 0; i < num_plugins; i++) |
541 | { | 541 | { |
542 | plugin = attest_plugins[i]; | 542 | plugin = credential_plugins[i]; |
543 | if (NULL != | 543 | if (NULL != |
544 | (ret = plugin->api->get_issuer (plugin->api->cls, | 544 | (ret = plugin->api->get_issuer (plugin->api->cls, |
545 | attest))) | 545 | credential))) |
546 | return ret; | 546 | return ret; |
547 | } | 547 | } |
548 | return NULL; | 548 | return NULL; |
@@ -550,8 +550,8 @@ GNUNET_RECLAIM_attestation_get_issuer (const struct | |||
550 | 550 | ||
551 | 551 | ||
552 | int | 552 | int |
553 | GNUNET_RECLAIM_attestation_get_expiration (const struct | 553 | GNUNET_RECLAIM_credential_get_expiration (const struct |
554 | GNUNET_RECLAIM_Attestation *attest, | 554 | GNUNET_RECLAIM_Credential *credential, |
555 | struct GNUNET_TIME_Absolute*exp) | 555 | struct GNUNET_TIME_Absolute*exp) |
556 | { | 556 | { |
557 | unsigned int i; | 557 | unsigned int i; |
@@ -559,9 +559,9 @@ GNUNET_RECLAIM_attestation_get_expiration (const struct | |||
559 | init (); | 559 | init (); |
560 | for (i = 0; i < num_plugins; i++) | 560 | for (i = 0; i < num_plugins; i++) |
561 | { | 561 | { |
562 | plugin = attest_plugins[i]; | 562 | plugin = credential_plugins[i]; |
563 | if (GNUNET_OK != plugin->api->get_expiration (plugin->api->cls, | 563 | if (GNUNET_OK != plugin->api->get_expiration (plugin->api->cls, |
564 | attest, | 564 | credential, |
565 | exp)) | 565 | exp)) |
566 | continue; | 566 | continue; |
567 | return GNUNET_OK; | 567 | return GNUNET_OK; |
diff --git a/src/reclaim/reclaim_attestation.h b/src/reclaim/reclaim_credential.h index 5747d8896..cd3a9539a 100644 --- a/src/reclaim/reclaim_attestation.h +++ b/src/reclaim/reclaim_credential.h | |||
@@ -19,34 +19,34 @@ | |||
19 | */ | 19 | */ |
20 | /** | 20 | /** |
21 | * @author Martin Schanzenbach | 21 | * @author Martin Schanzenbach |
22 | * @file reclaim-attribute/reclaim_attestation.h | 22 | * @file reclaim/reclaim_credential.h |
23 | * @brief GNUnet reclaim identity attribute attestations | 23 | * @brief GNUnet reclaim identity attribute credentials |
24 | * | 24 | * |
25 | */ | 25 | */ |
26 | #ifndef RECLAIM_ATTESTATION_H | 26 | #ifndef RECLAIM_CREDENTIAL_H |
27 | #define RECLAIM_ATTESTATION_H | 27 | #define RECLAIM_CREDENTIAL_H |
28 | 28 | ||
29 | #include "gnunet_reclaim_service.h" | 29 | #include "gnunet_reclaim_service.h" |
30 | 30 | ||
31 | /** | 31 | /** |
32 | * Serialized attestation claim | 32 | * Serialized credential claim |
33 | */ | 33 | */ |
34 | struct Attestation | 34 | struct Credential |
35 | { | 35 | { |
36 | /** | 36 | /** |
37 | * Attestation type | 37 | * Credential type |
38 | */ | 38 | */ |
39 | uint32_t attestation_type; | 39 | uint32_t credential_type; |
40 | 40 | ||
41 | /** | 41 | /** |
42 | * Attestation flag | 42 | * Credential flag |
43 | */ | 43 | */ |
44 | uint32_t attestation_flag; | 44 | uint32_t credential_flag; |
45 | 45 | ||
46 | /** | 46 | /** |
47 | * Attestation ID | 47 | * Credential ID |
48 | */ | 48 | */ |
49 | struct GNUNET_RECLAIM_Identifier attestation_id; | 49 | struct GNUNET_RECLAIM_Identifier credential_id; |
50 | 50 | ||
51 | /** | 51 | /** |
52 | * Name length | 52 | * Name length |
@@ -58,7 +58,7 @@ struct Attestation | |||
58 | */ | 58 | */ |
59 | uint32_t data_size; | 59 | uint32_t data_size; |
60 | 60 | ||
61 | // followed by data_size Attestation value data | 61 | // followed by data_size Credential value data |
62 | }; | 62 | }; |
63 | 63 | ||
64 | #endif | 64 | #endif |