summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/or/rendcommon.c12
-rw-r--r--src/or/rendmid.c2
-rw-r--r--src/or/rendservice.c2
3 files changed, 8 insertions, 8 deletions
diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c
index fe3c17a4b4..f82becb4ad 100644
--- a/src/or/rendcommon.c
+++ b/src/or/rendcommon.c
@@ -42,14 +42,14 @@ rend_encode_service_descriptor(rend_service_descriptor_t *desc,
*len_out += strlen(desc->intro_points[i]) + 1;
}
cp = *str_out = tor_malloc(*len_out);
- set_uint16(cp, (uint16_t)asn1len);
+ set_uint16(cp, htons((uint16_t)asn1len));
cp += 2;
memcpy(cp, buf, asn1len);
tor_free(buf);
cp += asn1len;
- set_uint32(cp, (uint32_t)desc->timestamp);
+ set_uint32(cp, htonl((uint32_t)desc->timestamp));
cp += 4;
- set_uint16(cp, (uint16_t)desc->n_intro_points);
+ set_uint16(cp, htons((uint16_t)desc->n_intro_points));
cp += 2;
for (i=0; i < desc->n_intro_points; ++i) {
ipoint = (char*)desc->intro_points[i];
@@ -79,17 +79,17 @@ rend_service_descriptor_t *rend_parse_service_descriptor(
cp = str;
end = str+len;
if (end-cp < 2) goto truncated;
- asn1len = get_uint16(cp);
+ asn1len = ntohs(get_uint16(cp));
cp += 2;
if (end-cp < asn1len) goto truncated;
result->pk = crypto_pk_asn1_decode(cp, asn1len);
if (!result->pk) goto truncated;
cp += asn1len;
if (end-cp < 4) goto truncated;
- result->timestamp = (time_t) get_uint32(cp);
+ result->timestamp = (time_t) ntohl(get_uint32(cp));
cp += 4;
if (end-cp < 2) goto truncated;
- result->n_intro_points = get_uint16(cp);
+ result->n_intro_points = ntohs(get_uint16(cp));
result->intro_points = tor_malloc_zero(sizeof(char*)*result->n_intro_points);
cp += 2;
for (i=0;i<result->n_intro_points;++i) {
diff --git a/src/or/rendmid.c b/src/or/rendmid.c
index 3e341714c9..d6267a7052 100644
--- a/src/or/rendmid.c
+++ b/src/or/rendmid.c
@@ -28,7 +28,7 @@ rend_mid_establish_intro(circuit_t *circ, const char *request, int request_len)
if (request_len < 2+DIGEST_LEN)
goto truncated;
/* First 2 bytes: length of asn1-encoded key. */
- asn1len = get_uint16(request);
+ asn1len = ntohs(get_uint16(request));
/* Next asn1len bytes: asn1-encoded key. */
if (request_len < 2+DIGEST_LEN+asn1len)
diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index 0de9e414d2..f2b9318c46 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -498,7 +498,7 @@ rend_service_intro_is_ready(circuit_t *circuit)
/* Build the payload for a RELAY_ESTABLISH_INTRO cell. */
len = crypto_pk_asn1_encode(service->private_key, buf+2,
RELAY_PAYLOAD_SIZE-2);
- set_uint16(buf, len);
+ set_uint16(buf, htons(len));
len += 2;
memcpy(auth, circuit->cpath->prev->handshake_digest, DIGEST_LEN);
memcpy(auth+DIGEST_LEN, "INTRODUCE", 9);