aboutsummaryrefslogtreecommitdiff
path: root/src/reclaim/plugin_rest_reclaim.c
diff options
context:
space:
mode:
authorSchanzenbach, Martin <mschanzenbach@posteo.de>2020-02-03 21:51:57 +0100
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2020-02-09 20:38:10 +0100
commit5b6bb2ce4d60635b2af950d72b45f12686fd5218 (patch)
treeef3b5786591f6a8473a4a2174dd95a439f22af68 /src/reclaim/plugin_rest_reclaim.c
parent99d70615e37294d4f964992c6be0495e95777a27 (diff)
downloadgnunet-5b6bb2ce4d60635b2af950d72b45f12686fd5218.tar.gz
gnunet-5b6bb2ce4d60635b2af950d72b45f12686fd5218.zip
move to 256-bit identifier; some cleanups
Diffstat (limited to 'src/reclaim/plugin_rest_reclaim.c')
-rw-r--r--src/reclaim/plugin_rest_reclaim.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/reclaim/plugin_rest_reclaim.c b/src/reclaim/plugin_rest_reclaim.c
index dcda75b65..9a6af6bcf 100644
--- a/src/reclaim/plugin_rest_reclaim.c
+++ b/src/reclaim/plugin_rest_reclaim.c
@@ -428,7 +428,7 @@ ticket_collect (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket)
428 char *tmp; 428 char *tmp;
429 429
430 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding ticket\n"); 430 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding ticket\n");
431 tmp = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof(uint64_t)); 431 tmp = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof(ticket->rnd));
432 json_resource = json_object (); 432 json_resource = json_object ();
433 GNUNET_free (tmp); 433 GNUNET_free (tmp);
434 json_array_append (handle->resp_object, json_resource); 434 json_array_append (handle->resp_object, json_resource);
@@ -447,7 +447,7 @@ ticket_collect (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket)
447 value = json_string (tmp); 447 value = json_string (tmp);
448 json_object_set_new (json_resource, "audience", value); 448 json_object_set_new (json_resource, "audience", value);
449 GNUNET_free (tmp); 449 GNUNET_free (tmp);
450 tmp = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof(uint64_t)); 450 tmp = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof(ticket->rnd));
451 value = json_string (tmp); 451 value = json_string (tmp);
452 json_object_set_new (json_resource, "rnd", value); 452 json_object_set_new (json_resource, "rnd", value);
453 GNUNET_free (tmp); 453 GNUNET_free (tmp);
@@ -521,7 +521,7 @@ add_attestation_ref_cont (struct GNUNET_REST_RequestHandle *con_handle,
521 /** 521 /**
522 * New ID for attribute 522 * New ID for attribute
523 */ 523 */
524 if (0 == attribute->id) 524 if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&attribute->id))
525 attribute->id = attribute->id_attest; 525 attribute->id = attribute->id_attest;
526 handle->idp = GNUNET_RECLAIM_connect (cfg); 526 handle->idp = GNUNET_RECLAIM_connect (cfg);
527 exp = GNUNET_TIME_UNIT_HOURS; 527 exp = GNUNET_TIME_UNIT_HOURS;
@@ -692,9 +692,8 @@ add_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle,
692 /** 692 /**
693 * New ID for attribute 693 * New ID for attribute
694 */ 694 */
695 if (0 == attribute->id) 695 if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&attribute->id))
696 attribute->id = 696 GNUNET_RECLAIM_id_generate (&attribute->id);
697 GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX);
698 handle->idp = GNUNET_RECLAIM_connect (cfg); 697 handle->idp = GNUNET_RECLAIM_connect (cfg);
699 exp = GNUNET_TIME_UNIT_HOURS; 698 exp = GNUNET_TIME_UNIT_HOURS;
700 handle->idp_op = GNUNET_RECLAIM_attestation_store (handle->idp, 699 handle->idp_op = GNUNET_RECLAIM_attestation_store (handle->idp,
@@ -740,9 +739,9 @@ ref_collect (void *cls,
740 json_object_set_new (attr_obj, "ref_value", json_string ( 739 json_object_set_new (attr_obj, "ref_value", json_string (
741 reference->reference_value)); 740 reference->reference_value));
742 id_str = GNUNET_STRINGS_data_to_string_alloc (&reference->id, 741 id_str = GNUNET_STRINGS_data_to_string_alloc (&reference->id,
743 sizeof(uint64_t)); 742 sizeof(reference->id));
744 id_attest_str = GNUNET_STRINGS_data_to_string_alloc (&reference->id_attest, 743 id_attest_str = GNUNET_STRINGS_data_to_string_alloc (&reference->id_attest,
745 sizeof(uint64_t)); 744 sizeof(reference->id_attest));
746 json_object_set_new (attr_obj, "id", json_string (id_str)); 745 json_object_set_new (attr_obj, "id", json_string (id_str));
747 json_object_set_new (attr_obj, "ref_id", json_string (id_attest_str)); 746 json_object_set_new (attr_obj, "ref_id", json_string (id_attest_str));
748 json_array_append (handle->resp_object, attr_obj); 747 json_array_append (handle->resp_object, attr_obj);
@@ -856,7 +855,7 @@ attest_collect (void *cls,
856 json_object_set_new (attr_obj, "name", json_string (attest->name)); 855 json_object_set_new (attr_obj, "name", json_string (attest->name));
857 type = GNUNET_RECLAIM_ATTESTATION_number_to_typename (attest->type); 856 type = GNUNET_RECLAIM_ATTESTATION_number_to_typename (attest->type);
858 json_object_set_new (attr_obj, "type", json_string (type)); 857 json_object_set_new (attr_obj, "type", json_string (type));
859 id_str = GNUNET_STRINGS_data_to_string_alloc (&attest->id, sizeof(uint64_t)); 858 id_str = GNUNET_STRINGS_data_to_string_alloc (&attest->id, sizeof(attest->id));
860 json_object_set_new (attr_obj, "id", json_string (id_str)); 859 json_object_set_new (attr_obj, "id", json_string (id_str));
861 json_array_append (handle->resp_object, attr_obj); 860 json_array_append (handle->resp_object, attr_obj);
862 json_decref (attr_obj); 861 json_decref (attr_obj);
@@ -1017,7 +1016,7 @@ delete_attestation_ref_cont (struct GNUNET_REST_RequestHandle *con_handle,
1017 GNUNET_SCHEDULER_add_now (&do_error, handle); 1016 GNUNET_SCHEDULER_add_now (&do_error, handle);
1018 return; 1017 return;
1019 } 1018 }
1020 GNUNET_STRINGS_string_to_data (id, strlen (id), &attr->id, sizeof(uint64_t)); 1019 GNUNET_STRINGS_string_to_data (id, strlen (id), &attr->id, sizeof(attr->id));
1021 1020
1022 handle->idp = GNUNET_RECLAIM_connect (cfg); 1021 handle->idp = GNUNET_RECLAIM_connect (cfg);
1023 handle->idp_op = GNUNET_RECLAIM_attestation_reference_delete (handle->idp, 1022 handle->idp_op = GNUNET_RECLAIM_attestation_reference_delete (handle->idp,
@@ -1100,7 +1099,7 @@ delete_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle,
1100 priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego); 1099 priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego);
1101 handle->idp = GNUNET_RECLAIM_connect (cfg); 1100 handle->idp = GNUNET_RECLAIM_connect (cfg);
1102 memset (&attr, 0, sizeof(struct GNUNET_RECLAIM_ATTESTATION_Claim)); 1101 memset (&attr, 0, sizeof(struct GNUNET_RECLAIM_ATTESTATION_Claim));
1103 GNUNET_STRINGS_string_to_data (id, strlen (id), &attr.id, sizeof(uint64_t)); 1102 GNUNET_STRINGS_string_to_data (id, strlen (id), &attr.id, sizeof(attr.id));
1104 attr.name = ""; 1103 attr.name = "";
1105 handle->idp_op = GNUNET_RECLAIM_attestation_delete (handle->idp, 1104 handle->idp_op = GNUNET_RECLAIM_attestation_delete (handle->idp,
1106 priv_key, 1105 priv_key,
@@ -1230,9 +1229,8 @@ add_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle,
1230 /** 1229 /**
1231 * New ID for attribute 1230 * New ID for attribute
1232 */ 1231 */
1233 if (0 == attribute->id) 1232 if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&attribute->id))
1234 attribute->id = 1233 GNUNET_RECLAIM_id_generate (&attribute->id);
1235 GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX);
1236 handle->idp = GNUNET_RECLAIM_connect (cfg); 1234 handle->idp = GNUNET_RECLAIM_connect (cfg);
1237 exp = GNUNET_TIME_UNIT_HOURS; 1235 exp = GNUNET_TIME_UNIT_HOURS;
1238 handle->idp_op = GNUNET_RECLAIM_attribute_store (handle->idp, 1236 handle->idp_op = GNUNET_RECLAIM_attribute_store (handle->idp,
@@ -1366,7 +1364,8 @@ attr_collect (void *cls,
1366 json_object_set_new (attr_obj, "flag", json_string ("1")); 1364 json_object_set_new (attr_obj, "flag", json_string ("1"));
1367 type = GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (attr2->type); 1365 type = GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (attr2->type);
1368 json_object_set_new (attr_obj, "type", json_string (type)); 1366 json_object_set_new (attr_obj, "type", json_string (type));
1369 id_str = GNUNET_STRINGS_data_to_string_alloc (&attr2->id, sizeof(uint64_t)); 1367 id_str = GNUNET_STRINGS_data_to_string_alloc (&attr2->id,
1368 sizeof(attr2->id));
1370 json_object_set_new (attr_obj, "id", json_string (id_str)); 1369 json_object_set_new (attr_obj, "id", json_string (id_str));
1371 json_array_append (handle->resp_object, attr_obj); 1370 json_array_append (handle->resp_object, attr_obj);
1372 json_decref (attr_obj); 1371 json_decref (attr_obj);
@@ -1396,7 +1395,8 @@ attr_collect (void *cls,
1396 json_object_set_new (attr_obj, "flag", json_string (flag_str)); 1395 json_object_set_new (attr_obj, "flag", json_string (flag_str));
1397 type = GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (attr->type); 1396 type = GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (attr->type);
1398 json_object_set_new (attr_obj, "type", json_string (type)); 1397 json_object_set_new (attr_obj, "type", json_string (type));
1399 id_str = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(uint64_t)); 1398 id_str = GNUNET_STRINGS_data_to_string_alloc (&attr->id,
1399 sizeof(attr->id));
1400 json_object_set_new (attr_obj, "id", json_string (id_str)); 1400 json_object_set_new (attr_obj, "id", json_string (id_str));
1401 json_array_append (handle->resp_object, attr_obj); 1401 json_array_append (handle->resp_object, attr_obj);
1402 json_decref (attr_obj); 1402 json_decref (attr_obj);
@@ -1515,7 +1515,7 @@ delete_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle,
1515 priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego); 1515 priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego);
1516 handle->idp = GNUNET_RECLAIM_connect (cfg); 1516 handle->idp = GNUNET_RECLAIM_connect (cfg);
1517 memset (&attr, 0, sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_Claim)); 1517 memset (&attr, 0, sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_Claim));
1518 GNUNET_STRINGS_string_to_data (id, strlen (id), &attr.id, sizeof(uint64_t)); 1518 GNUNET_STRINGS_string_to_data (id, strlen (id), &attr.id, sizeof(attr.id));
1519 attr.name = ""; 1519 attr.name = "";
1520 handle->idp_op = GNUNET_RECLAIM_attribute_delete (handle->idp, 1520 handle->idp_op = GNUNET_RECLAIM_attribute_delete (handle->idp,
1521 priv_key, 1521 priv_key,