From bc3d776dd38651fae221a06a198d427d28693673 Mon Sep 17 00:00:00 2001 From: Martin Schanzenbach Date: Sun, 6 Nov 2022 22:32:17 +0900 Subject: IPC: Convert all message payload lengths to uint16_t types. --- src/reclaim/gnunet-service-reclaim.c | 78 ++++++++++++++++++------------------ src/reclaim/reclaim.h | 78 +++++++++++++++++++++++++----------- src/reclaim/reclaim_api.c | 62 ++++++++++++++-------------- 3 files changed, 124 insertions(+), 94 deletions(-) (limited to 'src/reclaim') 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, buf = (char*) &irm[1]; if (NULL != ticket) { - irm->tkt_len = htonl (tkt_len); + irm->tkt_len = htons (tkt_len); written = GNUNET_RECLAIM_write_ticket_to_buffer (ticket, buf, tkt_len); GNUNET_assert (0 <= written); buf += written; } // TODO add success member irm->id = htonl (r_id); - irm->presentations_len = htonl (pres_len); + irm->presentations_len = htons (pres_len); if (NULL != presentations) { GNUNET_RECLAIM_presentation_list_serialize (presentations, @@ -745,9 +745,9 @@ check_issue_ticket_message (void *cls, const struct IssueTicketMessage *im) size_t pkey_len; size = ntohs (im->header.size); - attrs_len = ntohl (im->attr_len); - key_len = ntohl (im->key_len); - pkey_len = ntohl (im->pkey_len); + attrs_len = ntohs (im->attr_len); + key_len = ntohs (im->key_len); + pkey_len = ntohs (im->pkey_len); if (size != attrs_len + key_len + pkey_len + sizeof(struct IssueTicketMessage)) { @@ -780,7 +780,7 @@ handle_issue_ticket_message (void *cls, const struct IssueTicketMessage *im) char *buf; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ISSUE_TICKET message\n"); - key_len = ntohl (im->key_len); + key_len = ntohs (im->key_len); buf = (char *) &im[1]; if ((GNUNET_SYSERR == GNUNET_IDENTITY_read_private_key_from_buffer (buf, key_len, @@ -793,7 +793,7 @@ handle_issue_ticket_message (void *cls, const struct IssueTicketMessage *im) return; } buf += read; - pkey_len = ntohl (im->pkey_len); + pkey_len = ntohs (im->pkey_len); if ((GNUNET_SYSERR == GNUNET_IDENTITY_read_public_key_from_buffer (buf, pkey_len, &rp, &read)) || @@ -806,7 +806,7 @@ handle_issue_ticket_message (void *cls, const struct IssueTicketMessage *im) } buf += read; tio = GNUNET_new (struct TicketIssueOperation); - attrs_len = ntohl (im->attr_len); + attrs_len = ntohs (im->attr_len); attrs = GNUNET_RECLAIM_attribute_list_deserialize (buf, attrs_len); for (le = attrs->list_head; NULL != le; le = le->next) @@ -898,7 +898,7 @@ handle_revoke_ticket_message (void *cls, const struct RevokeTicketMessage *rm) char *buf; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received REVOKE_TICKET message\n"); - key_len = ntohl (rm->key_len); + key_len = ntohs (rm->key_len); buf = (char *) &rm[1]; if ((GNUNET_SYSERR == GNUNET_IDENTITY_read_private_key_from_buffer (buf, key_len, @@ -911,7 +911,7 @@ handle_revoke_ticket_message (void *cls, const struct RevokeTicketMessage *rm) return; } buf += read; - tkt_len = ntohl (rm->tkt_len); + tkt_len = ntohs (rm->tkt_len); if ((GNUNET_SYSERR == GNUNET_RECLAIM_read_ticket_from_buffer (buf, tkt_len, &ticket, &read)) || @@ -972,10 +972,10 @@ consume_result_cb (void *cls, attrs_len + pres_len + key_len, GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT); crm->id = htonl (cop->r_id); - crm->attrs_len = htonl (attrs_len); - crm->presentations_len = htonl (pres_len); - crm->key_len = htonl (key_len); - crm->result = htonl (success); + crm->attrs_len = htons (attrs_len); + crm->presentations_len = htons (pres_len); + crm->key_len = htons (key_len); + crm->result = htons (success); data_tmp = (char *) &crm[1]; written = GNUNET_IDENTITY_write_public_key_to_buffer (identity, data_tmp, @@ -1033,7 +1033,7 @@ handle_consume_ticket_message (void *cls, const struct ConsumeTicketMessage *cm) char *buf; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CONSUME_TICKET message\n"); - key_len = ntohl (cm->key_len); + key_len = ntohs (cm->key_len); buf = (char *) &cm[1]; if ((GNUNET_SYSERR == GNUNET_IDENTITY_read_private_key_from_buffer (buf, key_len, @@ -1046,7 +1046,7 @@ handle_consume_ticket_message (void *cls, const struct ConsumeTicketMessage *cm) return; } buf += read; - tkt_len = ntohl (cm->tkt_len); + tkt_len = ntohs (cm->tkt_len); if ((GNUNET_SYSERR == GNUNET_RECLAIM_read_ticket_from_buffer (buf, tkt_len, &ticket, &read)) || @@ -1196,8 +1196,8 @@ handle_attribute_store_message (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ATTRIBUTE_STORE message\n"); - data_len = ntohl (sam->attr_len); - key_len = ntohl (sam->key_len); + data_len = ntohs (sam->attr_len); + key_len = ntohs (sam->key_len); buf = (char *) &sam[1]; if ((GNUNET_SYSERR == GNUNET_IDENTITY_read_private_key_from_buffer (buf, key_len, @@ -1397,8 +1397,8 @@ handle_credential_store_message (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CREDENTIAL_STORE message\n"); - data_len = ntohl (sam->attr_len); - key_len = ntohl (sam->key_len); + data_len = ntohs (sam->attr_len); + key_len = ntohs (sam->key_len); buf = (char *) &sam[1]; if ((GNUNET_SYSERR == GNUNET_IDENTITY_read_private_key_from_buffer (buf, key_len, @@ -1868,8 +1868,8 @@ handle_attribute_delete_message (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ATTRIBUTE_DELETE message\n"); - data_len = ntohl (dam->attr_len); - key_len = ntohl (dam->key_len); + data_len = ntohs (dam->attr_len); + key_len = ntohs (dam->key_len); buf = (char *) &dam[1]; if ((GNUNET_SYSERR == GNUNET_IDENTITY_read_private_key_from_buffer (buf, key_len, @@ -1975,8 +1975,8 @@ handle_credential_delete_message (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CREDENTIAL_DELETE message\n"); - data_len = ntohl (dam->attr_len); - key_len = ntohl (dam->key_len); + data_len = ntohs (dam->attr_len); + key_len = ntohs (dam->key_len); buf = (char *) &dam[1]; if ((GNUNET_SYSERR == GNUNET_IDENTITY_read_private_key_from_buffer (buf, key_len, @@ -2032,8 +2032,8 @@ attr_iter_finished (void *cls) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending ATTRIBUTE_RESULT message\n"); env = GNUNET_MQ_msg (arm, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT); arm->id = htonl (ai->request_id); - arm->attr_len = htonl (0); - arm->pkey_len = htonl (0); + arm->attr_len = htons (0); + arm->pkey_len = htons (0); GNUNET_MQ_send (ai->client->mq, env); GNUNET_CONTAINER_DLL_remove (ai->client->attr_iter_head, ai->client->attr_iter_tail, @@ -2097,9 +2097,9 @@ attr_iter_cb (void *cls, rd->data_size + key_len, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT); arm->id = htonl (ai->request_id); - arm->attr_len = htonl (rd->data_size); + arm->attr_len = htons (rd->data_size); data_tmp = (char *) &arm[1]; - arm->pkey_len = htonl (key_len); + arm->pkey_len = htons (key_len); written = GNUNET_IDENTITY_write_public_key_to_buffer (&identity, data_tmp, key_len); @@ -2119,7 +2119,7 @@ check_iteration_start ( size_t key_len; size = ntohs (ais_msg->header.size); - key_len = ntohl (ais_msg->key_len); + key_len = ntohs (ais_msg->key_len); if (size < key_len + sizeof(*ais_msg)) { @@ -2147,7 +2147,7 @@ handle_iteration_start (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ATTRIBUTE_ITERATION_START message\n"); - key_len = ntohl (ais_msg->key_len); + key_len = ntohs (ais_msg->key_len); if ((GNUNET_SYSERR == GNUNET_IDENTITY_read_private_key_from_buffer (&ais_msg[1], key_len, @@ -2262,8 +2262,8 @@ cred_iter_finished (void *cls) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending CREDENTIAL_RESULT message\n"); env = GNUNET_MQ_msg (arm, GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_RESULT); arm->id = htonl (ai->request_id); - arm->credential_len = htonl (0); - arm->key_len = htonl (0); + arm->credential_len = htons (0); + arm->key_len = htons (0); GNUNET_MQ_send (ai->client->mq, env); GNUNET_CONTAINER_DLL_remove (ai->client->cred_iter_head, ai->client->cred_iter_tail, @@ -2327,8 +2327,8 @@ cred_iter_cb (void *cls, rd->data_size + key_len, GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_RESULT); arm->id = htonl (ai->request_id); - arm->credential_len = htonl (rd->data_size); - arm->key_len = htonl (key_len); + arm->credential_len = htons (rd->data_size); + arm->key_len = htons (key_len); data_tmp = (char *) &arm[1]; written = GNUNET_IDENTITY_write_public_key_to_buffer (&identity, data_tmp, @@ -2348,7 +2348,7 @@ check_credential_iteration_start ( size_t key_len; size = ntohs (cis_msg->header.size); - key_len = ntohl (cis_msg->key_len); + key_len = ntohs (cis_msg->key_len); if (size < key_len + sizeof(*cis_msg)) { @@ -2378,7 +2378,7 @@ handle_credential_iteration_start (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CREDENTIAL_ITERATION_START message\n"); - key_len = ntohl (ais_msg->key_len); + key_len = ntohs (ais_msg->key_len); if ((GNUNET_SYSERR == GNUNET_IDENTITY_read_private_key_from_buffer (&ais_msg[1], key_len, @@ -2516,7 +2516,7 @@ ticket_iter_cb (void *cls, struct GNUNET_RECLAIM_Ticket *ticket) &trm[1], tkt_len); } - trm->tkt_len = htonl (tkt_len); + trm->tkt_len = htons (tkt_len); trm->id = htonl (ti->r_id); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending TICKET_RESULT message\n"); GNUNET_MQ_send (ti->client->mq, env); @@ -2533,7 +2533,7 @@ check_ticket_iteration_start ( size_t key_len; size = ntohs (tis_msg->header.size); - key_len = ntohl (tis_msg->key_len); + key_len = ntohs (tis_msg->key_len); if (size < key_len + sizeof(*tis_msg)) { @@ -2562,7 +2562,7 @@ handle_ticket_iteration_start ( GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received TICKET_ITERATION_START message\n"); - key_len = ntohl (tis_msg->key_len); + key_len = ntohs (tis_msg->key_len); if ((GNUNET_SYSERR == GNUNET_IDENTITY_read_private_key_from_buffer (&tis_msg[1], 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 /** * The length of the attribute */ - uint32_t attr_len GNUNET_PACKED; + uint16_t attr_len GNUNET_PACKED; /** * The length of the private key */ - uint32_t key_len GNUNET_PACKED; + uint16_t key_len GNUNET_PACKED; /* * followed by the zone private key @@ -88,12 +88,12 @@ struct AttributeDeleteMessage /** * The length of the attribute */ - uint32_t attr_len GNUNET_PACKED; + uint16_t attr_len GNUNET_PACKED; /** * The length of the private key */ - uint32_t key_len GNUNET_PACKED; + uint16_t key_len GNUNET_PACKED; /* followed by the serialized attribute */ }; @@ -135,20 +135,25 @@ struct AttributeResultMessage */ uint32_t id GNUNET_PACKED; + /** + * Reserved (alignment) + */ + uint16_t reserved GNUNET_PACKED; + /** * Length of serialized attribute data */ - uint32_t attr_len GNUNET_PACKED; + uint16_t attr_len GNUNET_PACKED; /** * Length of serialized credential data */ - uint32_t credential_len GNUNET_PACKED; + uint16_t credential_len GNUNET_PACKED; /** * The length of the public key */ - uint32_t pkey_len GNUNET_PACKED; + uint16_t pkey_len GNUNET_PACKED; /** * followed by the public key key. @@ -175,12 +180,12 @@ struct CredentialResultMessage /** * Length of serialized attribute data */ - uint32_t credential_len GNUNET_PACKED; + uint16_t credential_len GNUNET_PACKED; /** * The length of the public key */ - uint32_t key_len GNUNET_PACKED; + uint16_t key_len GNUNET_PACKED; /** * followed by the private key. @@ -205,10 +210,15 @@ struct AttributeIterationStartMessage */ uint32_t id GNUNET_PACKED; + /** + * Reserved (alignment) + */ + uint16_t reserved GNUNET_PACKED; + /** * The length of the private key */ - uint32_t key_len GNUNET_PACKED; + uint16_t key_len GNUNET_PACKED; /** * followed by the private key. @@ -248,10 +258,15 @@ struct CredentialIterationStartMessage */ uint32_t id GNUNET_PACKED; + /** + * Reserved (alignment) + */ + uint16_t reserved GNUNET_PACKED; + /** * The length of the private key */ - uint32_t key_len GNUNET_PACKED; + uint16_t key_len GNUNET_PACKED; /** * followed by the private key. @@ -324,10 +339,15 @@ struct TicketIterationStartMessage */ uint32_t id GNUNET_PACKED; + /** + * Reserved (alignment) + */ + uint16_t reserved GNUNET_PACKED; + /** * The length of the private key */ - uint32_t key_len GNUNET_PACKED; + uint16_t key_len GNUNET_PACKED; /** * followed by the private key. @@ -384,20 +404,25 @@ struct IssueTicketMessage */ uint32_t id GNUNET_PACKED; + /** + * Reserved (alignment) + */ + uint16_t reserved GNUNET_PACKED; + /** * length of serialized attribute list */ - uint32_t attr_len GNUNET_PACKED; + uint16_t attr_len GNUNET_PACKED; /** * The length of the identity private key */ - uint32_t key_len GNUNET_PACKED; + uint16_t key_len GNUNET_PACKED; /** * The length of the relying party public key */ - uint32_t pkey_len GNUNET_PACKED; + uint16_t pkey_len GNUNET_PACKED; /** * Followed by the private key. @@ -424,12 +449,12 @@ struct RevokeTicketMessage /** * The length of the private key */ - uint32_t key_len GNUNET_PACKED; + uint16_t key_len GNUNET_PACKED; /** * The length of the ticket */ - uint32_t tkt_len GNUNET_PACKED; + uint16_t tkt_len GNUNET_PACKED; /** * Followed by the serialized ticket. @@ -478,12 +503,12 @@ struct TicketResultMessage /** * Ticket length */ - uint32_t tkt_len GNUNET_PACKED; + uint16_t tkt_len GNUNET_PACKED; /** * Length of new presentations created */ - uint32_t presentations_len GNUNET_PACKED; + uint16_t presentations_len GNUNET_PACKED; /* * Followed by the serialized ticket @@ -509,12 +534,12 @@ struct ConsumeTicketMessage /** * The length of the private key */ - uint32_t key_len GNUNET_PACKED; + uint16_t key_len GNUNET_PACKED; /** * The length of the ticket */ - uint32_t tkt_len GNUNET_PACKED; + uint16_t tkt_len GNUNET_PACKED; /** * Followed by the private key. @@ -542,20 +567,25 @@ struct ConsumeTicketResultMessage */ uint32_t result GNUNET_PACKED; + /** + * Reserved (alignment) + */ + uint16_t reserved GNUNET_PACKED; + /** * Length of serialized attribute data */ - uint32_t attrs_len GNUNET_PACKED; + uint16_t attrs_len GNUNET_PACKED; /** * Length of presentation data */ - uint32_t presentations_len; + uint16_t presentations_len; /** * The length of the private key */ - uint32_t key_len GNUNET_PACKED; + uint16_t key_len GNUNET_PACKED; /** * 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, size_t key_len; msg_len = ntohs (msg->header.size); - attrs_len = ntohl (msg->attrs_len); - key_len = ntohl (msg->key_len); - pl_len = ntohl (msg->presentations_len); + attrs_len = ntohs (msg->attrs_len); + key_len = ntohs (msg->key_len); + pl_len = ntohs (msg->presentations_len); if (msg_len != sizeof(*msg) + attrs_len + pl_len + key_len) { GNUNET_break (0); @@ -603,9 +603,9 @@ handle_consume_ticket_result (void *cls, uint32_t r_id = ntohl (msg->id); char *read_ptr; - attrs_len = ntohl (msg->attrs_len); - key_len = ntohl (msg->key_len); - pl_len = ntohl (msg->presentations_len); + attrs_len = ntohs (msg->attrs_len); + key_len = ntohs (msg->key_len); + pl_len = ntohs (msg->presentations_len); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Processing ticket result.\n"); @@ -694,8 +694,8 @@ check_attribute_result (void *cls, const struct AttributeResultMessage *msg) size_t key_len; msg_len = ntohs (msg->header.size); - attr_len = ntohl (msg->attr_len); - key_len = ntohl (msg->pkey_len); + attr_len = ntohs (msg->attr_len); + key_len = ntohs (msg->pkey_len); if (msg_len != sizeof(*msg) + attr_len + key_len) { GNUNET_break (0); @@ -725,8 +725,8 @@ handle_attribute_result (void *cls, const struct AttributeResultMessage *msg) uint32_t r_id = ntohl (msg->id); char *buf; - attr_len = ntohl (msg->attr_len); - key_len = ntohl (msg->pkey_len); + attr_len = ntohs (msg->attr_len); + key_len = ntohs (msg->pkey_len); LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing attribute result.\n"); for (it = h->it_head; NULL != it; it = it->next) @@ -805,8 +805,8 @@ check_credential_result (void *cls, const struct CredentialResultMessage *msg) size_t key_len; msg_len = ntohs (msg->header.size); - cred_len = ntohl (msg->credential_len); - key_len = ntohl (msg->key_len); + cred_len = ntohs (msg->credential_len); + key_len = ntohs (msg->key_len); if (msg_len != sizeof(*msg) + cred_len + key_len) { GNUNET_break (0); @@ -837,8 +837,8 @@ handle_credential_result (void *cls, const struct uint32_t r_id = ntohl (msg->id); char *buf; - key_len = ntohl (msg->key_len); - att_len = ntohl (msg->credential_len); + key_len = ntohs (msg->key_len); + att_len = ntohs (msg->credential_len); LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing credential result.\n"); @@ -922,8 +922,8 @@ check_ticket_result (void *cls, const struct TicketResultMessage *msg) size_t tkt_len; msg_len = ntohs (msg->header.size); - pres_len = ntohl (msg->presentations_len); - tkt_len = ntohl (msg->tkt_len); + pres_len = ntohs (msg->presentations_len); + tkt_len = ntohs (msg->tkt_len); if (msg_len != sizeof(*msg) + pres_len + tkt_len) { GNUNET_break (0); @@ -954,8 +954,8 @@ handle_ticket_result (void *cls, const struct TicketResultMessage *msg) size_t tb_read; char *buf; - tkt_len = ntohl (msg->tkt_len); - pres_len = ntohl (msg->presentations_len); + tkt_len = ntohs (msg->tkt_len); + pres_len = ntohs (msg->presentations_len); for (op = handle->op_head; NULL != op; op = op->next) if (op->r_id == r_id) break; @@ -1186,7 +1186,7 @@ GNUNET_RECLAIM_attribute_store ( op->env = GNUNET_MQ_msg_extra (sam, attr_len + key_len, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE); - sam->key_len = htonl (key_len); + sam->key_len = htons (key_len); buf = (char *) &sam[1]; written = GNUNET_IDENTITY_write_private_key_to_buffer (pkey, buf, key_len); GNUNET_assert (0 < written); @@ -1229,7 +1229,7 @@ GNUNET_RECLAIM_attribute_delete ( op->env = GNUNET_MQ_msg_extra (dam, attr_len + key_len, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE); - dam->key_len = htonl (key_len); + dam->key_len = htons (key_len); buf = (char *) &dam[1]; written = GNUNET_IDENTITY_write_private_key_to_buffer (pkey, buf, key_len); GNUNET_assert (0 < written); @@ -1271,7 +1271,7 @@ GNUNET_RECLAIM_credential_store ( op->env = GNUNET_MQ_msg_extra (sam, attr_len + key_len, GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_STORE); - sam->key_len = htonl (key_len); + sam->key_len = htons (key_len); buf = (char *) &sam[1]; written = GNUNET_IDENTITY_write_private_key_to_buffer (pkey, buf, key_len); GNUNET_assert (0 <= written); @@ -1314,7 +1314,7 @@ GNUNET_RECLAIM_credential_delete ( op->env = GNUNET_MQ_msg_extra (dam, attr_len + key_len, GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_DELETE); - dam->key_len = htonl (key_len); + dam->key_len = htons (key_len); buf = (char *) &dam[1]; written = GNUNET_IDENTITY_write_private_key_to_buffer (pkey, buf, key_len); GNUNET_assert (0 <= written); @@ -1364,7 +1364,7 @@ GNUNET_RECLAIM_get_attributes_start ( key_len, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START); msg->id = htonl (rid); - msg->key_len = htonl (key_len); + msg->key_len = htons (key_len); GNUNET_IDENTITY_write_private_key_to_buffer (identity, &msg[1], key_len); if (NULL == h->mq) it->env = env; @@ -1441,7 +1441,7 @@ GNUNET_RECLAIM_get_credentials_start ( key_len, GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_START); msg->id = htonl (rid); - msg->key_len = htonl (key_len); + msg->key_len = htons (key_len); GNUNET_IDENTITY_write_private_key_to_buffer (identity, &msg[1], key_len); if (NULL == h->mq) ait->env = env; @@ -1515,8 +1515,8 @@ GNUNET_RECLAIM_ticket_issue ( op->env = GNUNET_MQ_msg_extra (tim, attr_len + key_len + rpk_len, GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET); - tim->key_len = htonl (key_len); - tim->pkey_len = htonl (rpk_len); + tim->key_len = htons (key_len); + tim->pkey_len = htons (rpk_len); buf = (char *) &tim[1]; written = GNUNET_IDENTITY_write_private_key_to_buffer (iss, buf, key_len); GNUNET_assert (0 <= written); @@ -1571,11 +1571,11 @@ GNUNET_RECLAIM_ticket_consume ( op->env = GNUNET_MQ_msg_extra (ctm, key_len + tkt_len, GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET); - ctm->key_len = htonl (key_len); + ctm->key_len = htons (key_len); buf = (char*) &ctm[1]; GNUNET_IDENTITY_write_private_key_to_buffer (identity, buf, key_len); buf += key_len; - ctm->tkt_len = htonl (tkt_len); + ctm->tkt_len = htons (tkt_len); GNUNET_RECLAIM_write_ticket_to_buffer (ticket, buf, tkt_len); ctm->id = htonl (op->r_id); if (NULL != h->mq) @@ -1620,7 +1620,7 @@ GNUNET_RECLAIM_ticket_iteration_start ( key_len, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START); msg->id = htonl (rid); - msg->key_len = htonl (key_len); + msg->key_len = htons (key_len); GNUNET_IDENTITY_write_private_key_to_buffer (identity, &msg[1], key_len); @@ -1718,8 +1718,8 @@ GNUNET_RECLAIM_ticket_revoke ( key_len + tkt_len, GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET); msg->id = htonl (rid); - msg->key_len = htonl (key_len); - msg->tkt_len = htonl (tkt_len); + msg->key_len = htons (key_len); + msg->tkt_len = htons (tkt_len); buf = (char*) &msg[1]; written = GNUNET_IDENTITY_write_private_key_to_buffer (identity, buf, -- cgit v1.2.3