aboutsummaryrefslogtreecommitdiff
path: root/src/reclaim/gnunet-service-reclaim.c
diff options
context:
space:
mode:
authorMartin Schanzenbach <mschanzenbach@posteo.de>2020-08-19 19:05:23 +0200
committerMartin Schanzenbach <mschanzenbach@posteo.de>2020-08-20 17:59:01 +0200
commite75869506cc08e08056168383bd4ab02e1f007de (patch)
treeb4617425e38fbd7070f6a6d7cd41544a7f41df5d /src/reclaim/gnunet-service-reclaim.c
parent1ca1140d4602dcc5c66da0d1ab1b082db9258ead (diff)
downloadgnunet-e75869506cc08e08056168383bd4ab02e1f007de.tar.gz
gnunet-e75869506cc08e08056168383bd4ab02e1f007de.zip
- towards separation between credentials and presentations thereof, wip, ftbfs
Diffstat (limited to 'src/reclaim/gnunet-service-reclaim.c')
-rw-r--r--src/reclaim/gnunet-service-reclaim.c272
1 files changed, 136 insertions, 136 deletions
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
847consume_result_cb (void *cls, 847consume_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 */
1084static void 1084static void
1085attest_store_cont (void *cls, int32_t success, const char *emsg) 1085cred_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 */
1120static void 1120static void
1121attest_error (void *cls) 1121cred_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*/
1141static void 1141static void
1142attest_add_cb (void *cls, 1142cred_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 */
1180static void 1181static void
1181attest_store_task (void *cls) 1182cred_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 */
1211static int 1211static int
1212check_attestation_store_message (void *cls, 1212check_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*/
1233static void 1233static void
1234handle_attestation_store_message (void *cls, 1234handle_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 */
1587static void 1587static void
1588attest_delete_cont (void *cls, int32_t success, const char *emsg) 1588cred_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 */
1613static int 1613static int
1614check_attestation_delete_message (void *cls, 1614check_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 */
1635static void 1635static void
1636handle_attestation_delete_message (void *cls, 1636handle_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 */
1864static void 1864static void
1865attest_iter_finished (void *cls) 1865cred_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 */
1888static void 1888static void
1889attest_iter_error (void *cls) 1889cred_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 */
1907static void 1907static void
1908attest_iter_cb (void *cls, 1908cred_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 */
1948static void 1948static void
1949handle_attestation_iteration_start (void *cls, 1949handle_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 */
1983static void 1983static void
1984handle_attestation_iteration_stop (void *cls, 1984handle_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 */
2018static void 2018static void
2019handle_attestation_iteration_next (void *cls, 2019handle_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,