summaryrefslogtreecommitdiff
path: root/src/trunnel
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2016-12-16 12:04:57 -0500
committerDavid Goulet <dgoulet@torproject.org>2016-12-16 12:21:07 -0500
commite043b96887be4aaa103de8e4d31f8fc9008ae75d (patch)
tree12883393b4bf76b3c8d723e0d1d1ce8f805c3d3c /src/trunnel
parent2a00110e5bd3592ff69e659681b9294285a98dd0 (diff)
downloadtor-e043b96887be4aaa103de8e4d31f8fc9008ae75d.tar.gz
tor-e043b96887be4aaa103de8e4d31f8fc9008ae75d.zip
trunnel: Move ESTABLISH_INTRO cell sig_len after the end_sig_fields
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/trunnel')
-rw-r--r--src/trunnel/hs/cell_establish_intro.c12
-rw-r--r--src/trunnel/hs/cell_establish_intro.h8
-rw-r--r--src/trunnel/hs/cell_establish_intro.trunnel2
3 files changed, 11 insertions, 11 deletions
diff --git a/src/trunnel/hs/cell_establish_intro.c b/src/trunnel/hs/cell_establish_intro.c
index 02094fe2bf..633bd7c214 100644
--- a/src/trunnel/hs/cell_establish_intro.c
+++ b/src/trunnel/hs/cell_establish_intro.c
@@ -231,6 +231,11 @@ hs_cell_establish_intro_getconstarray_handshake_mac(const hs_cell_establish_intr
{
return (const uint8_t *)hs_cell_establish_intro_getarray_handshake_mac((hs_cell_establish_intro_t*)inp);
}
+const uint8_t *
+hs_cell_establish_intro_get_end_sig_fields(const hs_cell_establish_intro_t *inp)
+{
+ return inp->end_sig_fields;
+}
uint16_t
hs_cell_establish_intro_get_sig_len(const hs_cell_establish_intro_t *inp)
{
@@ -242,11 +247,6 @@ hs_cell_establish_intro_set_sig_len(hs_cell_establish_intro_t *inp, uint16_t val
inp->sig_len = val;
return 0;
}
-const uint8_t *
-hs_cell_establish_intro_get_end_sig_fields(const hs_cell_establish_intro_t *inp)
-{
- return inp->end_sig_fields;
-}
size_t
hs_cell_establish_intro_getlen_sig(const hs_cell_establish_intro_t *inp)
{
@@ -518,12 +518,12 @@ hs_cell_establish_intro_parse_into(hs_cell_establish_intro_t *obj, const uint8_t
CHECK_REMAINING(TRUNNEL_SHA3_256_LEN, truncated);
memcpy(obj->handshake_mac, ptr, TRUNNEL_SHA3_256_LEN);
remaining -= TRUNNEL_SHA3_256_LEN; ptr += TRUNNEL_SHA3_256_LEN;
+ obj->end_sig_fields = ptr;
/* Parse u16 sig_len */
CHECK_REMAINING(2, truncated);
obj->sig_len = trunnel_ntohs(trunnel_get_uint16(ptr));
remaining -= 2; ptr += 2;
- obj->end_sig_fields = ptr;
/* Parse u8 sig[sig_len] */
CHECK_REMAINING(obj->sig_len, truncated);
diff --git a/src/trunnel/hs/cell_establish_intro.h b/src/trunnel/hs/cell_establish_intro.h
index a9166f10d8..725d47cd85 100644
--- a/src/trunnel/hs/cell_establish_intro.h
+++ b/src/trunnel/hs/cell_establish_intro.h
@@ -19,8 +19,8 @@ struct hs_cell_establish_intro_st {
struct cell_extension_st *extensions;
const uint8_t *end_mac_fields;
uint8_t handshake_mac[TRUNNEL_SHA3_256_LEN];
- uint16_t sig_len;
const uint8_t *end_sig_fields;
+ uint16_t sig_len;
TRUNNEL_DYNARRAY_HEAD(, uint8_t) sig;
uint8_t trunnel_error_code_;
};
@@ -170,6 +170,9 @@ uint8_t * hs_cell_establish_intro_getarray_handshake_mac(hs_cell_establish_intro
* a const pointer
*/
const uint8_t * hs_cell_establish_intro_getconstarray_handshake_mac(const hs_cell_establish_intro_t *inp);
+/** Return the position for end_sig_fields when we parsed this object
+ */
+const uint8_t * hs_cell_establish_intro_get_end_sig_fields(const hs_cell_establish_intro_t *inp);
/** Return the value of the sig_len field of the
* hs_cell_establish_intro_t in 'inp'
*/
@@ -179,9 +182,6 @@ uint16_t hs_cell_establish_intro_get_sig_len(const hs_cell_establish_intro_t *in
* return -1 and set the error code on 'inp' on failure.
*/
int hs_cell_establish_intro_set_sig_len(hs_cell_establish_intro_t *inp, uint16_t val);
-/** Return the position for end_sig_fields when we parsed this object
- */
-const uint8_t * hs_cell_establish_intro_get_end_sig_fields(const hs_cell_establish_intro_t *inp);
/** Return the length of the dynamic array holding the sig field of
* the hs_cell_establish_intro_t in 'inp'.
*/
diff --git a/src/trunnel/hs/cell_establish_intro.trunnel b/src/trunnel/hs/cell_establish_intro.trunnel
index 4f9e8f7e08..33a133bf67 100644
--- a/src/trunnel/hs/cell_establish_intro.trunnel
+++ b/src/trunnel/hs/cell_establish_intro.trunnel
@@ -26,9 +26,9 @@ struct hs_cell_establish_intro {
u8 handshake_mac[TRUNNEL_SHA3_256_LEN];
/* Signature */
- u16 sig_len;
/* Indicate the end of the handshake authentication data. */
@ptr end_sig_fields;
+ u16 sig_len;
u8 sig[sig_len];
};