aboutsummaryrefslogtreecommitdiff
path: root/src/reclaim
diff options
context:
space:
mode:
authorMartin Schanzenbach <schanzen@gnunet.org>2022-11-06 22:32:17 +0900
committerMartin Schanzenbach <schanzen@gnunet.org>2022-11-06 22:32:17 +0900
commitbc3d776dd38651fae221a06a198d427d28693673 (patch)
tree431cc5c6bed61073ef9362937de41a74e95cc723 /src/reclaim
parent4db7f94ce6c8d6aed2b834c050b983de42f98718 (diff)
downloadgnunet-bc3d776dd38651fae221a06a198d427d28693673.tar.gz
gnunet-bc3d776dd38651fae221a06a198d427d28693673.zip
IPC: Convert all message payload lengths to uint16_t types.
Diffstat (limited to 'src/reclaim')
-rw-r--r--src/reclaim/gnunet-service-reclaim.c78
-rw-r--r--src/reclaim/reclaim.h78
-rw-r--r--src/reclaim/reclaim_api.c62
3 files changed, 124 insertions, 94 deletions
diff --git a/src/reclaim/gnunet-service-reclaim.c b/src/reclaim/gnunet-service-reclaim.c
index e9616bef7..8b468fc8e 100644
--- a/src/reclaim/gnunet-service-reclaim.c
+++ b/src/reclaim/gnunet-service-reclaim.c
@@ -674,14 +674,14 @@ send_ticket_result (const struct IdpClient *client,
674 buf = (char*) &irm[1]; 674 buf = (char*) &irm[1];
675 if (NULL != ticket) 675 if (NULL != ticket)
676 { 676 {
677 irm->tkt_len = htonl (tkt_len); 677 irm->tkt_len = htons (tkt_len);
678 written = GNUNET_RECLAIM_write_ticket_to_buffer (ticket, buf, tkt_len); 678 written = GNUNET_RECLAIM_write_ticket_to_buffer (ticket, buf, tkt_len);
679 GNUNET_assert (0 <= written); 679 GNUNET_assert (0 <= written);
680 buf += written; 680 buf += written;
681 } 681 }
682 // TODO add success member 682 // TODO add success member
683 irm->id = htonl (r_id); 683 irm->id = htonl (r_id);
684 irm->presentations_len = htonl (pres_len); 684 irm->presentations_len = htons (pres_len);
685 if (NULL != presentations) 685 if (NULL != presentations)
686 { 686 {
687 GNUNET_RECLAIM_presentation_list_serialize (presentations, 687 GNUNET_RECLAIM_presentation_list_serialize (presentations,
@@ -745,9 +745,9 @@ check_issue_ticket_message (void *cls, const struct IssueTicketMessage *im)
745 size_t pkey_len; 745 size_t pkey_len;
746 746
747 size = ntohs (im->header.size); 747 size = ntohs (im->header.size);
748 attrs_len = ntohl (im->attr_len); 748 attrs_len = ntohs (im->attr_len);
749 key_len = ntohl (im->key_len); 749 key_len = ntohs (im->key_len);
750 pkey_len = ntohl (im->pkey_len); 750 pkey_len = ntohs (im->pkey_len);
751 if (size != attrs_len + key_len + pkey_len + sizeof(struct 751 if (size != attrs_len + key_len + pkey_len + sizeof(struct
752 IssueTicketMessage)) 752 IssueTicketMessage))
753 { 753 {
@@ -780,7 +780,7 @@ handle_issue_ticket_message (void *cls, const struct IssueTicketMessage *im)
780 char *buf; 780 char *buf;
781 781
782 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ISSUE_TICKET message\n"); 782 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ISSUE_TICKET message\n");
783 key_len = ntohl (im->key_len); 783 key_len = ntohs (im->key_len);
784 buf = (char *) &im[1]; 784 buf = (char *) &im[1];
785 if ((GNUNET_SYSERR == 785 if ((GNUNET_SYSERR ==
786 GNUNET_IDENTITY_read_private_key_from_buffer (buf, key_len, 786 GNUNET_IDENTITY_read_private_key_from_buffer (buf, key_len,
@@ -793,7 +793,7 @@ handle_issue_ticket_message (void *cls, const struct IssueTicketMessage *im)
793 return; 793 return;
794 } 794 }
795 buf += read; 795 buf += read;
796 pkey_len = ntohl (im->pkey_len); 796 pkey_len = ntohs (im->pkey_len);
797 if ((GNUNET_SYSERR == 797 if ((GNUNET_SYSERR ==
798 GNUNET_IDENTITY_read_public_key_from_buffer (buf, pkey_len, 798 GNUNET_IDENTITY_read_public_key_from_buffer (buf, pkey_len,
799 &rp, &read)) || 799 &rp, &read)) ||
@@ -806,7 +806,7 @@ handle_issue_ticket_message (void *cls, const struct IssueTicketMessage *im)
806 } 806 }
807 buf += read; 807 buf += read;
808 tio = GNUNET_new (struct TicketIssueOperation); 808 tio = GNUNET_new (struct TicketIssueOperation);
809 attrs_len = ntohl (im->attr_len); 809 attrs_len = ntohs (im->attr_len);
810 attrs = GNUNET_RECLAIM_attribute_list_deserialize (buf, 810 attrs = GNUNET_RECLAIM_attribute_list_deserialize (buf,
811 attrs_len); 811 attrs_len);
812 for (le = attrs->list_head; NULL != le; le = le->next) 812 for (le = attrs->list_head; NULL != le; le = le->next)
@@ -898,7 +898,7 @@ handle_revoke_ticket_message (void *cls, const struct RevokeTicketMessage *rm)
898 char *buf; 898 char *buf;
899 899
900 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received REVOKE_TICKET message\n"); 900 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received REVOKE_TICKET message\n");
901 key_len = ntohl (rm->key_len); 901 key_len = ntohs (rm->key_len);
902 buf = (char *) &rm[1]; 902 buf = (char *) &rm[1];
903 if ((GNUNET_SYSERR == 903 if ((GNUNET_SYSERR ==
904 GNUNET_IDENTITY_read_private_key_from_buffer (buf, key_len, 904 GNUNET_IDENTITY_read_private_key_from_buffer (buf, key_len,
@@ -911,7 +911,7 @@ handle_revoke_ticket_message (void *cls, const struct RevokeTicketMessage *rm)
911 return; 911 return;
912 } 912 }
913 buf += read; 913 buf += read;
914 tkt_len = ntohl (rm->tkt_len); 914 tkt_len = ntohs (rm->tkt_len);
915 if ((GNUNET_SYSERR == 915 if ((GNUNET_SYSERR ==
916 GNUNET_RECLAIM_read_ticket_from_buffer (buf, tkt_len, 916 GNUNET_RECLAIM_read_ticket_from_buffer (buf, tkt_len,
917 &ticket, &read)) || 917 &ticket, &read)) ||
@@ -972,10 +972,10 @@ consume_result_cb (void *cls,
972 attrs_len + pres_len + key_len, 972 attrs_len + pres_len + key_len,
973 GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT); 973 GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT);
974 crm->id = htonl (cop->r_id); 974 crm->id = htonl (cop->r_id);
975 crm->attrs_len = htonl (attrs_len); 975 crm->attrs_len = htons (attrs_len);
976 crm->presentations_len = htonl (pres_len); 976 crm->presentations_len = htons (pres_len);
977 crm->key_len = htonl (key_len); 977 crm->key_len = htons (key_len);
978 crm->result = htonl (success); 978 crm->result = htons (success);
979 data_tmp = (char *) &crm[1]; 979 data_tmp = (char *) &crm[1];
980 written = GNUNET_IDENTITY_write_public_key_to_buffer (identity, 980 written = GNUNET_IDENTITY_write_public_key_to_buffer (identity,
981 data_tmp, 981 data_tmp,
@@ -1033,7 +1033,7 @@ handle_consume_ticket_message (void *cls, const struct ConsumeTicketMessage *cm)
1033 char *buf; 1033 char *buf;
1034 1034
1035 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CONSUME_TICKET message\n"); 1035 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CONSUME_TICKET message\n");
1036 key_len = ntohl (cm->key_len); 1036 key_len = ntohs (cm->key_len);
1037 buf = (char *) &cm[1]; 1037 buf = (char *) &cm[1];
1038 if ((GNUNET_SYSERR == 1038 if ((GNUNET_SYSERR ==
1039 GNUNET_IDENTITY_read_private_key_from_buffer (buf, key_len, 1039 GNUNET_IDENTITY_read_private_key_from_buffer (buf, key_len,
@@ -1046,7 +1046,7 @@ handle_consume_ticket_message (void *cls, const struct ConsumeTicketMessage *cm)
1046 return; 1046 return;
1047 } 1047 }
1048 buf += read; 1048 buf += read;
1049 tkt_len = ntohl (cm->tkt_len); 1049 tkt_len = ntohs (cm->tkt_len);
1050 if ((GNUNET_SYSERR == 1050 if ((GNUNET_SYSERR ==
1051 GNUNET_RECLAIM_read_ticket_from_buffer (buf, tkt_len, 1051 GNUNET_RECLAIM_read_ticket_from_buffer (buf, tkt_len,
1052 &ticket, &read)) || 1052 &ticket, &read)) ||
@@ -1196,8 +1196,8 @@ handle_attribute_store_message (void *cls,
1196 1196
1197 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ATTRIBUTE_STORE message\n"); 1197 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ATTRIBUTE_STORE message\n");
1198 1198
1199 data_len = ntohl (sam->attr_len); 1199 data_len = ntohs (sam->attr_len);
1200 key_len = ntohl (sam->key_len); 1200 key_len = ntohs (sam->key_len);
1201 buf = (char *) &sam[1]; 1201 buf = (char *) &sam[1];
1202 if ((GNUNET_SYSERR == 1202 if ((GNUNET_SYSERR ==
1203 GNUNET_IDENTITY_read_private_key_from_buffer (buf, key_len, 1203 GNUNET_IDENTITY_read_private_key_from_buffer (buf, key_len,
@@ -1397,8 +1397,8 @@ handle_credential_store_message (void *cls,
1397 1397
1398 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CREDENTIAL_STORE message\n"); 1398 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CREDENTIAL_STORE message\n");
1399 1399
1400 data_len = ntohl (sam->attr_len); 1400 data_len = ntohs (sam->attr_len);
1401 key_len = ntohl (sam->key_len); 1401 key_len = ntohs (sam->key_len);
1402 buf = (char *) &sam[1]; 1402 buf = (char *) &sam[1];
1403 if ((GNUNET_SYSERR == 1403 if ((GNUNET_SYSERR ==
1404 GNUNET_IDENTITY_read_private_key_from_buffer (buf, key_len, 1404 GNUNET_IDENTITY_read_private_key_from_buffer (buf, key_len,
@@ -1868,8 +1868,8 @@ handle_attribute_delete_message (void *cls,
1868 1868
1869 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ATTRIBUTE_DELETE message\n"); 1869 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ATTRIBUTE_DELETE message\n");
1870 1870
1871 data_len = ntohl (dam->attr_len); 1871 data_len = ntohs (dam->attr_len);
1872 key_len = ntohl (dam->key_len); 1872 key_len = ntohs (dam->key_len);
1873 buf = (char *) &dam[1]; 1873 buf = (char *) &dam[1];
1874 if ((GNUNET_SYSERR == 1874 if ((GNUNET_SYSERR ==
1875 GNUNET_IDENTITY_read_private_key_from_buffer (buf, key_len, 1875 GNUNET_IDENTITY_read_private_key_from_buffer (buf, key_len,
@@ -1975,8 +1975,8 @@ handle_credential_delete_message (void *cls,
1975 1975
1976 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CREDENTIAL_DELETE message\n"); 1976 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CREDENTIAL_DELETE message\n");
1977 1977
1978 data_len = ntohl (dam->attr_len); 1978 data_len = ntohs (dam->attr_len);
1979 key_len = ntohl (dam->key_len); 1979 key_len = ntohs (dam->key_len);
1980 buf = (char *) &dam[1]; 1980 buf = (char *) &dam[1];
1981 if ((GNUNET_SYSERR == 1981 if ((GNUNET_SYSERR ==
1982 GNUNET_IDENTITY_read_private_key_from_buffer (buf, key_len, 1982 GNUNET_IDENTITY_read_private_key_from_buffer (buf, key_len,
@@ -2032,8 +2032,8 @@ attr_iter_finished (void *cls)
2032 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending ATTRIBUTE_RESULT message\n"); 2032 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending ATTRIBUTE_RESULT message\n");
2033 env = GNUNET_MQ_msg (arm, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT); 2033 env = GNUNET_MQ_msg (arm, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT);
2034 arm->id = htonl (ai->request_id); 2034 arm->id = htonl (ai->request_id);
2035 arm->attr_len = htonl (0); 2035 arm->attr_len = htons (0);
2036 arm->pkey_len = htonl (0); 2036 arm->pkey_len = htons (0);
2037 GNUNET_MQ_send (ai->client->mq, env); 2037 GNUNET_MQ_send (ai->client->mq, env);
2038 GNUNET_CONTAINER_DLL_remove (ai->client->attr_iter_head, 2038 GNUNET_CONTAINER_DLL_remove (ai->client->attr_iter_head,
2039 ai->client->attr_iter_tail, 2039 ai->client->attr_iter_tail,
@@ -2097,9 +2097,9 @@ attr_iter_cb (void *cls,
2097 rd->data_size + key_len, 2097 rd->data_size + key_len,
2098 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT); 2098 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT);
2099 arm->id = htonl (ai->request_id); 2099 arm->id = htonl (ai->request_id);
2100 arm->attr_len = htonl (rd->data_size); 2100 arm->attr_len = htons (rd->data_size);
2101 data_tmp = (char *) &arm[1]; 2101 data_tmp = (char *) &arm[1];
2102 arm->pkey_len = htonl (key_len); 2102 arm->pkey_len = htons (key_len);
2103 written = GNUNET_IDENTITY_write_public_key_to_buffer (&identity, 2103 written = GNUNET_IDENTITY_write_public_key_to_buffer (&identity,
2104 data_tmp, 2104 data_tmp,
2105 key_len); 2105 key_len);
@@ -2119,7 +2119,7 @@ check_iteration_start (
2119 size_t key_len; 2119 size_t key_len;
2120 2120
2121 size = ntohs (ais_msg->header.size); 2121 size = ntohs (ais_msg->header.size);
2122 key_len = ntohl (ais_msg->key_len); 2122 key_len = ntohs (ais_msg->key_len);
2123 2123
2124 if (size < key_len + sizeof(*ais_msg)) 2124 if (size < key_len + sizeof(*ais_msg))
2125 { 2125 {
@@ -2147,7 +2147,7 @@ handle_iteration_start (void *cls,
2147 2147
2148 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2148 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2149 "Received ATTRIBUTE_ITERATION_START message\n"); 2149 "Received ATTRIBUTE_ITERATION_START message\n");
2150 key_len = ntohl (ais_msg->key_len); 2150 key_len = ntohs (ais_msg->key_len);
2151 if ((GNUNET_SYSERR == 2151 if ((GNUNET_SYSERR ==
2152 GNUNET_IDENTITY_read_private_key_from_buffer (&ais_msg[1], 2152 GNUNET_IDENTITY_read_private_key_from_buffer (&ais_msg[1],
2153 key_len, 2153 key_len,
@@ -2262,8 +2262,8 @@ cred_iter_finished (void *cls)
2262 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending CREDENTIAL_RESULT message\n"); 2262 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending CREDENTIAL_RESULT message\n");
2263 env = GNUNET_MQ_msg (arm, GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_RESULT); 2263 env = GNUNET_MQ_msg (arm, GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_RESULT);
2264 arm->id = htonl (ai->request_id); 2264 arm->id = htonl (ai->request_id);
2265 arm->credential_len = htonl (0); 2265 arm->credential_len = htons (0);
2266 arm->key_len = htonl (0); 2266 arm->key_len = htons (0);
2267 GNUNET_MQ_send (ai->client->mq, env); 2267 GNUNET_MQ_send (ai->client->mq, env);
2268 GNUNET_CONTAINER_DLL_remove (ai->client->cred_iter_head, 2268 GNUNET_CONTAINER_DLL_remove (ai->client->cred_iter_head,
2269 ai->client->cred_iter_tail, 2269 ai->client->cred_iter_tail,
@@ -2327,8 +2327,8 @@ cred_iter_cb (void *cls,
2327 rd->data_size + key_len, 2327 rd->data_size + key_len,
2328 GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_RESULT); 2328 GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_RESULT);
2329 arm->id = htonl (ai->request_id); 2329 arm->id = htonl (ai->request_id);
2330 arm->credential_len = htonl (rd->data_size); 2330 arm->credential_len = htons (rd->data_size);
2331 arm->key_len = htonl (key_len); 2331 arm->key_len = htons (key_len);
2332 data_tmp = (char *) &arm[1]; 2332 data_tmp = (char *) &arm[1];
2333 written = GNUNET_IDENTITY_write_public_key_to_buffer (&identity, 2333 written = GNUNET_IDENTITY_write_public_key_to_buffer (&identity,
2334 data_tmp, 2334 data_tmp,
@@ -2348,7 +2348,7 @@ check_credential_iteration_start (
2348 size_t key_len; 2348 size_t key_len;
2349 2349
2350 size = ntohs (cis_msg->header.size); 2350 size = ntohs (cis_msg->header.size);
2351 key_len = ntohl (cis_msg->key_len); 2351 key_len = ntohs (cis_msg->key_len);
2352 2352
2353 if (size < key_len + sizeof(*cis_msg)) 2353 if (size < key_len + sizeof(*cis_msg))
2354 { 2354 {
@@ -2378,7 +2378,7 @@ handle_credential_iteration_start (void *cls,
2378 2378
2379 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2379 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2380 "Received CREDENTIAL_ITERATION_START message\n"); 2380 "Received CREDENTIAL_ITERATION_START message\n");
2381 key_len = ntohl (ais_msg->key_len); 2381 key_len = ntohs (ais_msg->key_len);
2382 if ((GNUNET_SYSERR == 2382 if ((GNUNET_SYSERR ==
2383 GNUNET_IDENTITY_read_private_key_from_buffer (&ais_msg[1], 2383 GNUNET_IDENTITY_read_private_key_from_buffer (&ais_msg[1],
2384 key_len, 2384 key_len,
@@ -2516,7 +2516,7 @@ ticket_iter_cb (void *cls, struct GNUNET_RECLAIM_Ticket *ticket)
2516 &trm[1], 2516 &trm[1],
2517 tkt_len); 2517 tkt_len);
2518 } 2518 }
2519 trm->tkt_len = htonl (tkt_len); 2519 trm->tkt_len = htons (tkt_len);
2520 trm->id = htonl (ti->r_id); 2520 trm->id = htonl (ti->r_id);
2521 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending TICKET_RESULT message\n"); 2521 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending TICKET_RESULT message\n");
2522 GNUNET_MQ_send (ti->client->mq, env); 2522 GNUNET_MQ_send (ti->client->mq, env);
@@ -2533,7 +2533,7 @@ check_ticket_iteration_start (
2533 size_t key_len; 2533 size_t key_len;
2534 2534
2535 size = ntohs (tis_msg->header.size); 2535 size = ntohs (tis_msg->header.size);
2536 key_len = ntohl (tis_msg->key_len); 2536 key_len = ntohs (tis_msg->key_len);
2537 2537
2538 if (size < key_len + sizeof(*tis_msg)) 2538 if (size < key_len + sizeof(*tis_msg))
2539 { 2539 {
@@ -2562,7 +2562,7 @@ handle_ticket_iteration_start (
2562 2562
2563 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2563 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2564 "Received TICKET_ITERATION_START message\n"); 2564 "Received TICKET_ITERATION_START message\n");
2565 key_len = ntohl (tis_msg->key_len); 2565 key_len = ntohs (tis_msg->key_len);
2566 if ((GNUNET_SYSERR == 2566 if ((GNUNET_SYSERR ==
2567 GNUNET_IDENTITY_read_private_key_from_buffer (&tis_msg[1], 2567 GNUNET_IDENTITY_read_private_key_from_buffer (&tis_msg[1],
2568 key_len, 2568 key_len,
diff --git a/src/reclaim/reclaim.h b/src/reclaim/reclaim.h
index f457f47a8..9d5118269 100644
--- a/src/reclaim/reclaim.h
+++ b/src/reclaim/reclaim.h
@@ -57,12 +57,12 @@ struct AttributeStoreMessage
57 /** 57 /**
58 * The length of the attribute 58 * The length of the attribute
59 */ 59 */
60 uint32_t attr_len GNUNET_PACKED; 60 uint16_t attr_len GNUNET_PACKED;
61 61
62 /** 62 /**
63 * The length of the private key 63 * The length of the private key
64 */ 64 */
65 uint32_t key_len GNUNET_PACKED; 65 uint16_t key_len GNUNET_PACKED;
66 66
67 /* 67 /*
68 * followed by the zone private key 68 * followed by the zone private key
@@ -88,12 +88,12 @@ struct AttributeDeleteMessage
88 /** 88 /**
89 * The length of the attribute 89 * The length of the attribute
90 */ 90 */
91 uint32_t attr_len GNUNET_PACKED; 91 uint16_t attr_len GNUNET_PACKED;
92 92
93 /** 93 /**
94 * The length of the private key 94 * The length of the private key
95 */ 95 */
96 uint32_t key_len GNUNET_PACKED; 96 uint16_t key_len GNUNET_PACKED;
97 97
98 /* followed by the serialized attribute */ 98 /* followed by the serialized attribute */
99}; 99};
@@ -136,19 +136,24 @@ struct AttributeResultMessage
136 uint32_t id GNUNET_PACKED; 136 uint32_t id GNUNET_PACKED;
137 137
138 /** 138 /**
139 * Reserved (alignment)
140 */
141 uint16_t reserved GNUNET_PACKED;
142
143 /**
139 * Length of serialized attribute data 144 * Length of serialized attribute data
140 */ 145 */
141 uint32_t attr_len GNUNET_PACKED; 146 uint16_t attr_len GNUNET_PACKED;
142 147
143 /** 148 /**
144 * Length of serialized credential data 149 * Length of serialized credential data
145 */ 150 */
146 uint32_t credential_len GNUNET_PACKED; 151 uint16_t credential_len GNUNET_PACKED;
147 152
148 /** 153 /**
149 * The length of the public key 154 * The length of the public key
150 */ 155 */
151 uint32_t pkey_len GNUNET_PACKED; 156 uint16_t pkey_len GNUNET_PACKED;
152 157
153 /** 158 /**
154 * followed by the public key key. 159 * followed by the public key key.
@@ -175,12 +180,12 @@ struct CredentialResultMessage
175 /** 180 /**
176 * Length of serialized attribute data 181 * Length of serialized attribute data
177 */ 182 */
178 uint32_t credential_len GNUNET_PACKED; 183 uint16_t credential_len GNUNET_PACKED;
179 184
180 /** 185 /**
181 * The length of the public key 186 * The length of the public key
182 */ 187 */
183 uint32_t key_len GNUNET_PACKED; 188 uint16_t key_len GNUNET_PACKED;
184 189
185 /** 190 /**
186 * followed by the private key. 191 * followed by the private key.
@@ -206,9 +211,14 @@ struct AttributeIterationStartMessage
206 uint32_t id GNUNET_PACKED; 211 uint32_t id GNUNET_PACKED;
207 212
208 /** 213 /**
214 * Reserved (alignment)
215 */
216 uint16_t reserved GNUNET_PACKED;
217
218 /**
209 * The length of the private key 219 * The length of the private key
210 */ 220 */
211 uint32_t key_len GNUNET_PACKED; 221 uint16_t key_len GNUNET_PACKED;
212 222
213 /** 223 /**
214 * followed by the private key. 224 * followed by the private key.
@@ -249,9 +259,14 @@ struct CredentialIterationStartMessage
249 uint32_t id GNUNET_PACKED; 259 uint32_t id GNUNET_PACKED;
250 260
251 /** 261 /**
262 * Reserved (alignment)
263 */
264 uint16_t reserved GNUNET_PACKED;
265
266 /**
252 * The length of the private key 267 * The length of the private key
253 */ 268 */
254 uint32_t key_len GNUNET_PACKED; 269 uint16_t key_len GNUNET_PACKED;
255 270
256 /** 271 /**
257 * followed by the private key. 272 * followed by the private key.
@@ -325,9 +340,14 @@ struct TicketIterationStartMessage
325 uint32_t id GNUNET_PACKED; 340 uint32_t id GNUNET_PACKED;
326 341
327 /** 342 /**
343 * Reserved (alignment)
344 */
345 uint16_t reserved GNUNET_PACKED;
346
347 /**
328 * The length of the private key 348 * The length of the private key
329 */ 349 */
330 uint32_t key_len GNUNET_PACKED; 350 uint16_t key_len GNUNET_PACKED;
331 351
332 /** 352 /**
333 * followed by the private key. 353 * followed by the private key.
@@ -385,19 +405,24 @@ struct IssueTicketMessage
385 uint32_t id GNUNET_PACKED; 405 uint32_t id GNUNET_PACKED;
386 406
387 /** 407 /**
408 * Reserved (alignment)
409 */
410 uint16_t reserved GNUNET_PACKED;
411
412 /**
388 * length of serialized attribute list 413 * length of serialized attribute list
389 */ 414 */
390 uint32_t attr_len GNUNET_PACKED; 415 uint16_t attr_len GNUNET_PACKED;
391 416
392 /** 417 /**
393 * The length of the identity private key 418 * The length of the identity private key
394 */ 419 */
395 uint32_t key_len GNUNET_PACKED; 420 uint16_t key_len GNUNET_PACKED;
396 421
397 /** 422 /**
398 * The length of the relying party public key 423 * The length of the relying party public key
399 */ 424 */
400 uint32_t pkey_len GNUNET_PACKED; 425 uint16_t pkey_len GNUNET_PACKED;
401 426
402 /** 427 /**
403 * Followed by the private key. 428 * Followed by the private key.
@@ -424,12 +449,12 @@ struct RevokeTicketMessage
424 /** 449 /**
425 * The length of the private key 450 * The length of the private key
426 */ 451 */
427 uint32_t key_len GNUNET_PACKED; 452 uint16_t key_len GNUNET_PACKED;
428 453
429 /** 454 /**
430 * The length of the ticket 455 * The length of the ticket
431 */ 456 */
432 uint32_t tkt_len GNUNET_PACKED; 457 uint16_t tkt_len GNUNET_PACKED;
433 458
434 /** 459 /**
435 * Followed by the serialized ticket. 460 * Followed by the serialized ticket.
@@ -478,12 +503,12 @@ struct TicketResultMessage
478 /** 503 /**
479 * Ticket length 504 * Ticket length
480 */ 505 */
481 uint32_t tkt_len GNUNET_PACKED; 506 uint16_t tkt_len GNUNET_PACKED;
482 507
483 /** 508 /**
484 * Length of new presentations created 509 * Length of new presentations created
485 */ 510 */
486 uint32_t presentations_len GNUNET_PACKED; 511 uint16_t presentations_len GNUNET_PACKED;
487 512
488 /* 513 /*
489 * Followed by the serialized ticket 514 * Followed by the serialized ticket
@@ -509,12 +534,12 @@ struct ConsumeTicketMessage
509 /** 534 /**
510 * The length of the private key 535 * The length of the private key
511 */ 536 */
512 uint32_t key_len GNUNET_PACKED; 537 uint16_t key_len GNUNET_PACKED;
513 538
514 /** 539 /**
515 * The length of the ticket 540 * The length of the ticket
516 */ 541 */
517 uint32_t tkt_len GNUNET_PACKED; 542 uint16_t tkt_len GNUNET_PACKED;
518 543
519 /** 544 /**
520 * Followed by the private key. 545 * Followed by the private key.
@@ -543,19 +568,24 @@ struct ConsumeTicketResultMessage
543 uint32_t result GNUNET_PACKED; 568 uint32_t result GNUNET_PACKED;
544 569
545 /** 570 /**
571 * Reserved (alignment)
572 */
573 uint16_t reserved GNUNET_PACKED;
574
575 /**
546 * Length of serialized attribute data 576 * Length of serialized attribute data
547 */ 577 */
548 uint32_t attrs_len GNUNET_PACKED; 578 uint16_t attrs_len GNUNET_PACKED;
549 579
550 /** 580 /**
551 * Length of presentation data 581 * Length of presentation data
552 */ 582 */
553 uint32_t presentations_len; 583 uint16_t presentations_len;
554 584
555 /** 585 /**
556 * The length of the private key 586 * The length of the private key
557 */ 587 */
558 uint32_t key_len GNUNET_PACKED; 588 uint16_t key_len GNUNET_PACKED;
559 589
560 /** 590 /**
561 * Followed by the private key. 591 * Followed by the private key.
diff --git a/src/reclaim/reclaim_api.c b/src/reclaim/reclaim_api.c
index cb1aa305a..e94a99708 100644
--- a/src/reclaim/reclaim_api.c
+++ b/src/reclaim/reclaim_api.c
@@ -570,9 +570,9 @@ check_consume_ticket_result (void *cls,
570 size_t key_len; 570 size_t key_len;
571 571
572 msg_len = ntohs (msg->header.size); 572 msg_len = ntohs (msg->header.size);
573 attrs_len = ntohl (msg->attrs_len); 573 attrs_len = ntohs (msg->attrs_len);
574 key_len = ntohl (msg->key_len); 574 key_len = ntohs (msg->key_len);
575 pl_len = ntohl (msg->presentations_len); 575 pl_len = ntohs (msg->presentations_len);
576 if (msg_len != sizeof(*msg) + attrs_len + pl_len + key_len) 576 if (msg_len != sizeof(*msg) + attrs_len + pl_len + key_len)
577 { 577 {
578 GNUNET_break (0); 578 GNUNET_break (0);
@@ -603,9 +603,9 @@ handle_consume_ticket_result (void *cls,
603 uint32_t r_id = ntohl (msg->id); 603 uint32_t r_id = ntohl (msg->id);
604 char *read_ptr; 604 char *read_ptr;
605 605
606 attrs_len = ntohl (msg->attrs_len); 606 attrs_len = ntohs (msg->attrs_len);
607 key_len = ntohl (msg->key_len); 607 key_len = ntohs (msg->key_len);
608 pl_len = ntohl (msg->presentations_len); 608 pl_len = ntohs (msg->presentations_len);
609 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Processing ticket result.\n"); 609 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Processing ticket result.\n");
610 610
611 611
@@ -694,8 +694,8 @@ check_attribute_result (void *cls, const struct AttributeResultMessage *msg)
694 size_t key_len; 694 size_t key_len;
695 695
696 msg_len = ntohs (msg->header.size); 696 msg_len = ntohs (msg->header.size);
697 attr_len = ntohl (msg->attr_len); 697 attr_len = ntohs (msg->attr_len);
698 key_len = ntohl (msg->pkey_len); 698 key_len = ntohs (msg->pkey_len);
699 if (msg_len != sizeof(*msg) + attr_len + key_len) 699 if (msg_len != sizeof(*msg) + attr_len + key_len)
700 { 700 {
701 GNUNET_break (0); 701 GNUNET_break (0);
@@ -725,8 +725,8 @@ handle_attribute_result (void *cls, const struct AttributeResultMessage *msg)
725 uint32_t r_id = ntohl (msg->id); 725 uint32_t r_id = ntohl (msg->id);
726 char *buf; 726 char *buf;
727 727
728 attr_len = ntohl (msg->attr_len); 728 attr_len = ntohs (msg->attr_len);
729 key_len = ntohl (msg->pkey_len); 729 key_len = ntohs (msg->pkey_len);
730 LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing attribute result.\n"); 730 LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing attribute result.\n");
731 731
732 for (it = h->it_head; NULL != it; it = it->next) 732 for (it = h->it_head; NULL != it; it = it->next)
@@ -805,8 +805,8 @@ check_credential_result (void *cls, const struct CredentialResultMessage *msg)
805 size_t key_len; 805 size_t key_len;
806 806
807 msg_len = ntohs (msg->header.size); 807 msg_len = ntohs (msg->header.size);
808 cred_len = ntohl (msg->credential_len); 808 cred_len = ntohs (msg->credential_len);
809 key_len = ntohl (msg->key_len); 809 key_len = ntohs (msg->key_len);
810 if (msg_len != sizeof(*msg) + cred_len + key_len) 810 if (msg_len != sizeof(*msg) + cred_len + key_len)
811 { 811 {
812 GNUNET_break (0); 812 GNUNET_break (0);
@@ -837,8 +837,8 @@ handle_credential_result (void *cls, const struct
837 uint32_t r_id = ntohl (msg->id); 837 uint32_t r_id = ntohl (msg->id);
838 char *buf; 838 char *buf;
839 839
840 key_len = ntohl (msg->key_len); 840 key_len = ntohs (msg->key_len);
841 att_len = ntohl (msg->credential_len); 841 att_len = ntohs (msg->credential_len);
842 LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing credential result.\n"); 842 LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing credential result.\n");
843 843
844 844
@@ -922,8 +922,8 @@ check_ticket_result (void *cls, const struct TicketResultMessage *msg)
922 size_t tkt_len; 922 size_t tkt_len;
923 923
924 msg_len = ntohs (msg->header.size); 924 msg_len = ntohs (msg->header.size);
925 pres_len = ntohl (msg->presentations_len); 925 pres_len = ntohs (msg->presentations_len);
926 tkt_len = ntohl (msg->tkt_len); 926 tkt_len = ntohs (msg->tkt_len);
927 if (msg_len != sizeof(*msg) + pres_len + tkt_len) 927 if (msg_len != sizeof(*msg) + pres_len + tkt_len)
928 { 928 {
929 GNUNET_break (0); 929 GNUNET_break (0);
@@ -954,8 +954,8 @@ handle_ticket_result (void *cls, const struct TicketResultMessage *msg)
954 size_t tb_read; 954 size_t tb_read;
955 char *buf; 955 char *buf;
956 956
957 tkt_len = ntohl (msg->tkt_len); 957 tkt_len = ntohs (msg->tkt_len);
958 pres_len = ntohl (msg->presentations_len); 958 pres_len = ntohs (msg->presentations_len);
959 for (op = handle->op_head; NULL != op; op = op->next) 959 for (op = handle->op_head; NULL != op; op = op->next)
960 if (op->r_id == r_id) 960 if (op->r_id == r_id)
961 break; 961 break;
@@ -1186,7 +1186,7 @@ GNUNET_RECLAIM_attribute_store (
1186 op->env = GNUNET_MQ_msg_extra (sam, 1186 op->env = GNUNET_MQ_msg_extra (sam,
1187 attr_len + key_len, 1187 attr_len + key_len,
1188 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE); 1188 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE);
1189 sam->key_len = htonl (key_len); 1189 sam->key_len = htons (key_len);
1190 buf = (char *) &sam[1]; 1190 buf = (char *) &sam[1];
1191 written = GNUNET_IDENTITY_write_private_key_to_buffer (pkey, buf, key_len); 1191 written = GNUNET_IDENTITY_write_private_key_to_buffer (pkey, buf, key_len);
1192 GNUNET_assert (0 < written); 1192 GNUNET_assert (0 < written);
@@ -1229,7 +1229,7 @@ GNUNET_RECLAIM_attribute_delete (
1229 op->env = GNUNET_MQ_msg_extra (dam, 1229 op->env = GNUNET_MQ_msg_extra (dam,
1230 attr_len + key_len, 1230 attr_len + key_len,
1231 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE); 1231 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE);
1232 dam->key_len = htonl (key_len); 1232 dam->key_len = htons (key_len);
1233 buf = (char *) &dam[1]; 1233 buf = (char *) &dam[1];
1234 written = GNUNET_IDENTITY_write_private_key_to_buffer (pkey, buf, key_len); 1234 written = GNUNET_IDENTITY_write_private_key_to_buffer (pkey, buf, key_len);
1235 GNUNET_assert (0 < written); 1235 GNUNET_assert (0 < written);
@@ -1271,7 +1271,7 @@ GNUNET_RECLAIM_credential_store (
1271 op->env = GNUNET_MQ_msg_extra (sam, 1271 op->env = GNUNET_MQ_msg_extra (sam,
1272 attr_len + key_len, 1272 attr_len + key_len,
1273 GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_STORE); 1273 GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_STORE);
1274 sam->key_len = htonl (key_len); 1274 sam->key_len = htons (key_len);
1275 buf = (char *) &sam[1]; 1275 buf = (char *) &sam[1];
1276 written = GNUNET_IDENTITY_write_private_key_to_buffer (pkey, buf, key_len); 1276 written = GNUNET_IDENTITY_write_private_key_to_buffer (pkey, buf, key_len);
1277 GNUNET_assert (0 <= written); 1277 GNUNET_assert (0 <= written);
@@ -1314,7 +1314,7 @@ GNUNET_RECLAIM_credential_delete (
1314 op->env = GNUNET_MQ_msg_extra (dam, 1314 op->env = GNUNET_MQ_msg_extra (dam,
1315 attr_len + key_len, 1315 attr_len + key_len,
1316 GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_DELETE); 1316 GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_DELETE);
1317 dam->key_len = htonl (key_len); 1317 dam->key_len = htons (key_len);
1318 buf = (char *) &dam[1]; 1318 buf = (char *) &dam[1];
1319 written = GNUNET_IDENTITY_write_private_key_to_buffer (pkey, buf, key_len); 1319 written = GNUNET_IDENTITY_write_private_key_to_buffer (pkey, buf, key_len);
1320 GNUNET_assert (0 <= written); 1320 GNUNET_assert (0 <= written);
@@ -1364,7 +1364,7 @@ GNUNET_RECLAIM_get_attributes_start (
1364 key_len, 1364 key_len,
1365 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START); 1365 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START);
1366 msg->id = htonl (rid); 1366 msg->id = htonl (rid);
1367 msg->key_len = htonl (key_len); 1367 msg->key_len = htons (key_len);
1368 GNUNET_IDENTITY_write_private_key_to_buffer (identity, &msg[1], key_len); 1368 GNUNET_IDENTITY_write_private_key_to_buffer (identity, &msg[1], key_len);
1369 if (NULL == h->mq) 1369 if (NULL == h->mq)
1370 it->env = env; 1370 it->env = env;
@@ -1441,7 +1441,7 @@ GNUNET_RECLAIM_get_credentials_start (
1441 key_len, 1441 key_len,
1442 GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_START); 1442 GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_START);
1443 msg->id = htonl (rid); 1443 msg->id = htonl (rid);
1444 msg->key_len = htonl (key_len); 1444 msg->key_len = htons (key_len);
1445 GNUNET_IDENTITY_write_private_key_to_buffer (identity, &msg[1], key_len); 1445 GNUNET_IDENTITY_write_private_key_to_buffer (identity, &msg[1], key_len);
1446 if (NULL == h->mq) 1446 if (NULL == h->mq)
1447 ait->env = env; 1447 ait->env = env;
@@ -1515,8 +1515,8 @@ GNUNET_RECLAIM_ticket_issue (
1515 op->env = GNUNET_MQ_msg_extra (tim, 1515 op->env = GNUNET_MQ_msg_extra (tim,
1516 attr_len + key_len + rpk_len, 1516 attr_len + key_len + rpk_len,
1517 GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET); 1517 GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET);
1518 tim->key_len = htonl (key_len); 1518 tim->key_len = htons (key_len);
1519 tim->pkey_len = htonl (rpk_len); 1519 tim->pkey_len = htons (rpk_len);
1520 buf = (char *) &tim[1]; 1520 buf = (char *) &tim[1];
1521 written = GNUNET_IDENTITY_write_private_key_to_buffer (iss, buf, key_len); 1521 written = GNUNET_IDENTITY_write_private_key_to_buffer (iss, buf, key_len);
1522 GNUNET_assert (0 <= written); 1522 GNUNET_assert (0 <= written);
@@ -1571,11 +1571,11 @@ GNUNET_RECLAIM_ticket_consume (
1571 op->env = GNUNET_MQ_msg_extra (ctm, 1571 op->env = GNUNET_MQ_msg_extra (ctm,
1572 key_len + tkt_len, 1572 key_len + tkt_len,
1573 GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET); 1573 GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET);
1574 ctm->key_len = htonl (key_len); 1574 ctm->key_len = htons (key_len);
1575 buf = (char*) &ctm[1]; 1575 buf = (char*) &ctm[1];
1576 GNUNET_IDENTITY_write_private_key_to_buffer (identity, buf, key_len); 1576 GNUNET_IDENTITY_write_private_key_to_buffer (identity, buf, key_len);
1577 buf += key_len; 1577 buf += key_len;
1578 ctm->tkt_len = htonl (tkt_len); 1578 ctm->tkt_len = htons (tkt_len);
1579 GNUNET_RECLAIM_write_ticket_to_buffer (ticket, buf, tkt_len); 1579 GNUNET_RECLAIM_write_ticket_to_buffer (ticket, buf, tkt_len);
1580 ctm->id = htonl (op->r_id); 1580 ctm->id = htonl (op->r_id);
1581 if (NULL != h->mq) 1581 if (NULL != h->mq)
@@ -1620,7 +1620,7 @@ GNUNET_RECLAIM_ticket_iteration_start (
1620 key_len, 1620 key_len,
1621 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START); 1621 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START);
1622 msg->id = htonl (rid); 1622 msg->id = htonl (rid);
1623 msg->key_len = htonl (key_len); 1623 msg->key_len = htons (key_len);
1624 GNUNET_IDENTITY_write_private_key_to_buffer (identity, 1624 GNUNET_IDENTITY_write_private_key_to_buffer (identity,
1625 &msg[1], 1625 &msg[1],
1626 key_len); 1626 key_len);
@@ -1718,8 +1718,8 @@ GNUNET_RECLAIM_ticket_revoke (
1718 key_len + tkt_len, 1718 key_len + tkt_len,
1719 GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET); 1719 GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET);
1720 msg->id = htonl (rid); 1720 msg->id = htonl (rid);
1721 msg->key_len = htonl (key_len); 1721 msg->key_len = htons (key_len);
1722 msg->tkt_len = htonl (tkt_len); 1722 msg->tkt_len = htons (tkt_len);
1723 buf = (char*) &msg[1]; 1723 buf = (char*) &msg[1];
1724 written = GNUNET_IDENTITY_write_private_key_to_buffer (identity, 1724 written = GNUNET_IDENTITY_write_private_key_to_buffer (identity,
1725 buf, 1725 buf,