aboutsummaryrefslogtreecommitdiff
path: root/src/trunnel
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2017-04-11 13:46:41 -0400
committerDavid Goulet <dgoulet@torproject.org>2017-04-11 13:46:41 -0400
commit6bacc3c7a88509043613d3bc29534c0ecf8803b1 (patch)
treef8216478ca43bf5988d57b7df5065d9496fa0114 /src/trunnel
parent01fc93ffef3843a86710718c12ba9be67dcca2bc (diff)
downloadtor-6bacc3c7a88509043613d3bc29534c0ecf8803b1.tar.gz
tor-6bacc3c7a88509043613d3bc29534c0ecf8803b1.zip
hs: Change trunnel prop224 cell's namespace
One of the goals of this change is to have trunnel API/ABI being more explicit so we namespace them with "trn_*". Furthermore, we can now create hs_cells.[ch] without having to confuse it with trunnel which used to be "hs_cell_*" before that change. Here are the perl line that were used for this rename: perl -i -pe 's/cell_extension/trn_cell_extension/g;' src/*/*.[ch] perl -i -pe 's/cell_extension/trn_cell_extension/g;' src/trunnel/hs/*.trunnel perl -i -pe 's/hs_cell_/trn_cell_/g;' src/*/*.[ch] perl -i -pe 's/hs_cell_/trn_cell_/g;' src/trunnel/hs/*.trunnel And then "./scripts/codegen/run_trunnel.sh" with trunnel commit id 613fb1b98e58504e2b84ef56b1602b6380629043. Fixes #21919 Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/trunnel')
-rw-r--r--src/trunnel/hs/cell_common.c179
-rw-r--r--src/trunnel/hs/cell_common.h207
-rw-r--r--src/trunnel/hs/cell_common.trunnel6
-rw-r--r--src/trunnel/hs/cell_establish_intro.c242
-rw-r--r--src/trunnel/hs/cell_establish_intro.h237
-rw-r--r--src/trunnel/hs/cell_establish_intro.trunnel10
-rw-r--r--src/trunnel/hs/cell_introduce1.c398
-rw-r--r--src/trunnel/hs/cell_introduce1.h416
-rw-r--r--src/trunnel/hs/cell_introduce1.trunnel14
9 files changed, 858 insertions, 851 deletions
diff --git a/src/trunnel/hs/cell_common.c b/src/trunnel/hs/cell_common.c
index 830f2260ee..b7f19ffc60 100644
--- a/src/trunnel/hs/cell_common.c
+++ b/src/trunnel/hs/cell_common.c
@@ -28,10 +28,10 @@ int cellcommon_deadcode_dummy__ = 0;
} \
} while (0)
-cell_extension_fields_t *
-cell_extension_fields_new(void)
+trn_cell_extension_fields_t *
+trn_cell_extension_fields_new(void)
{
- cell_extension_fields_t *val = trunnel_calloc(1, sizeof(cell_extension_fields_t));
+ trn_cell_extension_fields_t *val = trunnel_calloc(1, sizeof(trn_cell_extension_fields_t));
if (NULL == val)
return NULL;
return val;
@@ -40,7 +40,7 @@ cell_extension_fields_new(void)
/** Release all storage held inside 'obj', but do not free 'obj'.
*/
static void
-cell_extension_fields_clear(cell_extension_fields_t *obj)
+trn_cell_extension_fields_clear(trn_cell_extension_fields_t *obj)
{
(void) obj;
TRUNNEL_DYNARRAY_WIPE(&obj->field);
@@ -48,62 +48,62 @@ cell_extension_fields_clear(cell_extension_fields_t *obj)
}
void
-cell_extension_fields_free(cell_extension_fields_t *obj)
+trn_cell_extension_fields_free(trn_cell_extension_fields_t *obj)
{
if (obj == NULL)
return;
- cell_extension_fields_clear(obj);
- trunnel_memwipe(obj, sizeof(cell_extension_fields_t));
+ trn_cell_extension_fields_clear(obj);
+ trunnel_memwipe(obj, sizeof(trn_cell_extension_fields_t));
trunnel_free_(obj);
}
uint8_t
-cell_extension_fields_get_field_type(const cell_extension_fields_t *inp)
+trn_cell_extension_fields_get_field_type(const trn_cell_extension_fields_t *inp)
{
return inp->field_type;
}
int
-cell_extension_fields_set_field_type(cell_extension_fields_t *inp, uint8_t val)
+trn_cell_extension_fields_set_field_type(trn_cell_extension_fields_t *inp, uint8_t val)
{
inp->field_type = val;
return 0;
}
uint8_t
-cell_extension_fields_get_field_len(const cell_extension_fields_t *inp)
+trn_cell_extension_fields_get_field_len(const trn_cell_extension_fields_t *inp)
{
return inp->field_len;
}
int
-cell_extension_fields_set_field_len(cell_extension_fields_t *inp, uint8_t val)
+trn_cell_extension_fields_set_field_len(trn_cell_extension_fields_t *inp, uint8_t val)
{
inp->field_len = val;
return 0;
}
size_t
-cell_extension_fields_getlen_field(const cell_extension_fields_t *inp)
+trn_cell_extension_fields_getlen_field(const trn_cell_extension_fields_t *inp)
{
return TRUNNEL_DYNARRAY_LEN(&inp->field);
}
uint8_t
-cell_extension_fields_get_field(cell_extension_fields_t *inp, size_t idx)
+trn_cell_extension_fields_get_field(trn_cell_extension_fields_t *inp, size_t idx)
{
return TRUNNEL_DYNARRAY_GET(&inp->field, idx);
}
uint8_t
-cell_extension_fields_getconst_field(const cell_extension_fields_t *inp, size_t idx)
+trn_cell_extension_fields_getconst_field(const trn_cell_extension_fields_t *inp, size_t idx)
{
- return cell_extension_fields_get_field((cell_extension_fields_t*)inp, idx);
+ return trn_cell_extension_fields_get_field((trn_cell_extension_fields_t*)inp, idx);
}
int
-cell_extension_fields_set_field(cell_extension_fields_t *inp, size_t idx, uint8_t elt)
+trn_cell_extension_fields_set_field(trn_cell_extension_fields_t *inp, size_t idx, uint8_t elt)
{
TRUNNEL_DYNARRAY_SET(&inp->field, idx, elt);
return 0;
}
int
-cell_extension_fields_add_field(cell_extension_fields_t *inp, uint8_t elt)
+trn_cell_extension_fields_add_field(trn_cell_extension_fields_t *inp, uint8_t elt)
{
#if SIZE_MAX >= UINT8_MAX
if (inp->field.n_ == UINT8_MAX)
@@ -117,17 +117,17 @@ cell_extension_fields_add_field(cell_extension_fields_t *inp, uint8_t elt)
}
uint8_t *
-cell_extension_fields_getarray_field(cell_extension_fields_t *inp)
+trn_cell_extension_fields_getarray_field(trn_cell_extension_fields_t *inp)
{
return inp->field.elts_;
}
const uint8_t *
-cell_extension_fields_getconstarray_field(const cell_extension_fields_t *inp)
+trn_cell_extension_fields_getconstarray_field(const trn_cell_extension_fields_t *inp)
{
- return (const uint8_t *)cell_extension_fields_getarray_field((cell_extension_fields_t*)inp);
+ return (const uint8_t *)trn_cell_extension_fields_getarray_field((trn_cell_extension_fields_t*)inp);
}
int
-cell_extension_fields_setlen_field(cell_extension_fields_t *inp, size_t newlen)
+trn_cell_extension_fields_setlen_field(trn_cell_extension_fields_t *inp, size_t newlen)
{
uint8_t *newptr;
#if UINT8_MAX < SIZE_MAX
@@ -147,7 +147,7 @@ cell_extension_fields_setlen_field(cell_extension_fields_t *inp, size_t newlen)
return -1;
}
const char *
-cell_extension_fields_check(const cell_extension_fields_t *obj)
+trn_cell_extension_fields_check(const trn_cell_extension_fields_t *obj)
{
if (obj == NULL)
return "Object was NULL";
@@ -159,11 +159,11 @@ cell_extension_fields_check(const cell_extension_fields_t *obj)
}
ssize_t
-cell_extension_fields_encoded_len(const cell_extension_fields_t *obj)
+trn_cell_extension_fields_encoded_len(const trn_cell_extension_fields_t *obj)
{
ssize_t result = 0;
- if (NULL != cell_extension_fields_check(obj))
+ if (NULL != trn_cell_extension_fields_check(obj))
return -1;
@@ -178,24 +178,24 @@ cell_extension_fields_encoded_len(const cell_extension_fields_t *obj)
return result;
}
int
-cell_extension_fields_clear_errors(cell_extension_fields_t *obj)
+trn_cell_extension_fields_clear_errors(trn_cell_extension_fields_t *obj)
{
int r = obj->trunnel_error_code_;
obj->trunnel_error_code_ = 0;
return r;
}
ssize_t
-cell_extension_fields_encode(uint8_t *output, const size_t avail, const cell_extension_fields_t *obj)
+trn_cell_extension_fields_encode(uint8_t *output, const size_t avail, const trn_cell_extension_fields_t *obj)
{
ssize_t result = 0;
size_t written = 0;
uint8_t *ptr = output;
const char *msg;
#ifdef TRUNNEL_CHECK_ENCODED_LEN
- const ssize_t encoded_len = cell_extension_fields_encoded_len(obj);
+ const ssize_t encoded_len = trn_cell_extension_fields_encoded_len(obj);
#endif
- if (NULL != (msg = cell_extension_fields_check(obj)))
+ if (NULL != (msg = trn_cell_extension_fields_check(obj)))
goto check_failed;
#ifdef TRUNNEL_CHECK_ENCODED_LEN
@@ -252,11 +252,11 @@ cell_extension_fields_encode(uint8_t *output, const size_t avail, const cell_ext
return result;
}
-/** As cell_extension_fields_parse(), but do not allocate the output
- * object.
+/** As trn_cell_extension_fields_parse(), but do not allocate the
+ * output object.
*/
static ssize_t
-cell_extension_fields_parse_into(cell_extension_fields_t *obj, const uint8_t *input, const size_t len_in)
+trn_cell_extension_fields_parse_into(trn_cell_extension_fields_t *obj, const uint8_t *input, const size_t len_in)
{
const uint8_t *ptr = input;
size_t remaining = len_in;
@@ -290,23 +290,23 @@ cell_extension_fields_parse_into(cell_extension_fields_t *obj, const uint8_t *in
}
ssize_t
-cell_extension_fields_parse(cell_extension_fields_t **output, const uint8_t *input, const size_t len_in)
+trn_cell_extension_fields_parse(trn_cell_extension_fields_t **output, const uint8_t *input, const size_t len_in)
{
ssize_t result;
- *output = cell_extension_fields_new();
+ *output = trn_cell_extension_fields_new();
if (NULL == *output)
return -1;
- result = cell_extension_fields_parse_into(*output, input, len_in);
+ result = trn_cell_extension_fields_parse_into(*output, input, len_in);
if (result < 0) {
- cell_extension_fields_free(*output);
+ trn_cell_extension_fields_free(*output);
*output = NULL;
}
return result;
}
-cell_extension_t *
-cell_extension_new(void)
+trn_cell_extension_t *
+trn_cell_extension_new(void)
{
- cell_extension_t *val = trunnel_calloc(1, sizeof(cell_extension_t));
+ trn_cell_extension_t *val = trunnel_calloc(1, sizeof(trn_cell_extension_t));
if (NULL == val)
return NULL;
return val;
@@ -315,14 +315,14 @@ cell_extension_new(void)
/** Release all storage held inside 'obj', but do not free 'obj'.
*/
static void
-cell_extension_clear(cell_extension_t *obj)
+trn_cell_extension_clear(trn_cell_extension_t *obj)
{
(void) obj;
{
unsigned idx;
for (idx = 0; idx < TRUNNEL_DYNARRAY_LEN(&obj->fields); ++idx) {
- cell_extension_fields_free(TRUNNEL_DYNARRAY_GET(&obj->fields, idx));
+ trn_cell_extension_fields_free(TRUNNEL_DYNARRAY_GET(&obj->fields, idx));
}
}
TRUNNEL_DYNARRAY_WIPE(&obj->fields);
@@ -330,92 +330,92 @@ cell_extension_clear(cell_extension_t *obj)
}
void
-cell_extension_free(cell_extension_t *obj)
+trn_cell_extension_free(trn_cell_extension_t *obj)
{
if (obj == NULL)
return;
- cell_extension_clear(obj);
- trunnel_memwipe(obj, sizeof(cell_extension_t));
+ trn_cell_extension_clear(obj);
+ trunnel_memwipe(obj, sizeof(trn_cell_extension_t));
trunnel_free_(obj);
}
uint8_t
-cell_extension_get_num(const cell_extension_t *inp)
+trn_cell_extension_get_num(const trn_cell_extension_t *inp)
{
return inp->num;
}
int
-cell_extension_set_num(cell_extension_t *inp, uint8_t val)
+trn_cell_extension_set_num(trn_cell_extension_t *inp, uint8_t val)
{
inp->num = val;
return 0;
}
size_t
-cell_extension_getlen_fields(const cell_extension_t *inp)
+trn_cell_extension_getlen_fields(const trn_cell_extension_t *inp)
{
return TRUNNEL_DYNARRAY_LEN(&inp->fields);
}
-struct cell_extension_fields_st *
-cell_extension_get_fields(cell_extension_t *inp, size_t idx)
+struct trn_cell_extension_fields_st *
+trn_cell_extension_get_fields(trn_cell_extension_t *inp, size_t idx)
{
return TRUNNEL_DYNARRAY_GET(&inp->fields, idx);
}
- const struct cell_extension_fields_st *
-cell_extension_getconst_fields(const cell_extension_t *inp, size_t idx)
+ const struct trn_cell_extension_fields_st *
+trn_cell_extension_getconst_fields(const trn_cell_extension_t *inp, size_t idx)
{
- return cell_extension_get_fields((cell_extension_t*)inp, idx);
+ return trn_cell_extension_get_fields((trn_cell_extension_t*)inp, idx);
}
int
-cell_extension_set_fields(cell_extension_t *inp, size_t idx, struct cell_extension_fields_st * elt)
+trn_cell_extension_set_fields(trn_cell_extension_t *inp, size_t idx, struct trn_cell_extension_fields_st * elt)
{
- cell_extension_fields_t *oldval = TRUNNEL_DYNARRAY_GET(&inp->fields, idx);
+ trn_cell_extension_fields_t *oldval = TRUNNEL_DYNARRAY_GET(&inp->fields, idx);
if (oldval && oldval != elt)
- cell_extension_fields_free(oldval);
- return cell_extension_set0_fields(inp, idx, elt);
+ trn_cell_extension_fields_free(oldval);
+ return trn_cell_extension_set0_fields(inp, idx, elt);
}
int
-cell_extension_set0_fields(cell_extension_t *inp, size_t idx, struct cell_extension_fields_st * elt)
+trn_cell_extension_set0_fields(trn_cell_extension_t *inp, size_t idx, struct trn_cell_extension_fields_st * elt)
{
TRUNNEL_DYNARRAY_SET(&inp->fields, idx, elt);
return 0;
}
int
-cell_extension_add_fields(cell_extension_t *inp, struct cell_extension_fields_st * elt)
+trn_cell_extension_add_fields(trn_cell_extension_t *inp, struct trn_cell_extension_fields_st * elt)
{
#if SIZE_MAX >= UINT8_MAX
if (inp->fields.n_ == UINT8_MAX)
goto trunnel_alloc_failed;
#endif
- TRUNNEL_DYNARRAY_ADD(struct cell_extension_fields_st *, &inp->fields, elt, {});
+ TRUNNEL_DYNARRAY_ADD(struct trn_cell_extension_fields_st *, &inp->fields, elt, {});
return 0;
trunnel_alloc_failed:
TRUNNEL_SET_ERROR_CODE(inp);
return -1;
}
-struct cell_extension_fields_st * *
-cell_extension_getarray_fields(cell_extension_t *inp)
+struct trn_cell_extension_fields_st * *
+trn_cell_extension_getarray_fields(trn_cell_extension_t *inp)
{
return inp->fields.elts_;
}
-const struct cell_extension_fields_st * const *
-cell_extension_getconstarray_fields(const cell_extension_t *inp)
+const struct trn_cell_extension_fields_st * const *
+trn_cell_extension_getconstarray_fields(const trn_cell_extension_t *inp)
{
- return (const struct cell_extension_fields_st * const *)cell_extension_getarray_fields((cell_extension_t*)inp);
+ return (const struct trn_cell_extension_fields_st * const *)trn_cell_extension_getarray_fields((trn_cell_extension_t*)inp);
}
int
-cell_extension_setlen_fields(cell_extension_t *inp, size_t newlen)
+trn_cell_extension_setlen_fields(trn_cell_extension_t *inp, size_t newlen)
{
- struct cell_extension_fields_st * *newptr;
+ struct trn_cell_extension_fields_st * *newptr;
#if UINT8_MAX < SIZE_MAX
if (newlen > UINT8_MAX)
goto trunnel_alloc_failed;
#endif
newptr = trunnel_dynarray_setlen(&inp->fields.allocated_,
&inp->fields.n_, inp->fields.elts_, newlen,
- sizeof(inp->fields.elts_[0]), (trunnel_free_fn_t) cell_extension_fields_free,
+ sizeof(inp->fields.elts_[0]), (trunnel_free_fn_t) trn_cell_extension_fields_free,
&inp->trunnel_error_code_);
if (newlen != 0 && newptr == NULL)
goto trunnel_alloc_failed;
@@ -426,7 +426,7 @@ cell_extension_setlen_fields(cell_extension_t *inp, size_t newlen)
return -1;
}
const char *
-cell_extension_check(const cell_extension_t *obj)
+trn_cell_extension_check(const trn_cell_extension_t *obj)
{
if (obj == NULL)
return "Object was NULL";
@@ -437,7 +437,7 @@ cell_extension_check(const cell_extension_t *obj)
unsigned idx;
for (idx = 0; idx < TRUNNEL_DYNARRAY_LEN(&obj->fields); ++idx) {
- if (NULL != (msg = cell_extension_fields_check(TRUNNEL_DYNARRAY_GET(&obj->fields, idx))))
+ if (NULL != (msg = trn_cell_extension_fields_check(TRUNNEL_DYNARRAY_GET(&obj->fields, idx))))
return msg;
}
}
@@ -447,46 +447,46 @@ cell_extension_check(const cell_extension_t *obj)
}
ssize_t
-cell_extension_encoded_len(const cell_extension_t *obj)
+trn_cell_extension_encoded_len(const trn_cell_extension_t *obj)
{
ssize_t result = 0;
- if (NULL != cell_extension_check(obj))
+ if (NULL != trn_cell_extension_check(obj))
return -1;
/* Length of u8 num */
result += 1;
- /* Length of struct cell_extension_fields fields[num] */
+ /* Length of struct trn_cell_extension_fields fields[num] */
{
unsigned idx;
for (idx = 0; idx < TRUNNEL_DYNARRAY_LEN(&obj->fields); ++idx) {
- result += cell_extension_fields_encoded_len(TRUNNEL_DYNARRAY_GET(&obj->fields, idx));
+ result += trn_cell_extension_fields_encoded_len(TRUNNEL_DYNARRAY_GET(&obj->fields, idx));
}
}
return result;
}
int
-cell_extension_clear_errors(cell_extension_t *obj)
+trn_cell_extension_clear_errors(trn_cell_extension_t *obj)
{
int r = obj->trunnel_error_code_;
obj->trunnel_error_code_ = 0;
return r;
}
ssize_t
-cell_extension_encode(uint8_t *output, const size_t avail, const cell_extension_t *obj)
+trn_cell_extension_encode(uint8_t *output, const size_t avail, const trn_cell_extension_t *obj)
{
ssize_t result = 0;
size_t written = 0;
uint8_t *ptr = output;
const char *msg;
#ifdef TRUNNEL_CHECK_ENCODED_LEN
- const ssize_t encoded_len = cell_extension_encoded_len(obj);
+ const ssize_t encoded_len = trn_cell_extension_encoded_len(obj);
#endif
- if (NULL != (msg = cell_extension_check(obj)))
+ if (NULL != (msg = trn_cell_extension_check(obj)))
goto check_failed;
#ifdef TRUNNEL_CHECK_ENCODED_LEN
@@ -500,13 +500,13 @@ cell_extension_encode(uint8_t *output, const size_t avail, const cell_extension_
trunnel_set_uint8(ptr, (obj->num));
written += 1; ptr += 1;
- /* Encode struct cell_extension_fields fields[num] */
+ /* Encode struct trn_cell_extension_fields fields[num] */
{
unsigned idx;
for (idx = 0; idx < TRUNNEL_DYNARRAY_LEN(&obj->fields); ++idx) {
trunnel_assert(written <= avail);
- result = cell_extension_fields_encode(ptr, avail - written, TRUNNEL_DYNARRAY_GET(&obj->fields, idx));
+ result = trn_cell_extension_fields_encode(ptr, avail - written, TRUNNEL_DYNARRAY_GET(&obj->fields, idx));
if (result < 0)
goto fail; /* XXXXXXX !*/
written += result; ptr += result;
@@ -537,10 +537,11 @@ cell_extension_encode(uint8_t *output, const size_t avail, const cell_extension_
return result;
}
-/** As cell_extension_parse(), but do not allocate the output object.
+/** As trn_cell_extension_parse(), but do not allocate the output
+ * object.
*/
static ssize_t
-cell_extension_parse_into(cell_extension_t *obj, const uint8_t *input, const size_t len_in)
+trn_cell_extension_parse_into(trn_cell_extension_t *obj, const uint8_t *input, const size_t len_in)
{
const uint8_t *ptr = input;
size_t remaining = len_in;
@@ -552,18 +553,18 @@ cell_extension_parse_into(cell_extension_t *obj, const uint8_t *input, const siz
obj->num = (trunnel_get_uint8(ptr));
remaining -= 1; ptr += 1;
- /* Parse struct cell_extension_fields fields[num] */
- TRUNNEL_DYNARRAY_EXPAND(cell_extension_fields_t *, &obj->fields, obj->num, {});
+ /* Parse struct trn_cell_extension_fields fields[num] */
+ TRUNNEL_DYNARRAY_EXPAND(trn_cell_extension_fields_t *, &obj->fields, obj->num, {});
{
- cell_extension_fields_t * elt;
+ trn_cell_extension_fields_t * elt;
unsigned idx;
for (idx = 0; idx < obj->num; ++idx) {
- result = cell_extension_fields_parse(&elt, ptr, remaining);
+ result = trn_cell_extension_fields_parse(&elt, ptr, remaining);
if (result < 0)
goto relay_fail;
trunnel_assert((size_t)result <= remaining);
remaining -= result; ptr += result;
- TRUNNEL_DYNARRAY_ADD(cell_extension_fields_t *, &obj->fields, elt, {cell_extension_fields_free(elt);});
+ TRUNNEL_DYNARRAY_ADD(trn_cell_extension_fields_t *, &obj->fields, elt, {trn_cell_extension_fields_free(elt);});
}
}
trunnel_assert(ptr + remaining == input + len_in);
@@ -579,15 +580,15 @@ cell_extension_parse_into(cell_extension_t *obj, const uint8_t *input, const siz
}
ssize_t
-cell_extension_parse(cell_extension_t **output, const uint8_t *input, const size_t len_in)
+trn_cell_extension_parse(trn_cell_extension_t **output, const uint8_t *input, const size_t len_in)
{
ssize_t result;
- *output = cell_extension_new();
+ *output = trn_cell_extension_new();
if (NULL == *output)
return -1;
- result = cell_extension_parse_into(*output, input, len_in);
+ result = trn_cell_extension_parse_into(*output, input, len_in);
if (result < 0) {
- cell_extension_free(*output);
+ trn_cell_extension_free(*output);
*output = NULL;
}
return result;
diff --git a/src/trunnel/hs/cell_common.h b/src/trunnel/hs/cell_common.h
index 8999f7da40..4d98a54cf4 100644
--- a/src/trunnel/hs/cell_common.h
+++ b/src/trunnel/hs/cell_common.h
@@ -8,191 +8,196 @@
#include <stdint.h>
#include "trunnel.h"
-#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_CELL_EXTENSION_FIELDS)
-struct cell_extension_fields_st {
+#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_TRN_CELL_EXTENSION_FIELDS)
+struct trn_cell_extension_fields_st {
uint8_t field_type;
uint8_t field_len;
TRUNNEL_DYNARRAY_HEAD(, uint8_t) field;
uint8_t trunnel_error_code_;
};
#endif
-typedef struct cell_extension_fields_st cell_extension_fields_t;
-#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_CELL_EXTENSION)
-struct cell_extension_st {
+typedef struct trn_cell_extension_fields_st trn_cell_extension_fields_t;
+#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_TRN_CELL_EXTENSION)
+struct trn_cell_extension_st {
uint8_t num;
- TRUNNEL_DYNARRAY_HEAD(, struct cell_extension_fields_st *) fields;
+ TRUNNEL_DYNARRAY_HEAD(, struct trn_cell_extension_fields_st *) fields;
uint8_t trunnel_error_code_;
};
#endif
-typedef struct cell_extension_st cell_extension_t;
-/** Return a newly allocated cell_extension_fields with all elements
- * set to zero.
- */
-cell_extension_fields_t *cell_extension_fields_new(void);
-/** Release all storage held by the cell_extension_fields in 'victim'.
- * (Do nothing if 'victim' is NULL.)
- */
-void cell_extension_fields_free(cell_extension_fields_t *victim);
-/** Try to parse a cell_extension_fields from the buffer in 'input',
- * using up to 'len_in' bytes from the input buffer. On success,
- * return the number of bytes consumed and set *output to the newly
- * allocated cell_extension_fields_t. On failure, return -2 if the
- * input appears truncated, and -1 if the input is otherwise invalid.
- */
-ssize_t cell_extension_fields_parse(cell_extension_fields_t **output, const uint8_t *input, const size_t len_in);
+typedef struct trn_cell_extension_st trn_cell_extension_t;
+/** Return a newly allocated trn_cell_extension_fields with all
+ * elements set to zero.
+ */
+trn_cell_extension_fields_t *trn_cell_extension_fields_new(void);
+/** Release all storage held by the trn_cell_extension_fields in
+ * 'victim'. (Do nothing if 'victim' is NULL.)
+ */
+void trn_cell_extension_fields_free(trn_cell_extension_fields_t *victim);
+/** Try to parse a trn_cell_extension_fields from the buffer in
+ * 'input', using up to 'len_in' bytes from the input buffer. On
+ * success, return the number of bytes consumed and set *output to the
+ * newly allocated trn_cell_extension_fields_t. On failure, return -2
+ * if the input appears truncated, and -1 if the input is otherwise
+ * invalid.
+ */
+ssize_t trn_cell_extension_fields_parse(trn_cell_extension_fields_t **output, const uint8_t *input, const size_t len_in);
/** Return the number of bytes we expect to need to encode the
- * cell_extension_fields in 'obj'. On failure, return a negative
+ * trn_cell_extension_fields in 'obj'. On failure, return a negative
* value. Note that this value may be an overestimate, and can even be
* an underestimate for certain unencodeable objects.
*/
-ssize_t cell_extension_fields_encoded_len(const cell_extension_fields_t *obj);
-/** Try to encode the cell_extension_fields from 'input' into the
+ssize_t trn_cell_extension_fields_encoded_len(const trn_cell_extension_fields_t *obj);
+/** Try to encode the trn_cell_extension_fields from 'input' into the
* buffer at 'output', using up to 'avail' bytes of the output buffer.
* On success, return the number of bytes used. On failure, return -2
* if the buffer was not long enough, and -1 if the input was invalid.
*/
-ssize_t cell_extension_fields_encode(uint8_t *output, size_t avail, const cell_extension_fields_t *input);
-/** Check whether the internal state of the cell_extension_fields in
- * 'obj' is consistent. Return NULL if it is, and a short message if
- * it is not.
+ssize_t trn_cell_extension_fields_encode(uint8_t *output, size_t avail, const trn_cell_extension_fields_t *input);
+/** Check whether the internal state of the trn_cell_extension_fields
+ * in 'obj' is consistent. Return NULL if it is, and a short message
+ * if it is not.
*/
-const char *cell_extension_fields_check(const cell_extension_fields_t *obj);
+const char *trn_cell_extension_fields_check(const trn_cell_extension_fields_t *obj);
/** Clear any errors that were set on the object 'obj' by its setter
* functions. Return true iff errors were cleared.
*/
-int cell_extension_fields_clear_errors(cell_extension_fields_t *obj);
+int trn_cell_extension_fields_clear_errors(trn_cell_extension_fields_t *obj);
/** Return the value of the field_type field of the
- * cell_extension_fields_t in 'inp'
+ * trn_cell_extension_fields_t in 'inp'
*/
-uint8_t cell_extension_fields_get_field_type(const cell_extension_fields_t *inp);
+uint8_t trn_cell_extension_fields_get_field_type(const trn_cell_extension_fields_t *inp);
/** Set the value of the field_type field of the
- * cell_extension_fields_t in 'inp' to 'val'. Return 0 on success;
+ * trn_cell_extension_fields_t in 'inp' to 'val'. Return 0 on success;
* return -1 and set the error code on 'inp' on failure.
*/
-int cell_extension_fields_set_field_type(cell_extension_fields_t *inp, uint8_t val);
+int trn_cell_extension_fields_set_field_type(trn_cell_extension_fields_t *inp, uint8_t val);
/** Return the value of the field_len field of the
- * cell_extension_fields_t in 'inp'
+ * trn_cell_extension_fields_t in 'inp'
*/
-uint8_t cell_extension_fields_get_field_len(const cell_extension_fields_t *inp);
+uint8_t trn_cell_extension_fields_get_field_len(const trn_cell_extension_fields_t *inp);
/** Set the value of the field_len field of the
- * cell_extension_fields_t in 'inp' to 'val'. Return 0 on success;
+ * trn_cell_extension_fields_t in 'inp' to 'val'. Return 0 on success;
* return -1 and set the error code on 'inp' on failure.
*/
-int cell_extension_fields_set_field_len(cell_extension_fields_t *inp, uint8_t val);
+int trn_cell_extension_fields_set_field_len(trn_cell_extension_fields_t *inp, uint8_t val);
/** Return the length of the dynamic array holding the field field of
- * the cell_extension_fields_t in 'inp'.
+ * the trn_cell_extension_fields_t in 'inp'.
*/
-size_t cell_extension_fields_getlen_field(const cell_extension_fields_t *inp);
+size_t trn_cell_extension_fields_getlen_field(const trn_cell_extension_fields_t *inp);
/** Return the element at position 'idx' of the dynamic array field
- * field of the cell_extension_fields_t in 'inp'.
+ * field of the trn_cell_extension_fields_t in 'inp'.
*/
-uint8_t cell_extension_fields_get_field(cell_extension_fields_t *inp, size_t idx);
-/** As cell_extension_fields_get_field, but take and return a const
- * pointer
+uint8_t trn_cell_extension_fields_get_field(trn_cell_extension_fields_t *inp, size_t idx);
+/** As trn_cell_extension_fields_get_field, but take and return a
+ * const pointer
*/
-uint8_t cell_extension_fields_getconst_field(const cell_extension_fields_t *inp, size_t idx);
+uint8_t trn_cell_extension_fields_getconst_field(const trn_cell_extension_fields_t *inp, size_t idx);
/** Change the element at position 'idx' of the dynamic array field
- * field of the cell_extension_fields_t in 'inp', so that it will hold
- * the value 'elt'.
+ * field of the trn_cell_extension_fields_t in 'inp', so that it will
+ * hold the value 'elt'.
*/
-int cell_extension_fields_set_field(cell_extension_fields_t *inp, size_t idx, uint8_t elt);
+int trn_cell_extension_fields_set_field(trn_cell_extension_fields_t *inp, size_t idx, uint8_t elt);
/** Append a new element 'elt' to the dynamic array field field of the
- * cell_extension_fields_t in 'inp'.
+ * trn_cell_extension_fields_t in 'inp'.
*/
-int cell_extension_fields_add_field(cell_extension_fields_t *inp, uint8_t elt);
+int trn_cell_extension_fields_add_field(trn_cell_extension_fields_t *inp, uint8_t elt);
/** Return a pointer to the variable-length array field field of
* 'inp'.
*/
-uint8_t * cell_extension_fields_getarray_field(cell_extension_fields_t *inp);
-/** As cell_extension_fields_get_field, but take and return a const
- * pointer
+uint8_t * trn_cell_extension_fields_getarray_field(trn_cell_extension_fields_t *inp);
+/** As trn_cell_extension_fields_get_field, but take and return a
+ * const pointer
*/
-const uint8_t * cell_extension_fields_getconstarray_field(const cell_extension_fields_t *inp);
+const uint8_t * trn_cell_extension_fields_getconstarray_field(const trn_cell_extension_fields_t *inp);
/** Change the length of the variable-length array field field of
* 'inp' to 'newlen'.Fill extra elements with 0. Return 0 on success;
* return -1 and set the error code on 'inp' on failure.
*/
-int cell_extension_fields_setlen_field(cell_extension_fields_t *inp, size_t newlen);
-/** Return a newly allocated cell_extension with all elements set to
- * zero.
+int trn_cell_extension_fields_setlen_field(trn_cell_extension_fields_t *inp, size_t newlen);
+/** Return a newly allocated trn_cell_extension with all elements set
+ * to zero.
*/
-cell_extension_t *cell_extension_new(void);
-/** Release all storage held by the cell_extension in 'victim'. (Do
- * nothing if 'victim' is NULL.)
+trn_cell_extension_t *trn_cell_extension_new(void);
+/** Release all storage held by the trn_cell_extension in 'victim'.
+ * (Do nothing if 'victim' is NULL.)
*/
-void cell_extension_free(cell_extension_t *victim);
-/** Try to parse a cell_extension from the buffer in 'input', using up
- * to 'len_in' bytes from the input buffer. On success, return the
- * number of bytes consumed and set *output to the newly allocated
- * cell_extension_t. On failure, return -2 if the input appears
- * truncated, and -1 if the input is otherwise invalid.
+void trn_cell_extension_free(trn_cell_extension_t *victim);
+/** Try to parse a trn_cell_extension from the buffer in 'input',
+ * using up to 'len_in' bytes from the input buffer. On success,
+ * return the number of bytes consumed and set *output to the newly
+ * allocated trn_cell_extension_t. On failure, return -2 if the input
+ * appears truncated, and -1 if the input is otherwise invalid.
*/
-ssize_t cell_extension_parse(cell_extension_t **output, const uint8_t *input, const size_t len_in);
+ssize_t trn_cell_extension_parse(trn_cell_extension_t **output, const uint8_t *input, const size_t len_in);
/** Return the number of bytes we expect to need to encode the
- * cell_extension in 'obj'. On failure, return a negative value. Note
- * that this value may be an overestimate, and can even be an
+ * trn_cell_extension in 'obj'. On failure, return a negative value.
+ * Note that this value may be an overestimate, and can even be an
* underestimate for certain unencodeable objects.
*/
-ssize_t cell_extension_encoded_len(const cell_extension_t *obj);
-/** Try to encode the cell_extension from 'input' into the buffer at
- * 'output', using up to 'avail' bytes of the output buffer. On
+ssize_t trn_cell_extension_encoded_len(const trn_cell_extension_t *obj);
+/** Try to encode the trn_cell_extension from 'input' into the buffer
+ * at 'output', using up to 'avail' bytes of the output buffer. On
* success, return the number of bytes used. On failure, return -2 if
* the buffer was not long enough, and -1 if the input was invalid.
*/
-ssize_t cell_extension_encode(uint8_t *output, size_t avail, const cell_extension_t *input);
-/** Check whether the internal state of the cell_extension in 'obj' is
- * consistent. Return NULL if it is, and a short message if it is not.
+ssize_t trn_cell_extension_encode(uint8_t *output, size_t avail, const trn_cell_extension_t *input);
+/** Check whether the internal state of the trn_cell_extension in
+ * 'obj' is consistent. Return NULL if it is, and a short message if
+ * it is not.
*/
-const char *cell_extension_check(const cell_extension_t *obj);
+const char *trn_cell_extension_check(const trn_cell_extension_t *obj);
/** Clear any errors that were set on the object 'obj' by its setter
* functions. Return true iff errors were cleared.
*/
-int cell_extension_clear_errors(cell_extension_t *obj);
-/** Return the value of the num field of the cell_extension_t in 'inp'
+int trn_cell_extension_clear_errors(trn_cell_extension_t *obj);
+/** Return the value of the num field of the trn_cell_extension_t in
+ * 'inp'
*/
-uint8_t cell_extension_get_num(const cell_extension_t *inp);
-/** Set the value of the num field of the cell_extension_t in 'inp' to
- * 'val'. Return 0 on success; return -1 and set the error code on
- * 'inp' on failure.
+uint8_t trn_cell_extension_get_num(const trn_cell_extension_t *inp);
+/** Set the value of the num field of the trn_cell_extension_t in
+ * 'inp' to 'val'. Return 0 on success; return -1 and set the error
+ * code on 'inp' on failure.
*/
-int cell_extension_set_num(cell_extension_t *inp, uint8_t val);
+int trn_cell_extension_set_num(trn_cell_extension_t *inp, uint8_t val);
/** Return the length of the dynamic array holding the fields field of
- * the cell_extension_t in 'inp'.
+ * the trn_cell_extension_t in 'inp'.
*/
-size_t cell_extension_getlen_fields(const cell_extension_t *inp);
+size_t trn_cell_extension_getlen_fields(const trn_cell_extension_t *inp);
/** Return the element at position 'idx' of the dynamic array field
- * fields of the cell_extension_t in 'inp'.
+ * fields of the trn_cell_extension_t in 'inp'.
*/
-struct cell_extension_fields_st * cell_extension_get_fields(cell_extension_t *inp, size_t idx);
-/** As cell_extension_get_fields, but take and return a const pointer
+struct trn_cell_extension_fields_st * trn_cell_extension_get_fields(trn_cell_extension_t *inp, size_t idx);
+/** As trn_cell_extension_get_fields, but take and return a const
+ * pointer
*/
- const struct cell_extension_fields_st * cell_extension_getconst_fields(const cell_extension_t *inp, size_t idx);
+ const struct trn_cell_extension_fields_st * trn_cell_extension_getconst_fields(const trn_cell_extension_t *inp, size_t idx);
/** Change the element at position 'idx' of the dynamic array field
- * fields of the cell_extension_t in 'inp', so that it will hold the
- * value 'elt'. Free the previous value, if any.
+ * fields of the trn_cell_extension_t in 'inp', so that it will hold
+ * the value 'elt'. Free the previous value, if any.
*/
-int cell_extension_set_fields(cell_extension_t *inp, size_t idx, struct cell_extension_fields_st * elt);
-/** As cell_extension_set_fields, but does not free the previous
+int trn_cell_extension_set_fields(trn_cell_extension_t *inp, size_t idx, struct trn_cell_extension_fields_st * elt);
+/** As trn_cell_extension_set_fields, but does not free the previous
* value.
*/
-int cell_extension_set0_fields(cell_extension_t *inp, size_t idx, struct cell_extension_fields_st * elt);
+int trn_cell_extension_set0_fields(trn_cell_extension_t *inp, size_t idx, struct trn_cell_extension_fields_st * elt);
/** Append a new element 'elt' to the dynamic array field fields of
- * the cell_extension_t in 'inp'.
+ * the trn_cell_extension_t in 'inp'.
*/
-int cell_extension_add_fields(cell_extension_t *inp, struct cell_extension_fields_st * elt);
+int trn_cell_extension_add_fields(trn_cell_extension_t *inp, struct trn_cell_extension_fields_st * elt);
/** Return a pointer to the variable-length array field fields of
* 'inp'.
*/
-struct cell_extension_fields_st * * cell_extension_getarray_fields(cell_extension_t *inp);
-/** As cell_extension_get_fields, but take and return a const pointer
+struct trn_cell_extension_fields_st * * trn_cell_extension_getarray_fields(trn_cell_extension_t *inp);
+/** As trn_cell_extension_get_fields, but take and return a const
+ * pointer
*/
-const struct cell_extension_fields_st * const * cell_extension_getconstarray_fields(const cell_extension_t *inp);
+const struct trn_cell_extension_fields_st * const * trn_cell_extension_getconstarray_fields(const trn_cell_extension_t *inp);
/** Change the length of the variable-length array field fields of
* 'inp' to 'newlen'.Fill extra elements with NULL; free removed
* elements. Return 0 on success; return -1 and set the error code on
* 'inp' on failure.
*/
-int cell_extension_setlen_fields(cell_extension_t *inp, size_t newlen);
+int trn_cell_extension_setlen_fields(trn_cell_extension_t *inp, size_t newlen);
#endif
diff --git a/src/trunnel/hs/cell_common.trunnel b/src/trunnel/hs/cell_common.trunnel
index 1bbec5a1fe..1aa6999de7 100644
--- a/src/trunnel/hs/cell_common.trunnel
+++ b/src/trunnel/hs/cell_common.trunnel
@@ -1,12 +1,12 @@
/* This file contains common data structure that cells use. */
-struct cell_extension_fields {
+struct trn_cell_extension_fields {
u8 field_type;
u8 field_len;
u8 field[field_len];
};
-struct cell_extension {
+struct trn_cell_extension {
u8 num;
- struct cell_extension_fields fields[num];
+ struct trn_cell_extension_fields fields[num];
};
diff --git a/src/trunnel/hs/cell_establish_intro.c b/src/trunnel/hs/cell_establish_intro.c
index 633bd7c214..22e198c369 100644
--- a/src/trunnel/hs/cell_establish_intro.c
+++ b/src/trunnel/hs/cell_establish_intro.c
@@ -28,18 +28,18 @@ int cellestablishintro_deadcode_dummy__ = 0;
} \
} while (0)
-typedef struct cell_extension_st cell_extension_t;
-cell_extension_t *cell_extension_new(void);
-void cell_extension_free(cell_extension_t *victim);
-ssize_t cell_extension_parse(cell_extension_t **output, const uint8_t *input, const size_t len_in);
-ssize_t cell_extension_encoded_len(const cell_extension_t *obj);
-ssize_t cell_extension_encode(uint8_t *output, size_t avail, const cell_extension_t *input);
-const char *cell_extension_check(const cell_extension_t *obj);
-int cell_extension_clear_errors(cell_extension_t *obj);
-hs_cell_establish_intro_t *
-hs_cell_establish_intro_new(void)
-{
- hs_cell_establish_intro_t *val = trunnel_calloc(1, sizeof(hs_cell_establish_intro_t));
+typedef struct trn_cell_extension_st trn_cell_extension_t;
+trn_cell_extension_t *trn_cell_extension_new(void);
+void trn_cell_extension_free(trn_cell_extension_t *victim);
+ssize_t trn_cell_extension_parse(trn_cell_extension_t **output, const uint8_t *input, const size_t len_in);
+ssize_t trn_cell_extension_encoded_len(const trn_cell_extension_t *obj);
+ssize_t trn_cell_extension_encode(uint8_t *output, size_t avail, const trn_cell_extension_t *input);
+const char *trn_cell_extension_check(const trn_cell_extension_t *obj);
+int trn_cell_extension_clear_errors(trn_cell_extension_t *obj);
+trn_cell_establish_intro_t *
+trn_cell_establish_intro_new(void)
+{
+ trn_cell_establish_intro_t *val = trunnel_calloc(1, sizeof(trn_cell_establish_intro_t));
if (NULL == val)
return NULL;
return val;
@@ -48,39 +48,39 @@ hs_cell_establish_intro_new(void)
/** Release all storage held inside 'obj', but do not free 'obj'.
*/
static void
-hs_cell_establish_intro_clear(hs_cell_establish_intro_t *obj)
+trn_cell_establish_intro_clear(trn_cell_establish_intro_t *obj)
{
(void) obj;
TRUNNEL_DYNARRAY_WIPE(&obj->auth_key);
TRUNNEL_DYNARRAY_CLEAR(&obj->auth_key);
- cell_extension_free(obj->extensions);
+ trn_cell_extension_free(obj->extensions);
obj->extensions = NULL;
TRUNNEL_DYNARRAY_WIPE(&obj->sig);
TRUNNEL_DYNARRAY_CLEAR(&obj->sig);
}
void
-hs_cell_establish_intro_free(hs_cell_establish_intro_t *obj)
+trn_cell_establish_intro_free(trn_cell_establish_intro_t *obj)
{
if (obj == NULL)
return;
- hs_cell_establish_intro_clear(obj);
- trunnel_memwipe(obj, sizeof(hs_cell_establish_intro_t));
+ trn_cell_establish_intro_clear(obj);
+ trunnel_memwipe(obj, sizeof(trn_cell_establish_intro_t));
trunnel_free_(obj);
}
const uint8_t *
-hs_cell_establish_intro_get_start_cell(const hs_cell_establish_intro_t *inp)
+trn_cell_establish_intro_get_start_cell(const trn_cell_establish_intro_t *inp)
{
return inp->start_cell;
}
uint8_t
-hs_cell_establish_intro_get_auth_key_type(const hs_cell_establish_intro_t *inp)
+trn_cell_establish_intro_get_auth_key_type(const trn_cell_establish_intro_t *inp)
{
return inp->auth_key_type;
}
int
-hs_cell_establish_intro_set_auth_key_type(hs_cell_establish_intro_t *inp, uint8_t val)
+trn_cell_establish_intro_set_auth_key_type(trn_cell_establish_intro_t *inp, uint8_t val)
{
if (! ((val == 0 || val == 1 || val == 2))) {
TRUNNEL_SET_ERROR_CODE(inp);
@@ -90,41 +90,41 @@ hs_cell_establish_intro_set_auth_key_type(hs_cell_establish_intro_t *inp, uint8_
return 0;
}
uint16_t
-hs_cell_establish_intro_get_auth_key_len(const hs_cell_establish_intro_t *inp)
+trn_cell_establish_intro_get_auth_key_len(const trn_cell_establish_intro_t *inp)
{
return inp->auth_key_len;
}
int
-hs_cell_establish_intro_set_auth_key_len(hs_cell_establish_intro_t *inp, uint16_t val)
+trn_cell_establish_intro_set_auth_key_len(trn_cell_establish_intro_t *inp, uint16_t val)
{
inp->auth_key_len = val;
return 0;
}
size_t
-hs_cell_establish_intro_getlen_auth_key(const hs_cell_establish_intro_t *inp)
+trn_cell_establish_intro_getlen_auth_key(const trn_cell_establish_intro_t *inp)
{
return TRUNNEL_DYNARRAY_LEN(&inp->auth_key);
}
uint8_t
-hs_cell_establish_intro_get_auth_key(hs_cell_establish_intro_t *inp, size_t idx)
+trn_cell_establish_intro_get_auth_key(trn_cell_establish_intro_t *inp, size_t idx)
{
return TRUNNEL_DYNARRAY_GET(&inp->auth_key, idx);
}
uint8_t
-hs_cell_establish_intro_getconst_auth_key(const hs_cell_establish_intro_t *inp, size_t idx)
+trn_cell_establish_intro_getconst_auth_key(const trn_cell_establish_intro_t *inp, size_t idx)
{
- return hs_cell_establish_intro_get_auth_key((hs_cell_establish_intro_t*)inp, idx);
+ return trn_cell_establish_intro_get_auth_key((trn_cell_establish_intro_t*)inp, idx);
}
int
-hs_cell_establish_intro_set_auth_key(hs_cell_establish_intro_t *inp, size_t idx, uint8_t elt)
+trn_cell_establish_intro_set_auth_key(trn_cell_establish_intro_t *inp, size_t idx, uint8_t elt)
{
TRUNNEL_DYNARRAY_SET(&inp->auth_key, idx, elt);
return 0;
}
int
-hs_cell_establish_intro_add_auth_key(hs_cell_establish_intro_t *inp, uint8_t elt)
+trn_cell_establish_intro_add_auth_key(trn_cell_establish_intro_t *inp, uint8_t elt)
{
#if SIZE_MAX >= UINT16_MAX
if (inp->auth_key.n_ == UINT16_MAX)
@@ -138,17 +138,17 @@ hs_cell_establish_intro_add_auth_key(hs_cell_establish_intro_t *inp, uint8_t elt
}
uint8_t *
-hs_cell_establish_intro_getarray_auth_key(hs_cell_establish_intro_t *inp)
+trn_cell_establish_intro_getarray_auth_key(trn_cell_establish_intro_t *inp)
{
return inp->auth_key.elts_;
}
const uint8_t *
-hs_cell_establish_intro_getconstarray_auth_key(const hs_cell_establish_intro_t *inp)
+trn_cell_establish_intro_getconstarray_auth_key(const trn_cell_establish_intro_t *inp)
{
- return (const uint8_t *)hs_cell_establish_intro_getarray_auth_key((hs_cell_establish_intro_t*)inp);
+ return (const uint8_t *)trn_cell_establish_intro_getarray_auth_key((trn_cell_establish_intro_t*)inp);
}
int
-hs_cell_establish_intro_setlen_auth_key(hs_cell_establish_intro_t *inp, size_t newlen)
+trn_cell_establish_intro_setlen_auth_key(trn_cell_establish_intro_t *inp, size_t newlen)
{
uint8_t *newptr;
#if UINT16_MAX < SIZE_MAX
@@ -167,54 +167,54 @@ hs_cell_establish_intro_setlen_auth_key(hs_cell_establish_intro_t *inp, size_t n
TRUNNEL_SET_ERROR_CODE(inp);
return -1;
}
-struct cell_extension_st *
-hs_cell_establish_intro_get_extensions(hs_cell_establish_intro_t *inp)
+struct trn_cell_extension_st *
+trn_cell_establish_intro_get_extensions(trn_cell_establish_intro_t *inp)
{
return inp->extensions;
}
-const struct cell_extension_st *
-hs_cell_establish_intro_getconst_extensions(const hs_cell_establish_intro_t *inp)
+const struct trn_cell_extension_st *
+trn_cell_establish_intro_getconst_extensions(const trn_cell_establish_intro_t *inp)
{
- return hs_cell_establish_intro_get_extensions((hs_cell_establish_intro_t*) inp);
+ return trn_cell_establish_intro_get_extensions((trn_cell_establish_intro_t*) inp);
}
int
-hs_cell_establish_intro_set_extensions(hs_cell_establish_intro_t *inp, struct cell_extension_st *val)
+trn_cell_establish_intro_set_extensions(trn_cell_establish_intro_t *inp, struct trn_cell_extension_st *val)
{
if (inp->extensions && inp->extensions != val)
- cell_extension_free(inp->extensions);
- return hs_cell_establish_intro_set0_extensions(inp, val);
+ trn_cell_extension_free(inp->extensions);
+ return trn_cell_establish_intro_set0_extensions(inp, val);
}
int
-hs_cell_establish_intro_set0_extensions(hs_cell_establish_intro_t *inp, struct cell_extension_st *val)
+trn_cell_establish_intro_set0_extensions(trn_cell_establish_intro_t *inp, struct trn_cell_extension_st *val)
{
inp->extensions = val;
return 0;
}
const uint8_t *
-hs_cell_establish_intro_get_end_mac_fields(const hs_cell_establish_intro_t *inp)
+trn_cell_establish_intro_get_end_mac_fields(const trn_cell_establish_intro_t *inp)
{
return inp->end_mac_fields;
}
size_t
-hs_cell_establish_intro_getlen_handshake_mac(const hs_cell_establish_intro_t *inp)
+trn_cell_establish_intro_getlen_handshake_mac(const trn_cell_establish_intro_t *inp)
{
(void)inp; return TRUNNEL_SHA3_256_LEN;
}
uint8_t
-hs_cell_establish_intro_get_handshake_mac(hs_cell_establish_intro_t *inp, size_t idx)
+trn_cell_establish_intro_get_handshake_mac(trn_cell_establish_intro_t *inp, size_t idx)
{
trunnel_assert(idx < TRUNNEL_SHA3_256_LEN);
return inp->handshake_mac[idx];
}
uint8_t
-hs_cell_establish_intro_getconst_handshake_mac(const hs_cell_establish_intro_t *inp, size_t idx)
+trn_cell_establish_intro_getconst_handshake_mac(const trn_cell_establish_intro_t *inp, size_t idx)
{
- return hs_cell_establish_intro_get_handshake_mac((hs_cell_establish_intro_t*)inp, idx);
+ return trn_cell_establish_intro_get_handshake_mac((trn_cell_establish_intro_t*)inp, idx);
}
int
-hs_cell_establish_intro_set_handshake_mac(hs_cell_establish_intro_t *inp, size_t idx, uint8_t elt)
+trn_cell_establish_intro_set_handshake_mac(trn_cell_establish_intro_t *inp, size_t idx, uint8_t elt)
{
trunnel_assert(idx < TRUNNEL_SHA3_256_LEN);
inp->handshake_mac[idx] = elt;
@@ -222,56 +222,56 @@ hs_cell_establish_intro_set_handshake_mac(hs_cell_establish_intro_t *inp, size_t
}
uint8_t *
-hs_cell_establish_intro_getarray_handshake_mac(hs_cell_establish_intro_t *inp)
+trn_cell_establish_intro_getarray_handshake_mac(trn_cell_establish_intro_t *inp)
{
return inp->handshake_mac;
}
const uint8_t *
-hs_cell_establish_intro_getconstarray_handshake_mac(const hs_cell_establish_intro_t *inp)
+trn_cell_establish_intro_getconstarray_handshake_mac(const trn_cell_establish_intro_t *inp)
{
- return (const uint8_t *)hs_cell_establish_intro_getarray_handshake_mac((hs_cell_establish_intro_t*)inp);
+ return (const uint8_t *)trn_cell_establish_intro_getarray_handshake_mac((trn_cell_establish_intro_t*)inp);
}
const uint8_t *
-hs_cell_establish_intro_get_end_sig_fields(const hs_cell_establish_intro_t *inp)
+trn_cell_establish_intro_get_end_sig_fields(const trn_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)
+trn_cell_establish_intro_get_sig_len(const trn_cell_establish_intro_t *inp)
{
return inp->sig_len;
}
int
-hs_cell_establish_intro_set_sig_len(hs_cell_establish_intro_t *inp, uint16_t val)
+trn_cell_establish_intro_set_sig_len(trn_cell_establish_intro_t *inp, uint16_t val)
{
inp->sig_len = val;
return 0;
}
size_t
-hs_cell_establish_intro_getlen_sig(const hs_cell_establish_intro_t *inp)
+trn_cell_establish_intro_getlen_sig(const trn_cell_establish_intro_t *inp)
{
return TRUNNEL_DYNARRAY_LEN(&inp->sig);
}
uint8_t
-hs_cell_establish_intro_get_sig(hs_cell_establish_intro_t *inp, size_t idx)
+trn_cell_establish_intro_get_sig(trn_cell_establish_intro_t *inp, size_t idx)
{
return TRUNNEL_DYNARRAY_GET(&inp->sig, idx);
}
uint8_t
-hs_cell_establish_intro_getconst_sig(const hs_cell_establish_intro_t *inp, size_t idx)
+trn_cell_establish_intro_getconst_sig(const trn_cell_establish_intro_t *inp, size_t idx)
{
- return hs_cell_establish_intro_get_sig((hs_cell_establish_intro_t*)inp, idx);
+ return trn_cell_establish_intro_get_sig((trn_cell_establish_intro_t*)inp, idx);
}
int
-hs_cell_establish_intro_set_sig(hs_cell_establish_intro_t *inp, size_t idx, uint8_t elt)
+trn_cell_establish_intro_set_sig(trn_cell_establish_intro_t *inp, size_t idx, uint8_t elt)
{
TRUNNEL_DYNARRAY_SET(&inp->sig, idx, elt);
return 0;
}
int
-hs_cell_establish_intro_add_sig(hs_cell_establish_intro_t *inp, uint8_t elt)
+trn_cell_establish_intro_add_sig(trn_cell_establish_intro_t *inp, uint8_t elt)
{
#if SIZE_MAX >= UINT16_MAX
if (inp->sig.n_ == UINT16_MAX)
@@ -285,17 +285,17 @@ hs_cell_establish_intro_add_sig(hs_cell_establish_intro_t *inp, uint8_t elt)
}
uint8_t *
-hs_cell_establish_intro_getarray_sig(hs_cell_establish_intro_t *inp)
+trn_cell_establish_intro_getarray_sig(trn_cell_establish_intro_t *inp)
{
return inp->sig.elts_;
}
const uint8_t *
-hs_cell_establish_intro_getconstarray_sig(const hs_cell_establish_intro_t *inp)
+trn_cell_establish_intro_getconstarray_sig(const trn_cell_establish_intro_t *inp)
{
- return (const uint8_t *)hs_cell_establish_intro_getarray_sig((hs_cell_establish_intro_t*)inp);
+ return (const uint8_t *)trn_cell_establish_intro_getarray_sig((trn_cell_establish_intro_t*)inp);
}
int
-hs_cell_establish_intro_setlen_sig(hs_cell_establish_intro_t *inp, size_t newlen)
+trn_cell_establish_intro_setlen_sig(trn_cell_establish_intro_t *inp, size_t newlen)
{
uint8_t *newptr;
#if UINT16_MAX < SIZE_MAX
@@ -315,7 +315,7 @@ hs_cell_establish_intro_setlen_sig(hs_cell_establish_intro_t *inp, size_t newlen
return -1;
}
const char *
-hs_cell_establish_intro_check(const hs_cell_establish_intro_t *obj)
+trn_cell_establish_intro_check(const trn_cell_establish_intro_t *obj)
{
if (obj == NULL)
return "Object was NULL";
@@ -327,7 +327,7 @@ hs_cell_establish_intro_check(const hs_cell_establish_intro_t *obj)
return "Length mismatch for auth_key";
{
const char *msg;
- if (NULL != (msg = cell_extension_check(obj->extensions)))
+ if (NULL != (msg = trn_cell_extension_check(obj->extensions)))
return msg;
}
if (TRUNNEL_DYNARRAY_LEN(&obj->sig) != obj->sig_len)
@@ -336,11 +336,11 @@ hs_cell_establish_intro_check(const hs_cell_establish_intro_t *obj)
}
ssize_t
-hs_cell_establish_intro_encoded_len(const hs_cell_establish_intro_t *obj)
+trn_cell_establish_intro_encoded_len(const trn_cell_establish_intro_t *obj)
{
ssize_t result = 0;
- if (NULL != hs_cell_establish_intro_check(obj))
+ if (NULL != trn_cell_establish_intro_check(obj))
return -1;
@@ -353,8 +353,8 @@ hs_cell_establish_intro_encoded_len(const hs_cell_establish_intro_t *obj)
/* Length of u8 auth_key[auth_key_len] */
result += TRUNNEL_DYNARRAY_LEN(&obj->auth_key);
- /* Length of struct cell_extension extensions */
- result += cell_extension_encoded_len(obj->extensions);
+ /* Length of struct trn_cell_extension extensions */
+ result += trn_cell_extension_encoded_len(obj->extensions);
/* Length of u8 handshake_mac[TRUNNEL_SHA3_256_LEN] */
result += TRUNNEL_SHA3_256_LEN;
@@ -367,24 +367,24 @@ hs_cell_establish_intro_encoded_len(const hs_cell_establish_intro_t *obj)
return result;
}
int
-hs_cell_establish_intro_clear_errors(hs_cell_establish_intro_t *obj)
+trn_cell_establish_intro_clear_errors(trn_cell_establish_intro_t *obj)
{
int r = obj->trunnel_error_code_;
obj->trunnel_error_code_ = 0;
return r;
}
ssize_t
-hs_cell_establish_intro_encode(uint8_t *output, const size_t avail, const hs_cell_establish_intro_t *obj)
+trn_cell_establish_intro_encode(uint8_t *output, const size_t avail, const trn_cell_establish_intro_t *obj)
{
ssize_t result = 0;
size_t written = 0;
uint8_t *ptr = output;
const char *msg;
#ifdef TRUNNEL_CHECK_ENCODED_LEN
- const ssize_t encoded_len = hs_cell_establish_intro_encoded_len(obj);
+ const ssize_t encoded_len = trn_cell_establish_intro_encoded_len(obj);
#endif
- if (NULL != (msg = hs_cell_establish_intro_check(obj)))
+ if (NULL != (msg = trn_cell_establish_intro_check(obj)))
goto check_failed;
#ifdef TRUNNEL_CHECK_ENCODED_LEN
@@ -417,9 +417,9 @@ hs_cell_establish_intro_encode(uint8_t *output, const size_t avail, const hs_cel
written += elt_len; ptr += elt_len;
}
- /* Encode struct cell_extension extensions */
+ /* Encode struct trn_cell_extension extensions */
trunnel_assert(written <= avail);
- result = cell_extension_encode(ptr, avail - written, obj->extensions);
+ result = trn_cell_extension_encode(ptr, avail - written, obj->extensions);
if (result < 0)
goto fail; /* XXXXXXX !*/
written += result; ptr += result;
@@ -474,11 +474,11 @@ hs_cell_establish_intro_encode(uint8_t *output, const size_t avail, const hs_cel
return result;
}
-/** As hs_cell_establish_intro_parse(), but do not allocate the output
- * object.
+/** As trn_cell_establish_intro_parse(), but do not allocate the
+ * output object.
*/
static ssize_t
-hs_cell_establish_intro_parse_into(hs_cell_establish_intro_t *obj, const uint8_t *input, const size_t len_in)
+trn_cell_establish_intro_parse_into(trn_cell_establish_intro_t *obj, const uint8_t *input, const size_t len_in)
{
const uint8_t *ptr = input;
size_t remaining = len_in;
@@ -506,8 +506,8 @@ hs_cell_establish_intro_parse_into(hs_cell_establish_intro_t *obj, const uint8_t
memcpy(obj->auth_key.elts_, ptr, obj->auth_key_len);
ptr += obj->auth_key_len; remaining -= obj->auth_key_len;
- /* Parse struct cell_extension extensions */
- result = cell_extension_parse(&obj->extensions, ptr, remaining);
+ /* Parse struct trn_cell_extension extensions */
+ result = trn_cell_extension_parse(&obj->extensions, ptr, remaining);
if (result < 0)
goto relay_fail;
trunnel_assert((size_t)result <= remaining);
@@ -548,23 +548,23 @@ hs_cell_establish_intro_parse_into(hs_cell_establish_intro_t *obj, const uint8_t
}
ssize_t
-hs_cell_establish_intro_parse(hs_cell_establish_intro_t **output, const uint8_t *input, const size_t len_in)
+trn_cell_establish_intro_parse(trn_cell_establish_intro_t **output, const uint8_t *input, const size_t len_in)
{
ssize_t result;
- *output = hs_cell_establish_intro_new();
+ *output = trn_cell_establish_intro_new();
if (NULL == *output)
return -1;
- result = hs_cell_establish_intro_parse_into(*output, input, len_in);
+ result = trn_cell_establish_intro_parse_into(*output, input, len_in);
if (result < 0) {
- hs_cell_establish_intro_free(*output);
+ trn_cell_establish_intro_free(*output);
*output = NULL;
}
return result;
}
-hs_cell_intro_established_t *
-hs_cell_intro_established_new(void)
+trn_cell_intro_established_t *
+trn_cell_intro_established_new(void)
{
- hs_cell_intro_established_t *val = trunnel_calloc(1, sizeof(hs_cell_intro_established_t));
+ trn_cell_intro_established_t *val = trunnel_calloc(1, sizeof(trn_cell_intro_established_t));
if (NULL == val)
return NULL;
return val;
@@ -573,48 +573,48 @@ hs_cell_intro_established_new(void)
/** Release all storage held inside 'obj', but do not free 'obj'.
*/
static void
-hs_cell_intro_established_clear(hs_cell_intro_established_t *obj)
+trn_cell_intro_established_clear(trn_cell_intro_established_t *obj)
{
(void) obj;
- cell_extension_free(obj->extensions);
+ trn_cell_extension_free(obj->extensions);
obj->extensions = NULL;
}
void
-hs_cell_intro_established_free(hs_cell_intro_established_t *obj)
+trn_cell_intro_established_free(trn_cell_intro_established_t *obj)
{
if (obj == NULL)
return;
- hs_cell_intro_established_clear(obj);
- trunnel_memwipe(obj, sizeof(hs_cell_intro_established_t));
+ trn_cell_intro_established_clear(obj);
+ trunnel_memwipe(obj, sizeof(trn_cell_intro_established_t));
trunnel_free_(obj);
}
-struct cell_extension_st *
-hs_cell_intro_established_get_extensions(hs_cell_intro_established_t *inp)
+struct trn_cell_extension_st *
+trn_cell_intro_established_get_extensions(trn_cell_intro_established_t *inp)
{
return inp->extensions;
}
-const struct cell_extension_st *
-hs_cell_intro_established_getconst_extensions(const hs_cell_intro_established_t *inp)
+const struct trn_cell_extension_st *
+trn_cell_intro_established_getconst_extensions(const trn_cell_intro_established_t *inp)
{
- return hs_cell_intro_established_get_extensions((hs_cell_intro_established_t*) inp);
+ return trn_cell_intro_established_get_extensions((trn_cell_intro_established_t*) inp);
}
int
-hs_cell_intro_established_set_extensions(hs_cell_intro_established_t *inp, struct cell_extension_st *val)
+trn_cell_intro_established_set_extensions(trn_cell_intro_established_t *inp, struct trn_cell_extension_st *val)
{
if (inp->extensions && inp->extensions != val)
- cell_extension_free(inp->extensions);
- return hs_cell_intro_established_set0_extensions(inp, val);
+ trn_cell_extension_free(inp->extensions);
+ return trn_cell_intro_established_set0_extensions(inp, val);
}
int
-hs_cell_intro_established_set0_extensions(hs_cell_intro_established_t *inp, struct cell_extension_st *val)
+trn_cell_intro_established_set0_extensions(trn_cell_intro_established_t *inp, struct trn_cell_extension_st *val)
{
inp->extensions = val;
return 0;
}
const char *
-hs_cell_intro_established_check(const hs_cell_intro_established_t *obj)
+trn_cell_intro_established_check(const trn_cell_intro_established_t *obj)
{
if (obj == NULL)
return "Object was NULL";
@@ -622,53 +622,53 @@ hs_cell_intro_established_check(const hs_cell_intro_established_t *obj)
return "A set function failed on this object";
{
const char *msg;
- if (NULL != (msg = cell_extension_check(obj->extensions)))
+ if (NULL != (msg = trn_cell_extension_check(obj->extensions)))
return msg;
}
return NULL;
}
ssize_t
-hs_cell_intro_established_encoded_len(const hs_cell_intro_established_t *obj)
+trn_cell_intro_established_encoded_len(const trn_cell_intro_established_t *obj)
{
ssize_t result = 0;
- if (NULL != hs_cell_intro_established_check(obj))
+ if (NULL != trn_cell_intro_established_check(obj))
return -1;
- /* Length of struct cell_extension extensions */
- result += cell_extension_encoded_len(obj->extensions);
+ /* Length of struct trn_cell_extension extensions */
+ result += trn_cell_extension_encoded_len(obj->extensions);
return result;
}
int
-hs_cell_intro_established_clear_errors(hs_cell_intro_established_t *obj)
+trn_cell_intro_established_clear_errors(trn_cell_intro_established_t *obj)
{
int r = obj->trunnel_error_code_;
obj->trunnel_error_code_ = 0;
return r;
}
ssize_t
-hs_cell_intro_established_encode(uint8_t *output, const size_t avail, const hs_cell_intro_established_t *obj)
+trn_cell_intro_established_encode(uint8_t *output, const size_t avail, const trn_cell_intro_established_t *obj)
{
ssize_t result = 0;
size_t written = 0;
uint8_t *ptr = output;
const char *msg;
#ifdef TRUNNEL_CHECK_ENCODED_LEN
- const ssize_t encoded_len = hs_cell_intro_established_encoded_len(obj);
+ const ssize_t encoded_len = trn_cell_intro_established_encoded_len(obj);
#endif
- if (NULL != (msg = hs_cell_intro_established_check(obj)))
+ if (NULL != (msg = trn_cell_intro_established_check(obj)))
goto check_failed;
#ifdef TRUNNEL_CHECK_ENCODED_LEN
trunnel_assert(encoded_len >= 0);
#endif
- /* Encode struct cell_extension extensions */
+ /* Encode struct trn_cell_extension extensions */
trunnel_assert(written <= avail);
- result = cell_extension_encode(ptr, avail - written, obj->extensions);
+ result = trn_cell_extension_encode(ptr, avail - written, obj->extensions);
if (result < 0)
goto fail; /* XXXXXXX !*/
written += result; ptr += result;
@@ -694,19 +694,19 @@ hs_cell_intro_established_encode(uint8_t *output, const size_t avail, const hs_c
return result;
}
-/** As hs_cell_intro_established_parse(), but do not allocate the
+/** As trn_cell_intro_established_parse(), but do not allocate the
* output object.
*/
static ssize_t
-hs_cell_intro_established_parse_into(hs_cell_intro_established_t *obj, const uint8_t *input, const size_t len_in)
+trn_cell_intro_established_parse_into(trn_cell_intro_established_t *obj, const uint8_t *input, const size_t len_in)
{
const uint8_t *ptr = input;
size_t remaining = len_in;
ssize_t result = 0;
(void)result;
- /* Parse struct cell_extension extensions */
- result = cell_extension_parse(&obj->extensions, ptr, remaining);
+ /* Parse struct trn_cell_extension extensions */
+ result = trn_cell_extension_parse(&obj->extensions, ptr, remaining);
if (result < 0)
goto relay_fail;
trunnel_assert((size_t)result <= remaining);
@@ -720,15 +720,15 @@ hs_cell_intro_established_parse_into(hs_cell_intro_established_t *obj, const uin
}
ssize_t
-hs_cell_intro_established_parse(hs_cell_intro_established_t **output, const uint8_t *input, const size_t len_in)
+trn_cell_intro_established_parse(trn_cell_intro_established_t **output, const uint8_t *input, const size_t len_in)
{
ssize_t result;
- *output = hs_cell_intro_established_new();
+ *output = trn_cell_intro_established_new();
if (NULL == *output)
return -1;
- result = hs_cell_intro_established_parse_into(*output, input, len_in);
+ result = trn_cell_intro_established_parse_into(*output, input, len_in);
if (result < 0) {
- hs_cell_intro_established_free(*output);
+ trn_cell_intro_established_free(*output);
*output = NULL;
}
return result;
diff --git a/src/trunnel/hs/cell_establish_intro.h b/src/trunnel/hs/cell_establish_intro.h
index 725d47cd85..2f0d893659 100644
--- a/src/trunnel/hs/cell_establish_intro.h
+++ b/src/trunnel/hs/cell_establish_intro.h
@@ -8,15 +8,15 @@
#include <stdint.h>
#include "trunnel.h"
-struct cell_extension_st;
+struct trn_cell_extension_st;
#define TRUNNEL_SHA3_256_LEN 32
-#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_HS_CELL_ESTABLISH_INTRO)
-struct hs_cell_establish_intro_st {
+#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_TRN_CELL_ESTABLISH_INTRO)
+struct trn_cell_establish_intro_st {
const uint8_t *start_cell;
uint8_t auth_key_type;
uint16_t auth_key_len;
TRUNNEL_DYNARRAY_HEAD(, uint8_t) auth_key;
- struct cell_extension_st *extensions;
+ struct trn_cell_extension_st *extensions;
const uint8_t *end_mac_fields;
uint8_t handshake_mac[TRUNNEL_SHA3_256_LEN];
const uint8_t *end_sig_fields;
@@ -25,251 +25,252 @@ struct hs_cell_establish_intro_st {
uint8_t trunnel_error_code_;
};
#endif
-typedef struct hs_cell_establish_intro_st hs_cell_establish_intro_t;
-#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_HS_CELL_INTRO_ESTABLISHED)
-struct hs_cell_intro_established_st {
- struct cell_extension_st *extensions;
+typedef struct trn_cell_establish_intro_st trn_cell_establish_intro_t;
+#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_TRN_CELL_INTRO_ESTABLISHED)
+struct trn_cell_intro_established_st {
+ struct trn_cell_extension_st *extensions;
uint8_t trunnel_error_code_;
};
#endif
-typedef struct hs_cell_intro_established_st hs_cell_intro_established_t;
-/** Return a newly allocated hs_cell_establish_intro with all elements
- * set to zero.
+typedef struct trn_cell_intro_established_st trn_cell_intro_established_t;
+/** Return a newly allocated trn_cell_establish_intro with all
+ * elements set to zero.
*/
-hs_cell_establish_intro_t *hs_cell_establish_intro_new(void);
-/** Release all storage held by the hs_cell_establish_intro in
+trn_cell_establish_intro_t *trn_cell_establish_intro_new(void);
+/** Release all storage held by the trn_cell_establish_intro in
* 'victim'. (Do nothing if 'victim' is NULL.)
*/
-void hs_cell_establish_intro_free(hs_cell_establish_intro_t *victim);
-/** Try to parse a hs_cell_establish_intro from the buffer in 'input',
- * using up to 'len_in' bytes from the input buffer. On success,
- * return the number of bytes consumed and set *output to the newly
- * allocated hs_cell_establish_intro_t. On failure, return -2 if the
- * input appears truncated, and -1 if the input is otherwise invalid.
+void trn_cell_establish_intro_free(trn_cell_establish_intro_t *victim);
+/** Try to parse a trn_cell_establish_intro from the buffer in
+ * 'input', using up to 'len_in' bytes from the input buffer. On
+ * success, return the number of bytes consumed and set *output to the
+ * newly allocated trn_cell_establish_intro_t. On failure, return -2
+ * if the input appears truncated, and -1 if the input is otherwise
+ * invalid.
*/
-ssize_t hs_cell_establish_intro_parse(hs_cell_establish_intro_t **output, const uint8_t *input, const size_t len_in);
+ssize_t trn_cell_establish_intro_parse(trn_cell_establish_intro_t **output, const uint8_t *input, const size_t len_in);
/** Return the number of bytes we expect to need to encode the
- * hs_cell_establish_intro in 'obj'. On failure, return a negative
+ * trn_cell_establish_intro in 'obj'. On failure, return a negative
* value. Note that this value may be an overestimate, and can even be
* an underestimate for certain unencodeable objects.
*/
-ssize_t hs_cell_establish_intro_encoded_len(const hs_cell_establish_intro_t *obj);
-/** Try to encode the hs_cell_establish_intro from 'input' into the
+ssize_t trn_cell_establish_intro_encoded_len(const trn_cell_establish_intro_t *obj);
+/** Try to encode the trn_cell_establish_intro from 'input' into the
* buffer at 'output', using up to 'avail' bytes of the output buffer.
* On success, return the number of bytes used. On failure, return -2
* if the buffer was not long enough, and -1 if the input was invalid.
*/
-ssize_t hs_cell_establish_intro_encode(uint8_t *output, size_t avail, const hs_cell_establish_intro_t *input);
-/** Check whether the internal state of the hs_cell_establish_intro in
- * 'obj' is consistent. Return NULL if it is, and a short message if
- * it is not.
+ssize_t trn_cell_establish_intro_encode(uint8_t *output, size_t avail, const trn_cell_establish_intro_t *input);
+/** Check whether the internal state of the trn_cell_establish_intro
+ * in 'obj' is consistent. Return NULL if it is, and a short message
+ * if it is not.
*/
-const char *hs_cell_establish_intro_check(const hs_cell_establish_intro_t *obj);
+const char *trn_cell_establish_intro_check(const trn_cell_establish_intro_t *obj);
/** Clear any errors that were set on the object 'obj' by its setter
* functions. Return true iff errors were cleared.
*/
-int hs_cell_establish_intro_clear_errors(hs_cell_establish_intro_t *obj);
+int trn_cell_establish_intro_clear_errors(trn_cell_establish_intro_t *obj);
/** Return the position for start_cell when we parsed this object
*/
-const uint8_t * hs_cell_establish_intro_get_start_cell(const hs_cell_establish_intro_t *inp);
+const uint8_t * trn_cell_establish_intro_get_start_cell(const trn_cell_establish_intro_t *inp);
/** Return the value of the auth_key_type field of the
- * hs_cell_establish_intro_t in 'inp'
+ * trn_cell_establish_intro_t in 'inp'
*/
-uint8_t hs_cell_establish_intro_get_auth_key_type(const hs_cell_establish_intro_t *inp);
+uint8_t trn_cell_establish_intro_get_auth_key_type(const trn_cell_establish_intro_t *inp);
/** Set the value of the auth_key_type field of the
- * hs_cell_establish_intro_t in 'inp' to 'val'. Return 0 on success;
+ * trn_cell_establish_intro_t in 'inp' to 'val'. Return 0 on success;
* return -1 and set the error code on 'inp' on failure.
*/
-int hs_cell_establish_intro_set_auth_key_type(hs_cell_establish_intro_t *inp, uint8_t val);
+int trn_cell_establish_intro_set_auth_key_type(trn_cell_establish_intro_t *inp, uint8_t val);
/** Return the value of the auth_key_len field of the
- * hs_cell_establish_intro_t in 'inp'
+ * trn_cell_establish_intro_t in 'inp'
*/
-uint16_t hs_cell_establish_intro_get_auth_key_len(const hs_cell_establish_intro_t *inp);
+uint16_t trn_cell_establish_intro_get_auth_key_len(const trn_cell_establish_intro_t *inp);
/** Set the value of the auth_key_len field of the
- * hs_cell_establish_intro_t in 'inp' to 'val'. Return 0 on success;
+ * trn_cell_establish_intro_t in 'inp' to 'val'. Return 0 on success;
* return -1 and set the error code on 'inp' on failure.
*/
-int hs_cell_establish_intro_set_auth_key_len(hs_cell_establish_intro_t *inp, uint16_t val);
+int trn_cell_establish_intro_set_auth_key_len(trn_cell_establish_intro_t *inp, uint16_t val);
/** Return the length of the dynamic array holding the auth_key field
- * of the hs_cell_establish_intro_t in 'inp'.
+ * of the trn_cell_establish_intro_t in 'inp'.
*/
-size_t hs_cell_establish_intro_getlen_auth_key(const hs_cell_establish_intro_t *inp);
+size_t trn_cell_establish_intro_getlen_auth_key(const trn_cell_establish_intro_t *inp);
/** Return the element at position 'idx' of the dynamic array field
- * auth_key of the hs_cell_establish_intro_t in 'inp'.
+ * auth_key of the trn_cell_establish_intro_t in 'inp'.
*/
-uint8_t hs_cell_establish_intro_get_auth_key(hs_cell_establish_intro_t *inp, size_t idx);
-/** As hs_cell_establish_intro_get_auth_key, but take and return a
+uint8_t trn_cell_establish_intro_get_auth_key(trn_cell_establish_intro_t *inp, size_t idx);
+/** As trn_cell_establish_intro_get_auth_key, but take and return a
* const pointer
*/
-uint8_t hs_cell_establish_intro_getconst_auth_key(const hs_cell_establish_intro_t *inp, size_t idx);
+uint8_t trn_cell_establish_intro_getconst_auth_key(const trn_cell_establish_intro_t *inp, size_t idx);
/** Change the element at position 'idx' of the dynamic array field
- * auth_key of the hs_cell_establish_intro_t in 'inp', so that it will
- * hold the value 'elt'.
+ * auth_key of the trn_cell_establish_intro_t in 'inp', so that it
+ * will hold the value 'elt'.
*/
-int hs_cell_establish_intro_set_auth_key(hs_cell_establish_intro_t *inp, size_t idx, uint8_t elt);
+int trn_cell_establish_intro_set_auth_key(trn_cell_establish_intro_t *inp, size_t idx, uint8_t elt);
/** Append a new element 'elt' to the dynamic array field auth_key of
- * the hs_cell_establish_intro_t in 'inp'.
+ * the trn_cell_establish_intro_t in 'inp'.
*/
-int hs_cell_establish_intro_add_auth_key(hs_cell_establish_intro_t *inp, uint8_t elt);
+int trn_cell_establish_intro_add_auth_key(trn_cell_establish_intro_t *inp, uint8_t elt);
/** Return a pointer to the variable-length array field auth_key of
* 'inp'.
*/
-uint8_t * hs_cell_establish_intro_getarray_auth_key(hs_cell_establish_intro_t *inp);
-/** As hs_cell_establish_intro_get_auth_key, but take and return a
+uint8_t * trn_cell_establish_intro_getarray_auth_key(trn_cell_establish_intro_t *inp);
+/** As trn_cell_establish_intro_get_auth_key, but take and return a
* const pointer
*/
-const uint8_t * hs_cell_establish_intro_getconstarray_auth_key(const hs_cell_establish_intro_t *inp);
+const uint8_t * trn_cell_establish_intro_getconstarray_auth_key(const trn_cell_establish_intro_t *inp);
/** Change the length of the variable-length array field auth_key of
* 'inp' to 'newlen'.Fill extra elements with 0. Return 0 on success;
* return -1 and set the error code on 'inp' on failure.
*/
-int hs_cell_establish_intro_setlen_auth_key(hs_cell_establish_intro_t *inp, size_t newlen);
+int trn_cell_establish_intro_setlen_auth_key(trn_cell_establish_intro_t *inp, size_t newlen);
/** Return the value of the extensions field of the
- * hs_cell_establish_intro_t in 'inp'
+ * trn_cell_establish_intro_t in 'inp'
*/
-struct cell_extension_st * hs_cell_establish_intro_get_extensions(hs_cell_establish_intro_t *inp);
-/** As hs_cell_establish_intro_get_extensions, but take and return a
+struct trn_cell_extension_st * trn_cell_establish_intro_get_extensions(trn_cell_establish_intro_t *inp);
+/** As trn_cell_establish_intro_get_extensions, but take and return a
* const pointer
*/
-const struct cell_extension_st * hs_cell_establish_intro_getconst_extensions(const hs_cell_establish_intro_t *inp);
+const struct trn_cell_extension_st * trn_cell_establish_intro_getconst_extensions(const trn_cell_establish_intro_t *inp);
/** Set the value of the extensions field of the
- * hs_cell_establish_intro_t in 'inp' to 'val'. Free the old value if
+ * trn_cell_establish_intro_t in 'inp' to 'val'. Free the old value if
* any. Steals the referenceto 'val'.Return 0 on success; return -1
* and set the error code on 'inp' on failure.
*/
-int hs_cell_establish_intro_set_extensions(hs_cell_establish_intro_t *inp, struct cell_extension_st *val);
-/** As hs_cell_establish_intro_set_extensions, but does not free the
+int trn_cell_establish_intro_set_extensions(trn_cell_establish_intro_t *inp, struct trn_cell_extension_st *val);
+/** As trn_cell_establish_intro_set_extensions, but does not free the
* previous value.
*/
-int hs_cell_establish_intro_set0_extensions(hs_cell_establish_intro_t *inp, struct cell_extension_st *val);
+int trn_cell_establish_intro_set0_extensions(trn_cell_establish_intro_t *inp, struct trn_cell_extension_st *val);
/** Return the position for end_mac_fields when we parsed this object
*/
-const uint8_t * hs_cell_establish_intro_get_end_mac_fields(const hs_cell_establish_intro_t *inp);
+const uint8_t * trn_cell_establish_intro_get_end_mac_fields(const trn_cell_establish_intro_t *inp);
/** Return the (constant) length of the array holding the
- * handshake_mac field of the hs_cell_establish_intro_t in 'inp'.
+ * handshake_mac field of the trn_cell_establish_intro_t in 'inp'.
*/
-size_t hs_cell_establish_intro_getlen_handshake_mac(const hs_cell_establish_intro_t *inp);
+size_t trn_cell_establish_intro_getlen_handshake_mac(const trn_cell_establish_intro_t *inp);
/** Return the element at position 'idx' of the fixed array field
- * handshake_mac of the hs_cell_establish_intro_t in 'inp'.
+ * handshake_mac of the trn_cell_establish_intro_t in 'inp'.
*/
-uint8_t hs_cell_establish_intro_get_handshake_mac(hs_cell_establish_intro_t *inp, size_t idx);
-/** As hs_cell_establish_intro_get_handshake_mac, but take and return
+uint8_t trn_cell_establish_intro_get_handshake_mac(trn_cell_establish_intro_t *inp, size_t idx);
+/** As trn_cell_establish_intro_get_handshake_mac, but take and return
* a const pointer
*/
-uint8_t hs_cell_establish_intro_getconst_handshake_mac(const hs_cell_establish_intro_t *inp, size_t idx);
+uint8_t trn_cell_establish_intro_getconst_handshake_mac(const trn_cell_establish_intro_t *inp, size_t idx);
/** Change the element at position 'idx' of the fixed array field
- * handshake_mac of the hs_cell_establish_intro_t in 'inp', so that it
- * will hold the value 'elt'.
+ * handshake_mac of the trn_cell_establish_intro_t in 'inp', so that
+ * it will hold the value 'elt'.
*/
-int hs_cell_establish_intro_set_handshake_mac(hs_cell_establish_intro_t *inp, size_t idx, uint8_t elt);
+int trn_cell_establish_intro_set_handshake_mac(trn_cell_establish_intro_t *inp, size_t idx, uint8_t elt);
/** Return a pointer to the TRUNNEL_SHA3_256_LEN-element array field
* handshake_mac of 'inp'.
*/
-uint8_t * hs_cell_establish_intro_getarray_handshake_mac(hs_cell_establish_intro_t *inp);
-/** As hs_cell_establish_intro_get_handshake_mac, but take and return
+uint8_t * trn_cell_establish_intro_getarray_handshake_mac(trn_cell_establish_intro_t *inp);
+/** As trn_cell_establish_intro_get_handshake_mac, but take and return
* a const pointer
*/
-const uint8_t * hs_cell_establish_intro_getconstarray_handshake_mac(const hs_cell_establish_intro_t *inp);
+const uint8_t * trn_cell_establish_intro_getconstarray_handshake_mac(const trn_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);
+const uint8_t * trn_cell_establish_intro_get_end_sig_fields(const trn_cell_establish_intro_t *inp);
/** Return the value of the sig_len field of the
- * hs_cell_establish_intro_t in 'inp'
+ * trn_cell_establish_intro_t in 'inp'
*/
-uint16_t hs_cell_establish_intro_get_sig_len(const hs_cell_establish_intro_t *inp);
+uint16_t trn_cell_establish_intro_get_sig_len(const trn_cell_establish_intro_t *inp);
/** Set the value of the sig_len field of the
- * hs_cell_establish_intro_t in 'inp' to 'val'. Return 0 on success;
+ * trn_cell_establish_intro_t in 'inp' to 'val'. Return 0 on success;
* 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);
+int trn_cell_establish_intro_set_sig_len(trn_cell_establish_intro_t *inp, uint16_t val);
/** Return the length of the dynamic array holding the sig field of
- * the hs_cell_establish_intro_t in 'inp'.
+ * the trn_cell_establish_intro_t in 'inp'.
*/
-size_t hs_cell_establish_intro_getlen_sig(const hs_cell_establish_intro_t *inp);
+size_t trn_cell_establish_intro_getlen_sig(const trn_cell_establish_intro_t *inp);
/** Return the element at position 'idx' of the dynamic array field
- * sig of the hs_cell_establish_intro_t in 'inp'.
+ * sig of the trn_cell_establish_intro_t in 'inp'.
*/
-uint8_t hs_cell_establish_intro_get_sig(hs_cell_establish_intro_t *inp, size_t idx);
-/** As hs_cell_establish_intro_get_sig, but take and return a const
+uint8_t trn_cell_establish_intro_get_sig(trn_cell_establish_intro_t *inp, size_t idx);
+/** As trn_cell_establish_intro_get_sig, but take and return a const
* pointer
*/
-uint8_t hs_cell_establish_intro_getconst_sig(const hs_cell_establish_intro_t *inp, size_t idx);
+uint8_t trn_cell_establish_intro_getconst_sig(const trn_cell_establish_intro_t *inp, size_t idx);
/** Change the element at position 'idx' of the dynamic array field
- * sig of the hs_cell_establish_intro_t in 'inp', so that it will hold
- * the value 'elt'.
+ * sig of the trn_cell_establish_intro_t in 'inp', so that it will
+ * hold the value 'elt'.
*/
-int hs_cell_establish_intro_set_sig(hs_cell_establish_intro_t *inp, size_t idx, uint8_t elt);
+int trn_cell_establish_intro_set_sig(trn_cell_establish_intro_t *inp, size_t idx, uint8_t elt);
/** Append a new element 'elt' to the dynamic array field sig of the
- * hs_cell_establish_intro_t in 'inp'.
+ * trn_cell_establish_intro_t in 'inp'.
*/
-int hs_cell_establish_intro_add_sig(hs_cell_establish_intro_t *inp, uint8_t elt);
+int trn_cell_establish_intro_add_sig(trn_cell_establish_intro_t *inp, uint8_t elt);
/** Return a pointer to the variable-length array field sig of 'inp'.
*/
-uint8_t * hs_cell_establish_intro_getarray_sig(hs_cell_establish_intro_t *inp);
-/** As hs_cell_establish_intro_get_sig, but take and return a const
+uint8_t * trn_cell_establish_intro_getarray_sig(trn_cell_establish_intro_t *inp);
+/** As trn_cell_establish_intro_get_sig, but take and return a const
* pointer
*/
-const uint8_t * hs_cell_establish_intro_getconstarray_sig(const hs_cell_establish_intro_t *inp);
+const uint8_t * trn_cell_establish_intro_getconstarray_sig(const trn_cell_establish_intro_t *inp);
/** Change the length of the variable-length array field sig of 'inp'
* to 'newlen'.Fill extra elements with 0. Return 0 on success; return
* -1 and set the error code on 'inp' on failure.
*/
-int hs_cell_establish_intro_setlen_sig(hs_cell_establish_intro_t *inp, size_t newlen);
-/** Return a newly allocated hs_cell_intro_established with all
+int trn_cell_establish_intro_setlen_sig(trn_cell_establish_intro_t *inp, size_t newlen);
+/** Return a newly allocated trn_cell_intro_established with all
* elements set to zero.
*/
-hs_cell_intro_established_t *hs_cell_intro_established_new(void);
-/** Release all storage held by the hs_cell_intro_established in
+trn_cell_intro_established_t *trn_cell_intro_established_new(void);
+/** Release all storage held by the trn_cell_intro_established in
* 'victim'. (Do nothing if 'victim' is NULL.)
*/
-void hs_cell_intro_established_free(hs_cell_intro_established_t *victim);
-/** Try to parse a hs_cell_intro_established from the buffer in
+void trn_cell_intro_established_free(trn_cell_intro_established_t *victim);
+/** Try to parse a trn_cell_intro_established from the buffer in
* 'input', using up to 'len_in' bytes from the input buffer. On
* success, return the number of bytes consumed and set *output to the
- * newly allocated hs_cell_intro_established_t. On failure, return -2
+ * newly allocated trn_cell_intro_established_t. On failure, return -2
* if the input appears truncated, and -1 if the input is otherwise
* invalid.
*/
-ssize_t hs_cell_intro_established_parse(hs_cell_intro_established_t **output, const uint8_t *input, const size_t len_in);
+ssize_t trn_cell_intro_established_parse(trn_cell_intro_established_t **output, const uint8_t *input, const size_t len_in);
/** Return the number of bytes we expect to need to encode the
- * hs_cell_intro_established in 'obj'. On failure, return a negative
+ * trn_cell_intro_established in 'obj'. On failure, return a negative
* value. Note that this value may be an overestimate, and can even be
* an underestimate for certain unencodeable objects.
*/
-ssize_t hs_cell_intro_established_encoded_len(const hs_cell_intro_established_t *obj);
-/** Try to encode the hs_cell_intro_established from 'input' into the
+ssize_t trn_cell_intro_established_encoded_len(const trn_cell_intro_established_t *obj);
+/** Try to encode the trn_cell_intro_established from 'input' into the
* buffer at 'output', using up to 'avail' bytes of the output buffer.
* On success, return the number of bytes used. On failure, return -2
* if the buffer was not long enough, and -1 if the input was invalid.
*/
-ssize_t hs_cell_intro_established_encode(uint8_t *output, size_t avail, const hs_cell_intro_established_t *input);
-/** Check whether the internal state of the hs_cell_intro_established
+ssize_t trn_cell_intro_established_encode(uint8_t *output, size_t avail, const trn_cell_intro_established_t *input);
+/** Check whether the internal state of the trn_cell_intro_established
* in 'obj' is consistent. Return NULL if it is, and a short message
* if it is not.
*/
-const char *hs_cell_intro_established_check(const hs_cell_intro_established_t *obj);
+const char *trn_cell_intro_established_check(const trn_cell_intro_established_t *obj);
/** Clear any errors that were set on the object 'obj' by its setter
* functions. Return true iff errors were cleared.
*/
-int hs_cell_intro_established_clear_errors(hs_cell_intro_established_t *obj);
+int trn_cell_intro_established_clear_errors(trn_cell_intro_established_t *obj);
/** Return the value of the extensions field of the
- * hs_cell_intro_established_t in 'inp'
+ * trn_cell_intro_established_t in 'inp'
*/
-struct cell_extension_st * hs_cell_intro_established_get_extensions(hs_cell_intro_established_t *inp);
-/** As hs_cell_intro_established_get_extensions, but take and return a
- * const pointer
+struct trn_cell_extension_st * trn_cell_intro_established_get_extensions(trn_cell_intro_established_t *inp);
+/** As trn_cell_intro_established_get_extensions, but take and return
+ * a const pointer
*/
-const struct cell_extension_st * hs_cell_intro_established_getconst_extensions(const hs_cell_intro_established_t *inp);
+const struct trn_cell_extension_st * trn_cell_intro_established_getconst_extensions(const trn_cell_intro_established_t *inp);
/** Set the value of the extensions field of the
- * hs_cell_intro_established_t in 'inp' to 'val'. Free the old value
+ * trn_cell_intro_established_t in 'inp' to 'val'. Free the old value
* if any. Steals the referenceto 'val'.Return 0 on success; return -1
* and set the error code on 'inp' on failure.
*/
-int hs_cell_intro_established_set_extensions(hs_cell_intro_established_t *inp, struct cell_extension_st *val);
-/** As hs_cell_intro_established_set_extensions, but does not free the
- * previous value.
+int trn_cell_intro_established_set_extensions(trn_cell_intro_established_t *inp, struct trn_cell_extension_st *val);
+/** As trn_cell_intro_established_set_extensions, but does not free
+ * the previous value.
*/
-int hs_cell_intro_established_set0_extensions(hs_cell_intro_established_t *inp, struct cell_extension_st *val);
+int trn_cell_intro_established_set0_extensions(trn_cell_intro_established_t *inp, struct trn_cell_extension_st *val);
#endif
diff --git a/src/trunnel/hs/cell_establish_intro.trunnel b/src/trunnel/hs/cell_establish_intro.trunnel
index 33a133bf67..011ee62a15 100644
--- a/src/trunnel/hs/cell_establish_intro.trunnel
+++ b/src/trunnel/hs/cell_establish_intro.trunnel
@@ -4,12 +4,12 @@
* specified in proposal 224 section 3.1.
*/
-extern struct cell_extension;
+extern struct trn_cell_extension;
const TRUNNEL_SHA3_256_LEN = 32;
/* ESTABLISH_INTRO payload. See details in section 3.1.1 */
-struct hs_cell_establish_intro {
+struct trn_cell_establish_intro {
/* Indicate the start of the handshake authentication data. */
@ptr start_cell;
@@ -19,7 +19,7 @@ struct hs_cell_establish_intro {
u8 auth_key[auth_key_len];
/* Extension(s). Reserved fields. */
- struct cell_extension extensions;
+ struct trn_cell_extension extensions;
@ptr end_mac_fields;
/* Handshake MAC. */
@@ -35,7 +35,7 @@ struct hs_cell_establish_intro {
/* INTRO_ESTABLISHED payload which is an acknowledge of the ESTABLISH_INTRO
* cell. For legacy node, this payload is empty so the following only applies
* to version >= 3. */
-struct hs_cell_intro_established {
+struct trn_cell_intro_established {
/* Extension(s). Reserved fields. */
- struct cell_extension extensions;
+ struct trn_cell_extension extensions;
};
diff --git a/src/trunnel/hs/cell_introduce1.c b/src/trunnel/hs/cell_introduce1.c
index 5922a086dc..7501f6f196 100644
--- a/src/trunnel/hs/cell_introduce1.c
+++ b/src/trunnel/hs/cell_introduce1.c
@@ -28,14 +28,14 @@ int cellintroduce_deadcode_dummy__ = 0;
} \
} while (0)
-typedef struct cell_extension_st cell_extension_t;
-cell_extension_t *cell_extension_new(void);
-void cell_extension_free(cell_extension_t *victim);
-ssize_t cell_extension_parse(cell_extension_t **output, const uint8_t *input, const size_t len_in);
-ssize_t cell_extension_encoded_len(const cell_extension_t *obj);
-ssize_t cell_extension_encode(uint8_t *output, size_t avail, const cell_extension_t *input);
-const char *cell_extension_check(const cell_extension_t *obj);
-int cell_extension_clear_errors(cell_extension_t *obj);
+typedef struct trn_cell_extension_st trn_cell_extension_t;
+trn_cell_extension_t *trn_cell_extension_new(void);
+void trn_cell_extension_free(trn_cell_extension_t *victim);
+ssize_t trn_cell_extension_parse(trn_cell_extension_t **output, const uint8_t *input, const size_t len_in);
+ssize_t trn_cell_extension_encoded_len(const trn_cell_extension_t *obj);
+ssize_t trn_cell_extension_encode(uint8_t *output, size_t avail, const trn_cell_extension_t *input);
+const char *trn_cell_extension_check(const trn_cell_extension_t *obj);
+int trn_cell_extension_clear_errors(trn_cell_extension_t *obj);
typedef struct link_specifier_st link_specifier_t;
link_specifier_t *link_specifier_new(void);
void link_specifier_free(link_specifier_t *victim);
@@ -44,10 +44,10 @@ ssize_t link_specifier_encoded_len(const link_specifier_t *obj);
ssize_t link_specifier_encode(uint8_t *output, size_t avail, const link_specifier_t *input);
const char *link_specifier_check(const link_specifier_t *obj);
int link_specifier_clear_errors(link_specifier_t *obj);
-hs_cell_introduce1_t *
-hs_cell_introduce1_new(void)
+trn_cell_introduce1_t *
+trn_cell_introduce1_new(void)
{
- hs_cell_introduce1_t *val = trunnel_calloc(1, sizeof(hs_cell_introduce1_t));
+ trn_cell_introduce1_t *val = trunnel_calloc(1, sizeof(trn_cell_introduce1_t));
if (NULL == val)
return NULL;
return val;
@@ -56,47 +56,47 @@ hs_cell_introduce1_new(void)
/** Release all storage held inside 'obj', but do not free 'obj'.
*/
static void
-hs_cell_introduce1_clear(hs_cell_introduce1_t *obj)
+trn_cell_introduce1_clear(trn_cell_introduce1_t *obj)
{
(void) obj;
TRUNNEL_DYNARRAY_WIPE(&obj->auth_key);
TRUNNEL_DYNARRAY_CLEAR(&obj->auth_key);
- cell_extension_free(obj->extensions);
+ trn_cell_extension_free(obj->extensions);
obj->extensions = NULL;
TRUNNEL_DYNARRAY_WIPE(&obj->encrypted);
TRUNNEL_DYNARRAY_CLEAR(&obj->encrypted);
}
void
-hs_cell_introduce1_free(hs_cell_introduce1_t *obj)
+trn_cell_introduce1_free(trn_cell_introduce1_t *obj)
{
if (obj == NULL)
return;
- hs_cell_introduce1_clear(obj);
- trunnel_memwipe(obj, sizeof(hs_cell_introduce1_t));
+ trn_cell_introduce1_clear(obj);
+ trunnel_memwipe(obj, sizeof(trn_cell_introduce1_t));
trunnel_free_(obj);
}
size_t
-hs_cell_introduce1_getlen_legacy_key_id(const hs_cell_introduce1_t *inp)
+trn_cell_introduce1_getlen_legacy_key_id(const trn_cell_introduce1_t *inp)
{
(void)inp; return TRUNNEL_SHA1_LEN;
}
uint8_t
-hs_cell_introduce1_get_legacy_key_id(hs_cell_introduce1_t *inp, size_t idx)
+trn_cell_introduce1_get_legacy_key_id(trn_cell_introduce1_t *inp, size_t idx)
{
trunnel_assert(idx < TRUNNEL_SHA1_LEN);
return inp->legacy_key_id[idx];
}
uint8_t
-hs_cell_introduce1_getconst_legacy_key_id(const hs_cell_introduce1_t *inp, size_t idx)
+trn_cell_introduce1_getconst_legacy_key_id(const trn_cell_introduce1_t *inp, size_t idx)
{
- return hs_cell_introduce1_get_legacy_key_id((hs_cell_introduce1_t*)inp, idx);
+ return trn_cell_introduce1_get_legacy_key_id((trn_cell_introduce1_t*)inp, idx);
}
int
-hs_cell_introduce1_set_legacy_key_id(hs_cell_introduce1_t *inp, size_t idx, uint8_t elt)
+trn_cell_introduce1_set_legacy_key_id(trn_cell_introduce1_t *inp, size_t idx, uint8_t elt)
{
trunnel_assert(idx < TRUNNEL_SHA1_LEN);
inp->legacy_key_id[idx] = elt;
@@ -104,22 +104,22 @@ hs_cell_introduce1_set_legacy_key_id(hs_cell_introduce1_t *inp, size_t idx, uint
}
uint8_t *
-hs_cell_introduce1_getarray_legacy_key_id(hs_cell_introduce1_t *inp)
+trn_cell_introduce1_getarray_legacy_key_id(trn_cell_introduce1_t *inp)
{
return inp->legacy_key_id;
}
const uint8_t *
-hs_cell_introduce1_getconstarray_legacy_key_id(const hs_cell_introduce1_t *inp)
+trn_cell_introduce1_getconstarray_legacy_key_id(const trn_cell_introduce1_t *inp)
{
- return (const uint8_t *)hs_cell_introduce1_getarray_legacy_key_id((hs_cell_introduce1_t*)inp);
+ return (const uint8_t *)trn_cell_introduce1_getarray_legacy_key_id((trn_cell_introduce1_t*)inp);
}
uint8_t
-hs_cell_introduce1_get_auth_key_type(const hs_cell_introduce1_t *inp)
+trn_cell_introduce1_get_auth_key_type(const trn_cell_introduce1_t *inp)
{
return inp->auth_key_type;
}
int
-hs_cell_introduce1_set_auth_key_type(hs_cell_introduce1_t *inp, uint8_t val)
+trn_cell_introduce1_set_auth_key_type(trn_cell_introduce1_t *inp, uint8_t val)
{
if (! ((val == 0 || val == 1 || val == 2))) {
TRUNNEL_SET_ERROR_CODE(inp);
@@ -129,41 +129,41 @@ hs_cell_introduce1_set_auth_key_type(hs_cell_introduce1_t *inp, uint8_t val)
return 0;
}
uint16_t
-hs_cell_introduce1_get_auth_key_len(const hs_cell_introduce1_t *inp)
+trn_cell_introduce1_get_auth_key_len(const trn_cell_introduce1_t *inp)
{
return inp->auth_key_len;
}
int
-hs_cell_introduce1_set_auth_key_len(hs_cell_introduce1_t *inp, uint16_t val)
+trn_cell_introduce1_set_auth_key_len(trn_cell_introduce1_t *inp, uint16_t val)
{
inp->auth_key_len = val;
return 0;
}
size_t
-hs_cell_introduce1_getlen_auth_key(const hs_cell_introduce1_t *inp)
+trn_cell_introduce1_getlen_auth_key(const trn_cell_introduce1_t *inp)
{
return TRUNNEL_DYNARRAY_LEN(&inp->auth_key);
}
uint8_t
-hs_cell_introduce1_get_auth_key(hs_cell_introduce1_t *inp, size_t idx)
+trn_cell_introduce1_get_auth_key(trn_cell_introduce1_t *inp, size_t idx)
{
return TRUNNEL_DYNARRAY_GET(&inp->auth_key, idx);
}
uint8_t
-hs_cell_introduce1_getconst_auth_key(const hs_cell_introduce1_t *inp, size_t idx)
+trn_cell_introduce1_getconst_auth_key(const trn_cell_introduce1_t *inp, size_t idx)
{
- return hs_cell_introduce1_get_auth_key((hs_cell_introduce1_t*)inp, idx);
+ return trn_cell_introduce1_get_auth_key((trn_cell_introduce1_t*)inp, idx);
}
int
-hs_cell_introduce1_set_auth_key(hs_cell_introduce1_t *inp, size_t idx, uint8_t elt)
+trn_cell_introduce1_set_auth_key(trn_cell_introduce1_t *inp, size_t idx, uint8_t elt)
{
TRUNNEL_DYNARRAY_SET(&inp->auth_key, idx, elt);
return 0;
}
int
-hs_cell_introduce1_add_auth_key(hs_cell_introduce1_t *inp, uint8_t elt)
+trn_cell_introduce1_add_auth_key(trn_cell_introduce1_t *inp, uint8_t elt)
{
#if SIZE_MAX >= UINT16_MAX
if (inp->auth_key.n_ == UINT16_MAX)
@@ -177,17 +177,17 @@ hs_cell_introduce1_add_auth_key(hs_cell_introduce1_t *inp, uint8_t elt)
}
uint8_t *
-hs_cell_introduce1_getarray_auth_key(hs_cell_introduce1_t *inp)
+trn_cell_introduce1_getarray_auth_key(trn_cell_introduce1_t *inp)
{
return inp->auth_key.elts_;
}
const uint8_t *
-hs_cell_introduce1_getconstarray_auth_key(const hs_cell_introduce1_t *inp)
+trn_cell_introduce1_getconstarray_auth_key(const trn_cell_introduce1_t *inp)
{
- return (const uint8_t *)hs_cell_introduce1_getarray_auth_key((hs_cell_introduce1_t*)inp);
+ return (const uint8_t *)trn_cell_introduce1_getarray_auth_key((trn_cell_introduce1_t*)inp);
}
int
-hs_cell_introduce1_setlen_auth_key(hs_cell_introduce1_t *inp, size_t newlen)
+trn_cell_introduce1_setlen_auth_key(trn_cell_introduce1_t *inp, size_t newlen)
{
uint8_t *newptr;
#if UINT16_MAX < SIZE_MAX
@@ -206,54 +206,54 @@ hs_cell_introduce1_setlen_auth_key(hs_cell_introduce1_t *inp, size_t newlen)
TRUNNEL_SET_ERROR_CODE(inp);
return -1;
}
-struct cell_extension_st *
-hs_cell_introduce1_get_extensions(hs_cell_introduce1_t *inp)
+struct trn_cell_extension_st *
+trn_cell_introduce1_get_extensions(trn_cell_introduce1_t *inp)
{
return inp->extensions;
}
-const struct cell_extension_st *
-hs_cell_introduce1_getconst_extensions(const hs_cell_introduce1_t *inp)
+const struct trn_cell_extension_st *
+trn_cell_introduce1_getconst_extensions(const trn_cell_introduce1_t *inp)
{
- return hs_cell_introduce1_get_extensions((hs_cell_introduce1_t*) inp);
+ return trn_cell_introduce1_get_extensions((trn_cell_introduce1_t*) inp);
}
int
-hs_cell_introduce1_set_extensions(hs_cell_introduce1_t *inp, struct cell_extension_st *val)
+trn_cell_introduce1_set_extensions(trn_cell_introduce1_t *inp, struct trn_cell_extension_st *val)
{
if (inp->extensions && inp->extensions != val)
- cell_extension_free(inp->extensions);
- return hs_cell_introduce1_set0_extensions(inp, val);
+ trn_cell_extension_free(inp->extensions);
+ return trn_cell_introduce1_set0_extensions(inp, val);
}
int
-hs_cell_introduce1_set0_extensions(hs_cell_introduce1_t *inp, struct cell_extension_st *val)
+trn_cell_introduce1_set0_extensions(trn_cell_introduce1_t *inp, struct trn_cell_extension_st *val)
{
inp->extensions = val;
return 0;
}
size_t
-hs_cell_introduce1_getlen_encrypted(const hs_cell_introduce1_t *inp)
+trn_cell_introduce1_getlen_encrypted(const trn_cell_introduce1_t *inp)
{
return TRUNNEL_DYNARRAY_LEN(&inp->encrypted);
}
uint8_t
-hs_cell_introduce1_get_encrypted(hs_cell_introduce1_t *inp, size_t idx)
+trn_cell_introduce1_get_encrypted(trn_cell_introduce1_t *inp, size_t idx)
{
return TRUNNEL_DYNARRAY_GET(&inp->encrypted, idx);
}
uint8_t
-hs_cell_introduce1_getconst_encrypted(const hs_cell_introduce1_t *inp, size_t idx)
+trn_cell_introduce1_getconst_encrypted(const trn_cell_introduce1_t *inp, size_t idx)
{
- return hs_cell_introduce1_get_encrypted((hs_cell_introduce1_t*)inp, idx);
+ return trn_cell_introduce1_get_encrypted((trn_cell_introduce1_t*)inp, idx);
}
int
-hs_cell_introduce1_set_encrypted(hs_cell_introduce1_t *inp, size_t idx, uint8_t elt)
+trn_cell_introduce1_set_encrypted(trn_cell_introduce1_t *inp, size_t idx, uint8_t elt)
{
TRUNNEL_DYNARRAY_SET(&inp->encrypted, idx, elt);
return 0;
}
int
-hs_cell_introduce1_add_encrypted(hs_cell_introduce1_t *inp, uint8_t elt)
+trn_cell_introduce1_add_encrypted(trn_cell_introduce1_t *inp, uint8_t elt)
{
TRUNNEL_DYNARRAY_ADD(uint8_t, &inp->encrypted, elt, {});
return 0;
@@ -263,17 +263,17 @@ hs_cell_introduce1_add_encrypted(hs_cell_introduce1_t *inp, uint8_t elt)
}
uint8_t *
-hs_cell_introduce1_getarray_encrypted(hs_cell_introduce1_t *inp)
+trn_cell_introduce1_getarray_encrypted(trn_cell_introduce1_t *inp)
{
return inp->encrypted.elts_;
}
const uint8_t *
-hs_cell_introduce1_getconstarray_encrypted(const hs_cell_introduce1_t *inp)
+trn_cell_introduce1_getconstarray_encrypted(const trn_cell_introduce1_t *inp)
{
- return (const uint8_t *)hs_cell_introduce1_getarray_encrypted((hs_cell_introduce1_t*)inp);
+ return (const uint8_t *)trn_cell_introduce1_getarray_encrypted((trn_cell_introduce1_t*)inp);
}
int
-hs_cell_introduce1_setlen_encrypted(hs_cell_introduce1_t *inp, size_t newlen)
+trn_cell_introduce1_setlen_encrypted(trn_cell_introduce1_t *inp, size_t newlen)
{
uint8_t *newptr;
newptr = trunnel_dynarray_setlen(&inp->encrypted.allocated_,
@@ -289,7 +289,7 @@ hs_cell_introduce1_setlen_encrypted(hs_cell_introduce1_t *inp, size_t newlen)
return -1;
}
const char *
-hs_cell_introduce1_check(const hs_cell_introduce1_t *obj)
+trn_cell_introduce1_check(const trn_cell_introduce1_t *obj)
{
if (obj == NULL)
return "Object was NULL";
@@ -301,18 +301,18 @@ hs_cell_introduce1_check(const hs_cell_introduce1_t *obj)
return "Length mismatch for auth_key";
{
const char *msg;
- if (NULL != (msg = cell_extension_check(obj->extensions)))
+ if (NULL != (msg = trn_cell_extension_check(obj->extensions)))
return msg;
}
return NULL;
}
ssize_t
-hs_cell_introduce1_encoded_len(const hs_cell_introduce1_t *obj)
+trn_cell_introduce1_encoded_len(const trn_cell_introduce1_t *obj)
{
ssize_t result = 0;
- if (NULL != hs_cell_introduce1_check(obj))
+ if (NULL != trn_cell_introduce1_check(obj))
return -1;
@@ -328,32 +328,32 @@ hs_cell_introduce1_encoded_len(const hs_cell_introduce1_t *obj)
/* Length of u8 auth_key[auth_key_len] */
result += TRUNNEL_DYNARRAY_LEN(&obj->auth_key);
- /* Length of struct cell_extension extensions */
- result += cell_extension_encoded_len(obj->extensions);
+ /* Length of struct trn_cell_extension extensions */
+ result += trn_cell_extension_encoded_len(obj->extensions);
/* Length of u8 encrypted[] */
result += TRUNNEL_DYNARRAY_LEN(&obj->encrypted);
return result;
}
int
-hs_cell_introduce1_clear_errors(hs_cell_introduce1_t *obj)
+trn_cell_introduce1_clear_errors(trn_cell_introduce1_t *obj)
{
int r = obj->trunnel_error_code_;
obj->trunnel_error_code_ = 0;
return r;
}
ssize_t
-hs_cell_introduce1_encode(uint8_t *output, const size_t avail, const hs_cell_introduce1_t *obj)
+trn_cell_introduce1_encode(uint8_t *output, const size_t avail, const trn_cell_introduce1_t *obj)
{
ssize_t result = 0;
size_t written = 0;
uint8_t *ptr = output;
const char *msg;
#ifdef TRUNNEL_CHECK_ENCODED_LEN
- const ssize_t encoded_len = hs_cell_introduce1_encoded_len(obj);
+ const ssize_t encoded_len = trn_cell_introduce1_encoded_len(obj);
#endif
- if (NULL != (msg = hs_cell_introduce1_check(obj)))
+ if (NULL != (msg = trn_cell_introduce1_check(obj)))
goto check_failed;
#ifdef TRUNNEL_CHECK_ENCODED_LEN
@@ -393,9 +393,9 @@ hs_cell_introduce1_encode(uint8_t *output, const size_t avail, const hs_cell_int
written += elt_len; ptr += elt_len;
}
- /* Encode struct cell_extension extensions */
+ /* Encode struct trn_cell_extension extensions */
trunnel_assert(written <= avail);
- result = cell_extension_encode(ptr, avail - written, obj->extensions);
+ result = trn_cell_extension_encode(ptr, avail - written, obj->extensions);
if (result < 0)
goto fail; /* XXXXXXX !*/
written += result; ptr += result;
@@ -435,11 +435,11 @@ hs_cell_introduce1_encode(uint8_t *output, const size_t avail, const hs_cell_int
return result;
}
-/** As hs_cell_introduce1_parse(), but do not allocate the output
+/** As trn_cell_introduce1_parse(), but do not allocate the output
* object.
*/
static ssize_t
-hs_cell_introduce1_parse_into(hs_cell_introduce1_t *obj, const uint8_t *input, const size_t len_in)
+trn_cell_introduce1_parse_into(trn_cell_introduce1_t *obj, const uint8_t *input, const size_t len_in)
{
const uint8_t *ptr = input;
size_t remaining = len_in;
@@ -471,8 +471,8 @@ hs_cell_introduce1_parse_into(hs_cell_introduce1_t *obj, const uint8_t *input, c
memcpy(obj->auth_key.elts_, ptr, obj->auth_key_len);
ptr += obj->auth_key_len; remaining -= obj->auth_key_len;
- /* Parse struct cell_extension extensions */
- result = cell_extension_parse(&obj->extensions, ptr, remaining);
+ /* Parse struct trn_cell_extension extensions */
+ result = trn_cell_extension_parse(&obj->extensions, ptr, remaining);
if (result < 0)
goto relay_fail;
trunnel_assert((size_t)result <= remaining);
@@ -500,23 +500,23 @@ hs_cell_introduce1_parse_into(hs_cell_introduce1_t *obj, const uint8_t *input, c
}
ssize_t
-hs_cell_introduce1_parse(hs_cell_introduce1_t **output, const uint8_t *input, const size_t len_in)
+trn_cell_introduce1_parse(trn_cell_introduce1_t **output, const uint8_t *input, const size_t len_in)
{
ssize_t result;
- *output = hs_cell_introduce1_new();
+ *output = trn_cell_introduce1_new();
if (NULL == *output)
return -1;
- result = hs_cell_introduce1_parse_into(*output, input, len_in);
+ result = trn_cell_introduce1_parse_into(*output, input, len_in);
if (result < 0) {
- hs_cell_introduce1_free(*output);
+ trn_cell_introduce1_free(*output);
*output = NULL;
}
return result;
}
-hs_cell_introduce_ack_t *
-hs_cell_introduce_ack_new(void)
+trn_cell_introduce_ack_t *
+trn_cell_introduce_ack_new(void)
{
- hs_cell_introduce_ack_t *val = trunnel_calloc(1, sizeof(hs_cell_introduce_ack_t));
+ trn_cell_introduce_ack_t *val = trunnel_calloc(1, sizeof(trn_cell_introduce_ack_t));
if (NULL == val)
return NULL;
return val;
@@ -525,30 +525,30 @@ hs_cell_introduce_ack_new(void)
/** Release all storage held inside 'obj', but do not free 'obj'.
*/
static void
-hs_cell_introduce_ack_clear(hs_cell_introduce_ack_t *obj)
+trn_cell_introduce_ack_clear(trn_cell_introduce_ack_t *obj)
{
(void) obj;
- cell_extension_free(obj->extensions);
+ trn_cell_extension_free(obj->extensions);
obj->extensions = NULL;
}
void
-hs_cell_introduce_ack_free(hs_cell_introduce_ack_t *obj)
+trn_cell_introduce_ack_free(trn_cell_introduce_ack_t *obj)
{
if (obj == NULL)
return;
- hs_cell_introduce_ack_clear(obj);
- trunnel_memwipe(obj, sizeof(hs_cell_introduce_ack_t));
+ trn_cell_introduce_ack_clear(obj);
+ trunnel_memwipe(obj, sizeof(trn_cell_introduce_ack_t));
trunnel_free_(obj);
}
uint16_t
-hs_cell_introduce_ack_get_status(const hs_cell_introduce_ack_t *inp)
+trn_cell_introduce_ack_get_status(const trn_cell_introduce_ack_t *inp)
{
return inp->status;
}
int
-hs_cell_introduce_ack_set_status(hs_cell_introduce_ack_t *inp, uint16_t val)
+trn_cell_introduce_ack_set_status(trn_cell_introduce_ack_t *inp, uint16_t val)
{
if (! ((val == 0 || val == 1 || val == 2))) {
TRUNNEL_SET_ERROR_CODE(inp);
@@ -557,31 +557,31 @@ hs_cell_introduce_ack_set_status(hs_cell_introduce_ack_t *inp, uint16_t val)
inp->status = val;
return 0;
}
-struct cell_extension_st *
-hs_cell_introduce_ack_get_extensions(hs_cell_introduce_ack_t *inp)
+struct trn_cell_extension_st *
+trn_cell_introduce_ack_get_extensions(trn_cell_introduce_ack_t *inp)
{
return inp->extensions;
}
-const struct cell_extension_st *
-hs_cell_introduce_ack_getconst_extensions(const hs_cell_introduce_ack_t *inp)
+const struct trn_cell_extension_st *
+trn_cell_introduce_ack_getconst_extensions(const trn_cell_introduce_ack_t *inp)
{
- return hs_cell_introduce_ack_get_extensions((hs_cell_introduce_ack_t*) inp);
+ return trn_cell_introduce_ack_get_extensions((trn_cell_introduce_ack_t*) inp);
}
int
-hs_cell_introduce_ack_set_extensions(hs_cell_introduce_ack_t *inp, struct cell_extension_st *val)
+trn_cell_introduce_ack_set_extensions(trn_cell_introduce_ack_t *inp, struct trn_cell_extension_st *val)
{
if (inp->extensions && inp->extensions != val)
- cell_extension_free(inp->extensions);
- return hs_cell_introduce_ack_set0_extensions(inp, val);
+ trn_cell_extension_free(inp->extensions);
+ return trn_cell_introduce_ack_set0_extensions(inp, val);
}
int
-hs_cell_introduce_ack_set0_extensions(hs_cell_introduce_ack_t *inp, struct cell_extension_st *val)
+trn_cell_introduce_ack_set0_extensions(trn_cell_introduce_ack_t *inp, struct trn_cell_extension_st *val)
{
inp->extensions = val;
return 0;
}
const char *
-hs_cell_introduce_ack_check(const hs_cell_introduce_ack_t *obj)
+trn_cell_introduce_ack_check(const trn_cell_introduce_ack_t *obj)
{
if (obj == NULL)
return "Object was NULL";
@@ -591,47 +591,47 @@ hs_cell_introduce_ack_check(const hs_cell_introduce_ack_t *obj)
return "Integer out of bounds";
{
const char *msg;
- if (NULL != (msg = cell_extension_check(obj->extensions)))
+ if (NULL != (msg = trn_cell_extension_check(obj->extensions)))
return msg;
}
return NULL;
}
ssize_t
-hs_cell_introduce_ack_encoded_len(const hs_cell_introduce_ack_t *obj)
+trn_cell_introduce_ack_encoded_len(const trn_cell_introduce_ack_t *obj)
{
ssize_t result = 0;
- if (NULL != hs_cell_introduce_ack_check(obj))
+ if (NULL != trn_cell_introduce_ack_check(obj))
return -1;
/* Length of u16 status IN [0, 1, 2] */
result += 2;
- /* Length of struct cell_extension extensions */
- result += cell_extension_encoded_len(obj->extensions);
+ /* Length of struct trn_cell_extension extensions */
+ result += trn_cell_extension_encoded_len(obj->extensions);
return result;
}
int
-hs_cell_introduce_ack_clear_errors(hs_cell_introduce_ack_t *obj)
+trn_cell_introduce_ack_clear_errors(trn_cell_introduce_ack_t *obj)
{
int r = obj->trunnel_error_code_;
obj->trunnel_error_code_ = 0;
return r;
}
ssize_t
-hs_cell_introduce_ack_encode(uint8_t *output, const size_t avail, const hs_cell_introduce_ack_t *obj)
+trn_cell_introduce_ack_encode(uint8_t *output, const size_t avail, const trn_cell_introduce_ack_t *obj)
{
ssize_t result = 0;
size_t written = 0;
uint8_t *ptr = output;
const char *msg;
#ifdef TRUNNEL_CHECK_ENCODED_LEN
- const ssize_t encoded_len = hs_cell_introduce_ack_encoded_len(obj);
+ const ssize_t encoded_len = trn_cell_introduce_ack_encoded_len(obj);
#endif
- if (NULL != (msg = hs_cell_introduce_ack_check(obj)))
+ if (NULL != (msg = trn_cell_introduce_ack_check(obj)))
goto check_failed;
#ifdef TRUNNEL_CHECK_ENCODED_LEN
@@ -645,9 +645,9 @@ hs_cell_introduce_ack_encode(uint8_t *output, const size_t avail, const hs_cell_
trunnel_set_uint16(ptr, trunnel_htons(obj->status));
written += 2; ptr += 2;
- /* Encode struct cell_extension extensions */
+ /* Encode struct trn_cell_extension extensions */
trunnel_assert(written <= avail);
- result = cell_extension_encode(ptr, avail - written, obj->extensions);
+ result = trn_cell_extension_encode(ptr, avail - written, obj->extensions);
if (result < 0)
goto fail; /* XXXXXXX !*/
written += result; ptr += result;
@@ -676,11 +676,11 @@ hs_cell_introduce_ack_encode(uint8_t *output, const size_t avail, const hs_cell_
return result;
}
-/** As hs_cell_introduce_ack_parse(), but do not allocate the output
+/** As trn_cell_introduce_ack_parse(), but do not allocate the output
* object.
*/
static ssize_t
-hs_cell_introduce_ack_parse_into(hs_cell_introduce_ack_t *obj, const uint8_t *input, const size_t len_in)
+trn_cell_introduce_ack_parse_into(trn_cell_introduce_ack_t *obj, const uint8_t *input, const size_t len_in)
{
const uint8_t *ptr = input;
size_t remaining = len_in;
@@ -694,8 +694,8 @@ hs_cell_introduce_ack_parse_into(hs_cell_introduce_ack_t *obj, const uint8_t *in
if (! (obj->status == 0 || obj->status == 1 || obj->status == 2))
goto fail;
- /* Parse struct cell_extension extensions */
- result = cell_extension_parse(&obj->extensions, ptr, remaining);
+ /* Parse struct trn_cell_extension extensions */
+ result = trn_cell_extension_parse(&obj->extensions, ptr, remaining);
if (result < 0)
goto relay_fail;
trunnel_assert((size_t)result <= remaining);
@@ -714,23 +714,23 @@ hs_cell_introduce_ack_parse_into(hs_cell_introduce_ack_t *obj, const uint8_t *in
}
ssize_t
-hs_cell_introduce_ack_parse(hs_cell_introduce_ack_t **output, const uint8_t *input, const size_t len_in)
+trn_cell_introduce_ack_parse(trn_cell_introduce_ack_t **output, const uint8_t *input, const size_t len_in)
{
ssize_t result;
- *output = hs_cell_introduce_ack_new();
+ *output = trn_cell_introduce_ack_new();
if (NULL == *output)
return -1;
- result = hs_cell_introduce_ack_parse_into(*output, input, len_in);
+ result = trn_cell_introduce_ack_parse_into(*output, input, len_in);
if (result < 0) {
- hs_cell_introduce_ack_free(*output);
+ trn_cell_introduce_ack_free(*output);
*output = NULL;
}
return result;
}
-hs_cell_introduce_encrypted_t *
-hs_cell_introduce_encrypted_new(void)
+trn_cell_introduce_encrypted_t *
+trn_cell_introduce_encrypted_new(void)
{
- hs_cell_introduce_encrypted_t *val = trunnel_calloc(1, sizeof(hs_cell_introduce_encrypted_t));
+ trn_cell_introduce_encrypted_t *val = trunnel_calloc(1, sizeof(trn_cell_introduce_encrypted_t));
if (NULL == val)
return NULL;
val->onion_key_type = 1;
@@ -740,10 +740,10 @@ hs_cell_introduce_encrypted_new(void)
/** Release all storage held inside 'obj', but do not free 'obj'.
*/
static void
-hs_cell_introduce_encrypted_clear(hs_cell_introduce_encrypted_t *obj)
+trn_cell_introduce_encrypted_clear(trn_cell_introduce_encrypted_t *obj)
{
(void) obj;
- cell_extension_free(obj->extensions);
+ trn_cell_extension_free(obj->extensions);
obj->extensions = NULL;
TRUNNEL_DYNARRAY_WIPE(&obj->onion_key);
TRUNNEL_DYNARRAY_CLEAR(&obj->onion_key);
@@ -761,35 +761,35 @@ hs_cell_introduce_encrypted_clear(hs_cell_introduce_encrypted_t *obj)
}
void
-hs_cell_introduce_encrypted_free(hs_cell_introduce_encrypted_t *obj)
+trn_cell_introduce_encrypted_free(trn_cell_introduce_encrypted_t *obj)
{
if (obj == NULL)
return;
- hs_cell_introduce_encrypted_clear(obj);
- trunnel_memwipe(obj, sizeof(hs_cell_introduce_encrypted_t));
+ trn_cell_introduce_encrypted_clear(obj);
+ trunnel_memwipe(obj, sizeof(trn_cell_introduce_encrypted_t));
trunnel_free_(obj);
}
size_t
-hs_cell_introduce_encrypted_getlen_rend_cookie(const hs_cell_introduce_encrypted_t *inp)
+trn_cell_introduce_encrypted_getlen_rend_cookie(const trn_cell_introduce_encrypted_t *inp)
{
(void)inp; return TRUNNEL_REND_COOKIE_LEN;
}
uint8_t
-hs_cell_introduce_encrypted_get_rend_cookie(hs_cell_introduce_encrypted_t *inp, size_t idx)
+trn_cell_introduce_encrypted_get_rend_cookie(trn_cell_introduce_encrypted_t *inp, size_t idx)
{
trunnel_assert(idx < TRUNNEL_REND_COOKIE_LEN);
return inp->rend_cookie[idx];
}
uint8_t
-hs_cell_introduce_encrypted_getconst_rend_cookie(const hs_cell_introduce_encrypted_t *inp, size_t idx)
+trn_cell_introduce_encrypted_getconst_rend_cookie(const trn_cell_introduce_encrypted_t *inp, size_t idx)
{
- return hs_cell_introduce_encrypted_get_rend_cookie((hs_cell_introduce_encrypted_t*)inp, idx);
+ return trn_cell_introduce_encrypted_get_rend_cookie((trn_cell_introduce_encrypted_t*)inp, idx);
}
int
-hs_cell_introduce_encrypted_set_rend_cookie(hs_cell_introduce_encrypted_t *inp, size_t idx, uint8_t elt)
+trn_cell_introduce_encrypted_set_rend_cookie(trn_cell_introduce_encrypted_t *inp, size_t idx, uint8_t elt)
{
trunnel_assert(idx < TRUNNEL_REND_COOKIE_LEN);
inp->rend_cookie[idx] = elt;
@@ -797,45 +797,45 @@ hs_cell_introduce_encrypted_set_rend_cookie(hs_cell_introduce_encrypted_t *inp,
}
uint8_t *
-hs_cell_introduce_encrypted_getarray_rend_cookie(hs_cell_introduce_encrypted_t *inp)
+trn_cell_introduce_encrypted_getarray_rend_cookie(trn_cell_introduce_encrypted_t *inp)
{
return inp->rend_cookie;
}
const uint8_t *
-hs_cell_introduce_encrypted_getconstarray_rend_cookie(const hs_cell_introduce_encrypted_t *inp)
+trn_cell_introduce_encrypted_getconstarray_rend_cookie(const trn_cell_introduce_encrypted_t *inp)
{
- return (const uint8_t *)hs_cell_introduce_encrypted_getarray_rend_cookie((hs_cell_introduce_encrypted_t*)inp);
+ return (const uint8_t *)trn_cell_introduce_encrypted_getarray_rend_cookie((trn_cell_introduce_encrypted_t*)inp);
}
-struct cell_extension_st *
-hs_cell_introduce_encrypted_get_extensions(hs_cell_introduce_encrypted_t *inp)
+struct trn_cell_extension_st *
+trn_cell_introduce_encrypted_get_extensions(trn_cell_introduce_encrypted_t *inp)
{
return inp->extensions;
}
-const struct cell_extension_st *
-hs_cell_introduce_encrypted_getconst_extensions(const hs_cell_introduce_encrypted_t *inp)
+const struct trn_cell_extension_st *
+trn_cell_introduce_encrypted_getconst_extensions(const trn_cell_introduce_encrypted_t *inp)
{
- return hs_cell_introduce_encrypted_get_extensions((hs_cell_introduce_encrypted_t*) inp);
+ return trn_cell_introduce_encrypted_get_extensions((trn_cell_introduce_encrypted_t*) inp);
}
int
-hs_cell_introduce_encrypted_set_extensions(hs_cell_introduce_encrypted_t *inp, struct cell_extension_st *val)
+trn_cell_introduce_encrypted_set_extensions(trn_cell_introduce_encrypted_t *inp, struct trn_cell_extension_st *val)
{
if (inp->extensions && inp->extensions != val)
- cell_extension_free(inp->extensions);
- return hs_cell_introduce_encrypted_set0_extensions(inp, val);
+ trn_cell_extension_free(inp->extensions);
+ return trn_cell_introduce_encrypted_set0_extensions(inp, val);
}
int
-hs_cell_introduce_encrypted_set0_extensions(hs_cell_introduce_encrypted_t *inp, struct cell_extension_st *val)
+trn_cell_introduce_encrypted_set0_extensions(trn_cell_introduce_encrypted_t *inp, struct trn_cell_extension_st *val)
{
inp->extensions = val;
return 0;
}
uint8_t
-hs_cell_introduce_encrypted_get_onion_key_type(const hs_cell_introduce_encrypted_t *inp)
+trn_cell_introduce_encrypted_get_onion_key_type(const trn_cell_introduce_encrypted_t *inp)
{
return inp->onion_key_type;
}
int
-hs_cell_introduce_encrypted_set_onion_key_type(hs_cell_introduce_encrypted_t *inp, uint8_t val)
+trn_cell_introduce_encrypted_set_onion_key_type(trn_cell_introduce_encrypted_t *inp, uint8_t val)
{
if (! ((val == 1))) {
TRUNNEL_SET_ERROR_CODE(inp);
@@ -845,41 +845,41 @@ hs_cell_introduce_encrypted_set_onion_key_type(hs_cell_introduce_encrypted_t *in
return 0;
}
uint16_t
-hs_cell_introduce_encrypted_get_onion_key_len(const hs_cell_introduce_encrypted_t *inp)
+trn_cell_introduce_encrypted_get_onion_key_len(const trn_cell_introduce_encrypted_t *inp)
{
return inp->onion_key_len;
}
int
-hs_cell_introduce_encrypted_set_onion_key_len(hs_cell_introduce_encrypted_t *inp, uint16_t val)
+trn_cell_introduce_encrypted_set_onion_key_len(trn_cell_introduce_encrypted_t *inp, uint16_t val)
{
inp->onion_key_len = val;
return 0;
}
size_t
-hs_cell_introduce_encrypted_getlen_onion_key(const hs_cell_introduce_encrypted_t *inp)
+trn_cell_introduce_encrypted_getlen_onion_key(const trn_cell_introduce_encrypted_t *inp)
{
return TRUNNEL_DYNARRAY_LEN(&inp->onion_key);
}
uint8_t
-hs_cell_introduce_encrypted_get_onion_key(hs_cell_introduce_encrypted_t *inp, size_t idx)
+trn_cell_introduce_encrypted_get_onion_key(trn_cell_introduce_encrypted_t *inp, size_t idx)
{
return TRUNNEL_DYNARRAY_GET(&inp->onion_key, idx);
}
uint8_t
-hs_cell_introduce_encrypted_getconst_onion_key(const hs_cell_introduce_encrypted_t *inp, size_t idx)
+trn_cell_introduce_encrypted_getconst_onion_key(const trn_cell_introduce_encrypted_t *inp, size_t idx)
{
- return hs_cell_introduce_encrypted_get_onion_key((hs_cell_introduce_encrypted_t*)inp, idx);
+ return trn_cell_introduce_encrypted_get_onion_key((trn_cell_introduce_encrypted_t*)inp, idx);
}
int
-hs_cell_introduce_encrypted_set_onion_key(hs_cell_introduce_encrypted_t *inp, size_t idx, uint8_t elt)
+trn_cell_introduce_encrypted_set_onion_key(trn_cell_introduce_encrypted_t *inp, size_t idx, uint8_t elt)
{
TRUNNEL_DYNARRAY_SET(&inp->onion_key, idx, elt);
return 0;
}
int
-hs_cell_introduce_encrypted_add_onion_key(hs_cell_introduce_encrypted_t *inp, uint8_t elt)
+trn_cell_introduce_encrypted_add_onion_key(trn_cell_introduce_encrypted_t *inp, uint8_t elt)
{
#if SIZE_MAX >= UINT16_MAX
if (inp->onion_key.n_ == UINT16_MAX)
@@ -893,17 +893,17 @@ hs_cell_introduce_encrypted_add_onion_key(hs_cell_introduce_encrypted_t *inp, ui
}
uint8_t *
-hs_cell_introduce_encrypted_getarray_onion_key(hs_cell_introduce_encrypted_t *inp)
+trn_cell_introduce_encrypted_getarray_onion_key(trn_cell_introduce_encrypted_t *inp)
{
return inp->onion_key.elts_;
}
const uint8_t *
-hs_cell_introduce_encrypted_getconstarray_onion_key(const hs_cell_introduce_encrypted_t *inp)
+trn_cell_introduce_encrypted_getconstarray_onion_key(const trn_cell_introduce_encrypted_t *inp)
{
- return (const uint8_t *)hs_cell_introduce_encrypted_getarray_onion_key((hs_cell_introduce_encrypted_t*)inp);
+ return (const uint8_t *)trn_cell_introduce_encrypted_getarray_onion_key((trn_cell_introduce_encrypted_t*)inp);
}
int
-hs_cell_introduce_encrypted_setlen_onion_key(hs_cell_introduce_encrypted_t *inp, size_t newlen)
+trn_cell_introduce_encrypted_setlen_onion_key(trn_cell_introduce_encrypted_t *inp, size_t newlen)
{
uint8_t *newptr;
#if UINT16_MAX < SIZE_MAX
@@ -923,49 +923,49 @@ hs_cell_introduce_encrypted_setlen_onion_key(hs_cell_introduce_encrypted_t *inp,
return -1;
}
uint8_t
-hs_cell_introduce_encrypted_get_nspec(const hs_cell_introduce_encrypted_t *inp)
+trn_cell_introduce_encrypted_get_nspec(const trn_cell_introduce_encrypted_t *inp)
{
return inp->nspec;
}
int
-hs_cell_introduce_encrypted_set_nspec(hs_cell_introduce_encrypted_t *inp, uint8_t val)
+trn_cell_introduce_encrypted_set_nspec(trn_cell_introduce_encrypted_t *inp, uint8_t val)
{
inp->nspec = val;
return 0;
}
size_t
-hs_cell_introduce_encrypted_getlen_nspecs(const hs_cell_introduce_encrypted_t *inp)
+trn_cell_introduce_encrypted_getlen_nspecs(const trn_cell_introduce_encrypted_t *inp)
{
return TRUNNEL_DYNARRAY_LEN(&inp->nspecs);
}
struct link_specifier_st *
-hs_cell_introduce_encrypted_get_nspecs(hs_cell_introduce_encrypted_t *inp, size_t idx)
+trn_cell_introduce_encrypted_get_nspecs(trn_cell_introduce_encrypted_t *inp, size_t idx)
{
return TRUNNEL_DYNARRAY_GET(&inp->nspecs, idx);
}
const struct link_specifier_st *
-hs_cell_introduce_encrypted_getconst_nspecs(const hs_cell_introduce_encrypted_t *inp, size_t idx)
+trn_cell_introduce_encrypted_getconst_nspecs(const trn_cell_introduce_encrypted_t *inp, size_t idx)
{
- return hs_cell_introduce_encrypted_get_nspecs((hs_cell_introduce_encrypted_t*)inp, idx);
+ return trn_cell_introduce_encrypted_get_nspecs((trn_cell_introduce_encrypted_t*)inp, idx);
}
int
-hs_cell_introduce_encrypted_set_nspecs(hs_cell_introduce_encrypted_t *inp, size_t idx, struct link_specifier_st * elt)
+trn_cell_introduce_encrypted_set_nspecs(trn_cell_introduce_encrypted_t *inp, size_t idx, struct link_specifier_st * elt)
{
link_specifier_t *oldval = TRUNNEL_DYNARRAY_GET(&inp->nspecs, idx);
if (oldval && oldval != elt)
link_specifier_free(oldval);
- return hs_cell_introduce_encrypted_set0_nspecs(inp, idx, elt);
+ return trn_cell_introduce_encrypted_set0_nspecs(inp, idx, elt);
}
int
-hs_cell_introduce_encrypted_set0_nspecs(hs_cell_introduce_encrypted_t *inp, size_t idx, struct link_specifier_st * elt)
+trn_cell_introduce_encrypted_set0_nspecs(trn_cell_introduce_encrypted_t *inp, size_t idx, struct link_specifier_st * elt)
{
TRUNNEL_DYNARRAY_SET(&inp->nspecs, idx, elt);
return 0;
}
int
-hs_cell_introduce_encrypted_add_nspecs(hs_cell_introduce_encrypted_t *inp, struct link_specifier_st * elt)
+trn_cell_introduce_encrypted_add_nspecs(trn_cell_introduce_encrypted_t *inp, struct link_specifier_st * elt)
{
#if SIZE_MAX >= UINT8_MAX
if (inp->nspecs.n_ == UINT8_MAX)
@@ -979,17 +979,17 @@ hs_cell_introduce_encrypted_add_nspecs(hs_cell_introduce_encrypted_t *inp, struc
}
struct link_specifier_st * *
-hs_cell_introduce_encrypted_getarray_nspecs(hs_cell_introduce_encrypted_t *inp)
+trn_cell_introduce_encrypted_getarray_nspecs(trn_cell_introduce_encrypted_t *inp)
{
return inp->nspecs.elts_;
}
const struct link_specifier_st * const *
-hs_cell_introduce_encrypted_getconstarray_nspecs(const hs_cell_introduce_encrypted_t *inp)
+trn_cell_introduce_encrypted_getconstarray_nspecs(const trn_cell_introduce_encrypted_t *inp)
{
- return (const struct link_specifier_st * const *)hs_cell_introduce_encrypted_getarray_nspecs((hs_cell_introduce_encrypted_t*)inp);
+ return (const struct link_specifier_st * const *)trn_cell_introduce_encrypted_getarray_nspecs((trn_cell_introduce_encrypted_t*)inp);
}
int
-hs_cell_introduce_encrypted_setlen_nspecs(hs_cell_introduce_encrypted_t *inp, size_t newlen)
+trn_cell_introduce_encrypted_setlen_nspecs(trn_cell_introduce_encrypted_t *inp, size_t newlen)
{
struct link_specifier_st * *newptr;
#if UINT8_MAX < SIZE_MAX
@@ -1009,30 +1009,30 @@ hs_cell_introduce_encrypted_setlen_nspecs(hs_cell_introduce_encrypted_t *inp, si
return -1;
}
size_t
-hs_cell_introduce_encrypted_getlen_pad(const hs_cell_introduce_encrypted_t *inp)
+trn_cell_introduce_encrypted_getlen_pad(const trn_cell_introduce_encrypted_t *inp)
{
return TRUNNEL_DYNARRAY_LEN(&inp->pad);
}
uint8_t
-hs_cell_introduce_encrypted_get_pad(hs_cell_introduce_encrypted_t *inp, size_t idx)
+trn_cell_introduce_encrypted_get_pad(trn_cell_introduce_encrypted_t *inp, size_t idx)
{
return TRUNNEL_DYNARRAY_GET(&inp->pad, idx);
}
uint8_t
-hs_cell_introduce_encrypted_getconst_pad(const hs_cell_introduce_encrypted_t *inp, size_t idx)
+trn_cell_introduce_encrypted_getconst_pad(const trn_cell_introduce_encrypted_t *inp, size_t idx)
{
- return hs_cell_introduce_encrypted_get_pad((hs_cell_introduce_encrypted_t*)inp, idx);
+ return trn_cell_introduce_encrypted_get_pad((trn_cell_introduce_encrypted_t*)inp, idx);
}
int
-hs_cell_introduce_encrypted_set_pad(hs_cell_introduce_encrypted_t *inp, size_t idx, uint8_t elt)
+trn_cell_introduce_encrypted_set_pad(trn_cell_introduce_encrypted_t *inp, size_t idx, uint8_t elt)
{
TRUNNEL_DYNARRAY_SET(&inp->pad, idx, elt);
return 0;
}
int
-hs_cell_introduce_encrypted_add_pad(hs_cell_introduce_encrypted_t *inp, uint8_t elt)
+trn_cell_introduce_encrypted_add_pad(trn_cell_introduce_encrypted_t *inp, uint8_t elt)
{
TRUNNEL_DYNARRAY_ADD(uint8_t, &inp->pad, elt, {});
return 0;
@@ -1042,17 +1042,17 @@ hs_cell_introduce_encrypted_add_pad(hs_cell_introduce_encrypted_t *inp, uint8_t
}
uint8_t *
-hs_cell_introduce_encrypted_getarray_pad(hs_cell_introduce_encrypted_t *inp)
+trn_cell_introduce_encrypted_getarray_pad(trn_cell_introduce_encrypted_t *inp)
{
return inp->pad.elts_;
}
const uint8_t *
-hs_cell_introduce_encrypted_getconstarray_pad(const hs_cell_introduce_encrypted_t *inp)
+trn_cell_introduce_encrypted_getconstarray_pad(const trn_cell_introduce_encrypted_t *inp)
{
- return (const uint8_t *)hs_cell_introduce_encrypted_getarray_pad((hs_cell_introduce_encrypted_t*)inp);
+ return (const uint8_t *)trn_cell_introduce_encrypted_getarray_pad((trn_cell_introduce_encrypted_t*)inp);
}
int
-hs_cell_introduce_encrypted_setlen_pad(hs_cell_introduce_encrypted_t *inp, size_t newlen)
+trn_cell_introduce_encrypted_setlen_pad(trn_cell_introduce_encrypted_t *inp, size_t newlen)
{
uint8_t *newptr;
newptr = trunnel_dynarray_setlen(&inp->pad.allocated_,
@@ -1068,7 +1068,7 @@ hs_cell_introduce_encrypted_setlen_pad(hs_cell_introduce_encrypted_t *inp, size_
return -1;
}
const char *
-hs_cell_introduce_encrypted_check(const hs_cell_introduce_encrypted_t *obj)
+trn_cell_introduce_encrypted_check(const trn_cell_introduce_encrypted_t *obj)
{
if (obj == NULL)
return "Object was NULL";
@@ -1076,7 +1076,7 @@ hs_cell_introduce_encrypted_check(const hs_cell_introduce_encrypted_t *obj)
return "A set function failed on this object";
{
const char *msg;
- if (NULL != (msg = cell_extension_check(obj->extensions)))
+ if (NULL != (msg = trn_cell_extension_check(obj->extensions)))
return msg;
}
if (! (obj->onion_key_type == 1))
@@ -1098,19 +1098,19 @@ hs_cell_introduce_encrypted_check(const hs_cell_introduce_encrypted_t *obj)
}
ssize_t
-hs_cell_introduce_encrypted_encoded_len(const hs_cell_introduce_encrypted_t *obj)
+trn_cell_introduce_encrypted_encoded_len(const trn_cell_introduce_encrypted_t *obj)
{
ssize_t result = 0;
- if (NULL != hs_cell_introduce_encrypted_check(obj))
+ if (NULL != trn_cell_introduce_encrypted_check(obj))
return -1;
/* Length of u8 rend_cookie[TRUNNEL_REND_COOKIE_LEN] */
result += TRUNNEL_REND_COOKIE_LEN;
- /* Length of struct cell_extension extensions */
- result += cell_extension_encoded_len(obj->extensions);
+ /* Length of struct trn_cell_extension extensions */
+ result += trn_cell_extension_encoded_len(obj->extensions);
/* Length of u8 onion_key_type IN [1] */
result += 1;
@@ -1138,24 +1138,24 @@ hs_cell_introduce_encrypted_encoded_len(const hs_cell_introduce_encrypted_t *obj
return result;
}
int
-hs_cell_introduce_encrypted_clear_errors(hs_cell_introduce_encrypted_t *obj)
+trn_cell_introduce_encrypted_clear_errors(trn_cell_introduce_encrypted_t *obj)
{
int r = obj->trunnel_error_code_;
obj->trunnel_error_code_ = 0;
return r;
}
ssize_t
-hs_cell_introduce_encrypted_encode(uint8_t *output, const size_t avail, const hs_cell_introduce_encrypted_t *obj)
+trn_cell_introduce_encrypted_encode(uint8_t *output, const size_t avail, const trn_cell_introduce_encrypted_t *obj)
{
ssize_t result = 0;
size_t written = 0;
uint8_t *ptr = output;
const char *msg;
#ifdef TRUNNEL_CHECK_ENCODED_LEN
- const ssize_t encoded_len = hs_cell_introduce_encrypted_encoded_len(obj);
+ const ssize_t encoded_len = trn_cell_introduce_encrypted_encoded_len(obj);
#endif
- if (NULL != (msg = hs_cell_introduce_encrypted_check(obj)))
+ if (NULL != (msg = trn_cell_introduce_encrypted_check(obj)))
goto check_failed;
#ifdef TRUNNEL_CHECK_ENCODED_LEN
@@ -1169,9 +1169,9 @@ hs_cell_introduce_encrypted_encode(uint8_t *output, const size_t avail, const hs
memcpy(ptr, obj->rend_cookie, TRUNNEL_REND_COOKIE_LEN);
written += TRUNNEL_REND_COOKIE_LEN; ptr += TRUNNEL_REND_COOKIE_LEN;
- /* Encode struct cell_extension extensions */
+ /* Encode struct trn_cell_extension extensions */
trunnel_assert(written <= avail);
- result = cell_extension_encode(ptr, avail - written, obj->extensions);
+ result = trn_cell_extension_encode(ptr, avail - written, obj->extensions);
if (result < 0)
goto fail; /* XXXXXXX !*/
written += result; ptr += result;
@@ -1257,11 +1257,11 @@ hs_cell_introduce_encrypted_encode(uint8_t *output, const size_t avail, const hs
return result;
}
-/** As hs_cell_introduce_encrypted_parse(), but do not allocate the
+/** As trn_cell_introduce_encrypted_parse(), but do not allocate the
* output object.
*/
static ssize_t
-hs_cell_introduce_encrypted_parse_into(hs_cell_introduce_encrypted_t *obj, const uint8_t *input, const size_t len_in)
+trn_cell_introduce_encrypted_parse_into(trn_cell_introduce_encrypted_t *obj, const uint8_t *input, const size_t len_in)
{
const uint8_t *ptr = input;
size_t remaining = len_in;
@@ -1273,8 +1273,8 @@ hs_cell_introduce_encrypted_parse_into(hs_cell_introduce_encrypted_t *obj, const
memcpy(obj->rend_cookie, ptr, TRUNNEL_REND_COOKIE_LEN);
remaining -= TRUNNEL_REND_COOKIE_LEN; ptr += TRUNNEL_REND_COOKIE_LEN;
- /* Parse struct cell_extension extensions */
- result = cell_extension_parse(&obj->extensions, ptr, remaining);
+ /* Parse struct trn_cell_extension extensions */
+ result = trn_cell_extension_parse(&obj->extensions, ptr, remaining);
if (result < 0)
goto relay_fail;
trunnel_assert((size_t)result <= remaining);
@@ -1342,15 +1342,15 @@ hs_cell_introduce_encrypted_parse_into(hs_cell_introduce_encrypted_t *obj, const
}
ssize_t
-hs_cell_introduce_encrypted_parse(hs_cell_introduce_encrypted_t **output, const uint8_t *input, const size_t len_in)
+trn_cell_introduce_encrypted_parse(trn_cell_introduce_encrypted_t **output, const uint8_t *input, const size_t len_in)
{
ssize_t result;
- *output = hs_cell_introduce_encrypted_new();
+ *output = trn_cell_introduce_encrypted_new();
if (NULL == *output)
return -1;
- result = hs_cell_introduce_encrypted_parse_into(*output, input, len_in);
+ result = trn_cell_introduce_encrypted_parse_into(*output, input, len_in);
if (result < 0) {
- hs_cell_introduce_encrypted_free(*output);
+ trn_cell_introduce_encrypted_free(*output);
*output = NULL;
}
return result;
diff --git a/src/trunnel/hs/cell_introduce1.h b/src/trunnel/hs/cell_introduce1.h
index ccd2cda904..cca825a431 100644
--- a/src/trunnel/hs/cell_introduce1.h
+++ b/src/trunnel/hs/cell_introduce1.h
@@ -8,34 +8,34 @@
#include <stdint.h>
#include "trunnel.h"
-struct cell_extension_st;
+struct trn_cell_extension_st;
struct link_specifier_st;
#define TRUNNEL_SHA1_LEN 20
#define TRUNNEL_REND_COOKIE_LEN 20
-#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_HS_CELL_INTRODUCE1)
-struct hs_cell_introduce1_st {
+#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_TRN_CELL_INTRODUCE1)
+struct trn_cell_introduce1_st {
uint8_t legacy_key_id[TRUNNEL_SHA1_LEN];
uint8_t auth_key_type;
uint16_t auth_key_len;
TRUNNEL_DYNARRAY_HEAD(, uint8_t) auth_key;
- struct cell_extension_st *extensions;
+ struct trn_cell_extension_st *extensions;
TRUNNEL_DYNARRAY_HEAD(, uint8_t) encrypted;
uint8_t trunnel_error_code_;
};
#endif
-typedef struct hs_cell_introduce1_st hs_cell_introduce1_t;
-#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_HS_CELL_INTRODUCE_ACK)
-struct hs_cell_introduce_ack_st {
+typedef struct trn_cell_introduce1_st trn_cell_introduce1_t;
+#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_TRN_CELL_INTRODUCE_ACK)
+struct trn_cell_introduce_ack_st {
uint16_t status;
- struct cell_extension_st *extensions;
+ struct trn_cell_extension_st *extensions;
uint8_t trunnel_error_code_;
};
#endif
-typedef struct hs_cell_introduce_ack_st hs_cell_introduce_ack_t;
-#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_HS_CELL_INTRODUCE_ENCRYPTED)
-struct hs_cell_introduce_encrypted_st {
+typedef struct trn_cell_introduce_ack_st trn_cell_introduce_ack_t;
+#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_TRN_CELL_INTRODUCE_ENCRYPTED)
+struct trn_cell_introduce_encrypted_st {
uint8_t rend_cookie[TRUNNEL_REND_COOKIE_LEN];
- struct cell_extension_st *extensions;
+ struct trn_cell_extension_st *extensions;
uint8_t onion_key_type;
uint16_t onion_key_len;
TRUNNEL_DYNARRAY_HEAD(, uint8_t) onion_key;
@@ -45,449 +45,449 @@ struct hs_cell_introduce_encrypted_st {
uint8_t trunnel_error_code_;
};
#endif
-typedef struct hs_cell_introduce_encrypted_st hs_cell_introduce_encrypted_t;
-/** Return a newly allocated hs_cell_introduce1 with all elements set
+typedef struct trn_cell_introduce_encrypted_st trn_cell_introduce_encrypted_t;
+/** Return a newly allocated trn_cell_introduce1 with all elements set
* to zero.
*/
-hs_cell_introduce1_t *hs_cell_introduce1_new(void);
-/** Release all storage held by the hs_cell_introduce1 in 'victim'.
+trn_cell_introduce1_t *trn_cell_introduce1_new(void);
+/** Release all storage held by the trn_cell_introduce1 in 'victim'.
* (Do nothing if 'victim' is NULL.)
*/
-void hs_cell_introduce1_free(hs_cell_introduce1_t *victim);
-/** Try to parse a hs_cell_introduce1 from the buffer in 'input',
+void trn_cell_introduce1_free(trn_cell_introduce1_t *victim);
+/** Try to parse a trn_cell_introduce1 from the buffer in 'input',
* using up to 'len_in' bytes from the input buffer. On success,
* return the number of bytes consumed and set *output to the newly
- * allocated hs_cell_introduce1_t. On failure, return -2 if the input
+ * allocated trn_cell_introduce1_t. On failure, return -2 if the input
* appears truncated, and -1 if the input is otherwise invalid.
*/
-ssize_t hs_cell_introduce1_parse(hs_cell_introduce1_t **output, const uint8_t *input, const size_t len_in);
+ssize_t trn_cell_introduce1_parse(trn_cell_introduce1_t **output, const uint8_t *input, const size_t len_in);
/** Return the number of bytes we expect to need to encode the
- * hs_cell_introduce1 in 'obj'. On failure, return a negative value.
+ * trn_cell_introduce1 in 'obj'. On failure, return a negative value.
* Note that this value may be an overestimate, and can even be an
* underestimate for certain unencodeable objects.
*/
-ssize_t hs_cell_introduce1_encoded_len(const hs_cell_introduce1_t *obj);
-/** Try to encode the hs_cell_introduce1 from 'input' into the buffer
+ssize_t trn_cell_introduce1_encoded_len(const trn_cell_introduce1_t *obj);
+/** Try to encode the trn_cell_introduce1 from 'input' into the buffer
* at 'output', using up to 'avail' bytes of the output buffer. On
* success, return the number of bytes used. On failure, return -2 if
* the buffer was not long enough, and -1 if the input was invalid.
*/
-ssize_t hs_cell_introduce1_encode(uint8_t *output, size_t avail, const hs_cell_introduce1_t *input);
-/** Check whether the internal state of the hs_cell_introduce1 in
+ssize_t trn_cell_introduce1_encode(uint8_t *output, size_t avail, const trn_cell_introduce1_t *input);
+/** Check whether the internal state of the trn_cell_introduce1 in
* 'obj' is consistent. Return NULL if it is, and a short message if
* it is not.
*/
-const char *hs_cell_introduce1_check(const hs_cell_introduce1_t *obj);
+const char *trn_cell_introduce1_check(const trn_cell_introduce1_t *obj);
/** Clear any errors that were set on the object 'obj' by its setter
* functions. Return true iff errors were cleared.
*/
-int hs_cell_introduce1_clear_errors(hs_cell_introduce1_t *obj);
+int trn_cell_introduce1_clear_errors(trn_cell_introduce1_t *obj);
/** Return the (constant) length of the array holding the
- * legacy_key_id field of the hs_cell_introduce1_t in 'inp'.
+ * legacy_key_id field of the trn_cell_introduce1_t in 'inp'.
*/
-size_t hs_cell_introduce1_getlen_legacy_key_id(const hs_cell_introduce1_t *inp);
+size_t trn_cell_introduce1_getlen_legacy_key_id(const trn_cell_introduce1_t *inp);
/** Return the element at position 'idx' of the fixed array field
- * legacy_key_id of the hs_cell_introduce1_t in 'inp'.
+ * legacy_key_id of the trn_cell_introduce1_t in 'inp'.
*/
-uint8_t hs_cell_introduce1_get_legacy_key_id(hs_cell_introduce1_t *inp, size_t idx);
-/** As hs_cell_introduce1_get_legacy_key_id, but take and return a
+uint8_t trn_cell_introduce1_get_legacy_key_id(trn_cell_introduce1_t *inp, size_t idx);
+/** As trn_cell_introduce1_get_legacy_key_id, but take and return a
* const pointer
*/
-uint8_t hs_cell_introduce1_getconst_legacy_key_id(const hs_cell_introduce1_t *inp, size_t idx);
+uint8_t trn_cell_introduce1_getconst_legacy_key_id(const trn_cell_introduce1_t *inp, size_t idx);
/** Change the element at position 'idx' of the fixed array field
- * legacy_key_id of the hs_cell_introduce1_t in 'inp', so that it will
- * hold the value 'elt'.
+ * legacy_key_id of the trn_cell_introduce1_t in 'inp', so that it
+ * will hold the value 'elt'.
*/
-int hs_cell_introduce1_set_legacy_key_id(hs_cell_introduce1_t *inp, size_t idx, uint8_t elt);
+int trn_cell_introduce1_set_legacy_key_id(trn_cell_introduce1_t *inp, size_t idx, uint8_t elt);
/** Return a pointer to the TRUNNEL_SHA1_LEN-element array field
* legacy_key_id of 'inp'.
*/
-uint8_t * hs_cell_introduce1_getarray_legacy_key_id(hs_cell_introduce1_t *inp);
-/** As hs_cell_introduce1_get_legacy_key_id, but take and return a
+uint8_t * trn_cell_introduce1_getarray_legacy_key_id(trn_cell_introduce1_t *inp);
+/** As trn_cell_introduce1_get_legacy_key_id, but take and return a
* const pointer
*/
-const uint8_t * hs_cell_introduce1_getconstarray_legacy_key_id(const hs_cell_introduce1_t *inp);
+const uint8_t * trn_cell_introduce1_getconstarray_legacy_key_id(const trn_cell_introduce1_t *inp);
/** Return the value of the auth_key_type field of the
- * hs_cell_introduce1_t in 'inp'
+ * trn_cell_introduce1_t in 'inp'
*/
-uint8_t hs_cell_introduce1_get_auth_key_type(const hs_cell_introduce1_t *inp);
+uint8_t trn_cell_introduce1_get_auth_key_type(const trn_cell_introduce1_t *inp);
/** Set the value of the auth_key_type field of the
- * hs_cell_introduce1_t in 'inp' to 'val'. Return 0 on success; return
- * -1 and set the error code on 'inp' on failure.
+ * trn_cell_introduce1_t in 'inp' to 'val'. Return 0 on success;
+ * return -1 and set the error code on 'inp' on failure.
*/
-int hs_cell_introduce1_set_auth_key_type(hs_cell_introduce1_t *inp, uint8_t val);
+int trn_cell_introduce1_set_auth_key_type(trn_cell_introduce1_t *inp, uint8_t val);
/** Return the value of the auth_key_len field of the
- * hs_cell_introduce1_t in 'inp'
+ * trn_cell_introduce1_t in 'inp'
*/
-uint16_t hs_cell_introduce1_get_auth_key_len(const hs_cell_introduce1_t *inp);
+uint16_t trn_cell_introduce1_get_auth_key_len(const trn_cell_introduce1_t *inp);
/** Set the value of the auth_key_len field of the
- * hs_cell_introduce1_t in 'inp' to 'val'. Return 0 on success; return
- * -1 and set the error code on 'inp' on failure.
+ * trn_cell_introduce1_t in 'inp' to 'val'. Return 0 on success;
+ * return -1 and set the error code on 'inp' on failure.
*/
-int hs_cell_introduce1_set_auth_key_len(hs_cell_introduce1_t *inp, uint16_t val);
+int trn_cell_introduce1_set_auth_key_len(trn_cell_introduce1_t *inp, uint16_t val);
/** Return the length of the dynamic array holding the auth_key field
- * of the hs_cell_introduce1_t in 'inp'.
+ * of the trn_cell_introduce1_t in 'inp'.
*/
-size_t hs_cell_introduce1_getlen_auth_key(const hs_cell_introduce1_t *inp);
+size_t trn_cell_introduce1_getlen_auth_key(const trn_cell_introduce1_t *inp);
/** Return the element at position 'idx' of the dynamic array field
- * auth_key of the hs_cell_introduce1_t in 'inp'.
+ * auth_key of the trn_cell_introduce1_t in 'inp'.
*/
-uint8_t hs_cell_introduce1_get_auth_key(hs_cell_introduce1_t *inp, size_t idx);
-/** As hs_cell_introduce1_get_auth_key, but take and return a const
+uint8_t trn_cell_introduce1_get_auth_key(trn_cell_introduce1_t *inp, size_t idx);
+/** As trn_cell_introduce1_get_auth_key, but take and return a const
* pointer
*/
-uint8_t hs_cell_introduce1_getconst_auth_key(const hs_cell_introduce1_t *inp, size_t idx);
+uint8_t trn_cell_introduce1_getconst_auth_key(const trn_cell_introduce1_t *inp, size_t idx);
/** Change the element at position 'idx' of the dynamic array field
- * auth_key of the hs_cell_introduce1_t in 'inp', so that it will hold
- * the value 'elt'.
+ * auth_key of the trn_cell_introduce1_t in 'inp', so that it will
+ * hold the value 'elt'.
*/
-int hs_cell_introduce1_set_auth_key(hs_cell_introduce1_t *inp, size_t idx, uint8_t elt);
+int trn_cell_introduce1_set_auth_key(trn_cell_introduce1_t *inp, size_t idx, uint8_t elt);
/** Append a new element 'elt' to the dynamic array field auth_key of
- * the hs_cell_introduce1_t in 'inp'.
+ * the trn_cell_introduce1_t in 'inp'.
*/
-int hs_cell_introduce1_add_auth_key(hs_cell_introduce1_t *inp, uint8_t elt);
+int trn_cell_introduce1_add_auth_key(trn_cell_introduce1_t *inp, uint8_t elt);
/** Return a pointer to the variable-length array field auth_key of
* 'inp'.
*/
-uint8_t * hs_cell_introduce1_getarray_auth_key(hs_cell_introduce1_t *inp);
-/** As hs_cell_introduce1_get_auth_key, but take and return a const
+uint8_t * trn_cell_introduce1_getarray_auth_key(trn_cell_introduce1_t *inp);
+/** As trn_cell_introduce1_get_auth_key, but take and return a const
* pointer
*/
-const uint8_t * hs_cell_introduce1_getconstarray_auth_key(const hs_cell_introduce1_t *inp);
+const uint8_t * trn_cell_introduce1_getconstarray_auth_key(const trn_cell_introduce1_t *inp);
/** Change the length of the variable-length array field auth_key of
* 'inp' to 'newlen'.Fill extra elements with 0. Return 0 on success;
* return -1 and set the error code on 'inp' on failure.
*/
-int hs_cell_introduce1_setlen_auth_key(hs_cell_introduce1_t *inp, size_t newlen);
+int trn_cell_introduce1_setlen_auth_key(trn_cell_introduce1_t *inp, size_t newlen);
/** Return the value of the extensions field of the
- * hs_cell_introduce1_t in 'inp'
+ * trn_cell_introduce1_t in 'inp'
*/
-struct cell_extension_st * hs_cell_introduce1_get_extensions(hs_cell_introduce1_t *inp);
-/** As hs_cell_introduce1_get_extensions, but take and return a const
+struct trn_cell_extension_st * trn_cell_introduce1_get_extensions(trn_cell_introduce1_t *inp);
+/** As trn_cell_introduce1_get_extensions, but take and return a const
* pointer
*/
-const struct cell_extension_st * hs_cell_introduce1_getconst_extensions(const hs_cell_introduce1_t *inp);
-/** Set the value of the extensions field of the hs_cell_introduce1_t
+const struct trn_cell_extension_st * trn_cell_introduce1_getconst_extensions(const trn_cell_introduce1_t *inp);
+/** Set the value of the extensions field of the trn_cell_introduce1_t
* in 'inp' to 'val'. Free the old value if any. Steals the
* referenceto 'val'.Return 0 on success; return -1 and set the error
* code on 'inp' on failure.
*/
-int hs_cell_introduce1_set_extensions(hs_cell_introduce1_t *inp, struct cell_extension_st *val);
-/** As hs_cell_introduce1_set_extensions, but does not free the
+int trn_cell_introduce1_set_extensions(trn_cell_introduce1_t *inp, struct trn_cell_extension_st *val);
+/** As trn_cell_introduce1_set_extensions, but does not free the
* previous value.
*/
-int hs_cell_introduce1_set0_extensions(hs_cell_introduce1_t *inp, struct cell_extension_st *val);
+int trn_cell_introduce1_set0_extensions(trn_cell_introduce1_t *inp, struct trn_cell_extension_st *val);
/** Return the length of the dynamic array holding the encrypted field
- * of the hs_cell_introduce1_t in 'inp'.
+ * of the trn_cell_introduce1_t in 'inp'.
*/
-size_t hs_cell_introduce1_getlen_encrypted(const hs_cell_introduce1_t *inp);
+size_t trn_cell_introduce1_getlen_encrypted(const trn_cell_introduce1_t *inp);
/** Return the element at position 'idx' of the dynamic array field
- * encrypted of the hs_cell_introduce1_t in 'inp'.
+ * encrypted of the trn_cell_introduce1_t in 'inp'.
*/
-uint8_t hs_cell_introduce1_get_encrypted(hs_cell_introduce1_t *inp, size_t idx);
-/** As hs_cell_introduce1_get_encrypted, but take and return a const
+uint8_t trn_cell_introduce1_get_encrypted(trn_cell_introduce1_t *inp, size_t idx);
+/** As trn_cell_introduce1_get_encrypted, but take and return a const
* pointer
*/
-uint8_t hs_cell_introduce1_getconst_encrypted(const hs_cell_introduce1_t *inp, size_t idx);
+uint8_t trn_cell_introduce1_getconst_encrypted(const trn_cell_introduce1_t *inp, size_t idx);
/** Change the element at position 'idx' of the dynamic array field
- * encrypted of the hs_cell_introduce1_t in 'inp', so that it will
+ * encrypted of the trn_cell_introduce1_t in 'inp', so that it will
* hold the value 'elt'.
*/
-int hs_cell_introduce1_set_encrypted(hs_cell_introduce1_t *inp, size_t idx, uint8_t elt);
+int trn_cell_introduce1_set_encrypted(trn_cell_introduce1_t *inp, size_t idx, uint8_t elt);
/** Append a new element 'elt' to the dynamic array field encrypted of
- * the hs_cell_introduce1_t in 'inp'.
+ * the trn_cell_introduce1_t in 'inp'.
*/
-int hs_cell_introduce1_add_encrypted(hs_cell_introduce1_t *inp, uint8_t elt);
+int trn_cell_introduce1_add_encrypted(trn_cell_introduce1_t *inp, uint8_t elt);
/** Return a pointer to the variable-length array field encrypted of
* 'inp'.
*/
-uint8_t * hs_cell_introduce1_getarray_encrypted(hs_cell_introduce1_t *inp);
-/** As hs_cell_introduce1_get_encrypted, but take and return a const
+uint8_t * trn_cell_introduce1_getarray_encrypted(trn_cell_introduce1_t *inp);
+/** As trn_cell_introduce1_get_encrypted, but take and return a const
* pointer
*/
-const uint8_t * hs_cell_introduce1_getconstarray_encrypted(const hs_cell_introduce1_t *inp);
+const uint8_t * trn_cell_introduce1_getconstarray_encrypted(const trn_cell_introduce1_t *inp);
/** Change the length of the variable-length array field encrypted of
* 'inp' to 'newlen'.Fill extra elements with 0. Return 0 on success;
* return -1 and set the error code on 'inp' on failure.
*/
-int hs_cell_introduce1_setlen_encrypted(hs_cell_introduce1_t *inp, size_t newlen);
-/** Return a newly allocated hs_cell_introduce_ack with all elements
+int trn_cell_introduce1_setlen_encrypted(trn_cell_introduce1_t *inp, size_t newlen);
+/** Return a newly allocated trn_cell_introduce_ack with all elements
* set to zero.
*/
-hs_cell_introduce_ack_t *hs_cell_introduce_ack_new(void);
-/** Release all storage held by the hs_cell_introduce_ack in 'victim'.
- * (Do nothing if 'victim' is NULL.)
+trn_cell_introduce_ack_t *trn_cell_introduce_ack_new(void);
+/** Release all storage held by the trn_cell_introduce_ack in
+ * 'victim'. (Do nothing if 'victim' is NULL.)
*/
-void hs_cell_introduce_ack_free(hs_cell_introduce_ack_t *victim);
-/** Try to parse a hs_cell_introduce_ack from the buffer in 'input',
+void trn_cell_introduce_ack_free(trn_cell_introduce_ack_t *victim);
+/** Try to parse a trn_cell_introduce_ack from the buffer in 'input',
* using up to 'len_in' bytes from the input buffer. On success,
* return the number of bytes consumed and set *output to the newly
- * allocated hs_cell_introduce_ack_t. On failure, return -2 if the
+ * allocated trn_cell_introduce_ack_t. On failure, return -2 if the
* input appears truncated, and -1 if the input is otherwise invalid.
*/
-ssize_t hs_cell_introduce_ack_parse(hs_cell_introduce_ack_t **output, const uint8_t *input, const size_t len_in);
+ssize_t trn_cell_introduce_ack_parse(trn_cell_introduce_ack_t **output, const uint8_t *input, const size_t len_in);
/** Return the number of bytes we expect to need to encode the
- * hs_cell_introduce_ack in 'obj'. On failure, return a negative
+ * trn_cell_introduce_ack in 'obj'. On failure, return a negative
* value. Note that this value may be an overestimate, and can even be
* an underestimate for certain unencodeable objects.
*/
-ssize_t hs_cell_introduce_ack_encoded_len(const hs_cell_introduce_ack_t *obj);
-/** Try to encode the hs_cell_introduce_ack from 'input' into the
+ssize_t trn_cell_introduce_ack_encoded_len(const trn_cell_introduce_ack_t *obj);
+/** Try to encode the trn_cell_introduce_ack from 'input' into the
* buffer at 'output', using up to 'avail' bytes of the output buffer.
* On success, return the number of bytes used. On failure, return -2
* if the buffer was not long enough, and -1 if the input was invalid.
*/
-ssize_t hs_cell_introduce_ack_encode(uint8_t *output, size_t avail, const hs_cell_introduce_ack_t *input);
-/** Check whether the internal state of the hs_cell_introduce_ack in
+ssize_t trn_cell_introduce_ack_encode(uint8_t *output, size_t avail, const trn_cell_introduce_ack_t *input);
+/** Check whether the internal state of the trn_cell_introduce_ack in
* 'obj' is consistent. Return NULL if it is, and a short message if
* it is not.
*/
-const char *hs_cell_introduce_ack_check(const hs_cell_introduce_ack_t *obj);
+const char *trn_cell_introduce_ack_check(const trn_cell_introduce_ack_t *obj);
/** Clear any errors that were set on the object 'obj' by its setter
* functions. Return true iff errors were cleared.
*/
-int hs_cell_introduce_ack_clear_errors(hs_cell_introduce_ack_t *obj);
+int trn_cell_introduce_ack_clear_errors(trn_cell_introduce_ack_t *obj);
/** Return the value of the status field of the
- * hs_cell_introduce_ack_t in 'inp'
+ * trn_cell_introduce_ack_t in 'inp'
*/
-uint16_t hs_cell_introduce_ack_get_status(const hs_cell_introduce_ack_t *inp);
-/** Set the value of the status field of the hs_cell_introduce_ack_t
+uint16_t trn_cell_introduce_ack_get_status(const trn_cell_introduce_ack_t *inp);
+/** Set the value of the status field of the trn_cell_introduce_ack_t
* in 'inp' to 'val'. Return 0 on success; return -1 and set the error
* code on 'inp' on failure.
*/
-int hs_cell_introduce_ack_set_status(hs_cell_introduce_ack_t *inp, uint16_t val);
+int trn_cell_introduce_ack_set_status(trn_cell_introduce_ack_t *inp, uint16_t val);
/** Return the value of the extensions field of the
- * hs_cell_introduce_ack_t in 'inp'
+ * trn_cell_introduce_ack_t in 'inp'
*/
-struct cell_extension_st * hs_cell_introduce_ack_get_extensions(hs_cell_introduce_ack_t *inp);
-/** As hs_cell_introduce_ack_get_extensions, but take and return a
+struct trn_cell_extension_st * trn_cell_introduce_ack_get_extensions(trn_cell_introduce_ack_t *inp);
+/** As trn_cell_introduce_ack_get_extensions, but take and return a
* const pointer
*/
-const struct cell_extension_st * hs_cell_introduce_ack_getconst_extensions(const hs_cell_introduce_ack_t *inp);
+const struct trn_cell_extension_st * trn_cell_introduce_ack_getconst_extensions(const trn_cell_introduce_ack_t *inp);
/** Set the value of the extensions field of the
- * hs_cell_introduce_ack_t in 'inp' to 'val'. Free the old value if
+ * trn_cell_introduce_ack_t in 'inp' to 'val'. Free the old value if
* any. Steals the referenceto 'val'.Return 0 on success; return -1
* and set the error code on 'inp' on failure.
*/
-int hs_cell_introduce_ack_set_extensions(hs_cell_introduce_ack_t *inp, struct cell_extension_st *val);
-/** As hs_cell_introduce_ack_set_extensions, but does not free the
+int trn_cell_introduce_ack_set_extensions(trn_cell_introduce_ack_t *inp, struct trn_cell_extension_st *val);
+/** As trn_cell_introduce_ack_set_extensions, but does not free the
* previous value.
*/
-int hs_cell_introduce_ack_set0_extensions(hs_cell_introduce_ack_t *inp, struct cell_extension_st *val);
-/** Return a newly allocated hs_cell_introduce_encrypted with all
+int trn_cell_introduce_ack_set0_extensions(trn_cell_introduce_ack_t *inp, struct trn_cell_extension_st *val);
+/** Return a newly allocated trn_cell_introduce_encrypted with all
* elements set to zero.
*/
-hs_cell_introduce_encrypted_t *hs_cell_introduce_encrypted_new(void);
-/** Release all storage held by the hs_cell_introduce_encrypted in
+trn_cell_introduce_encrypted_t *trn_cell_introduce_encrypted_new(void);
+/** Release all storage held by the trn_cell_introduce_encrypted in
* 'victim'. (Do nothing if 'victim' is NULL.)
*/
-void hs_cell_introduce_encrypted_free(hs_cell_introduce_encrypted_t *victim);
-/** Try to parse a hs_cell_introduce_encrypted from the buffer in
+void trn_cell_introduce_encrypted_free(trn_cell_introduce_encrypted_t *victim);
+/** Try to parse a trn_cell_introduce_encrypted from the buffer in
* 'input', using up to 'len_in' bytes from the input buffer. On
* success, return the number of bytes consumed and set *output to the
- * newly allocated hs_cell_introduce_encrypted_t. On failure, return
+ * newly allocated trn_cell_introduce_encrypted_t. On failure, return
* -2 if the input appears truncated, and -1 if the input is otherwise
* invalid.
*/
-ssize_t hs_cell_introduce_encrypted_parse(hs_cell_introduce_encrypted_t **output, const uint8_t *input, const size_t len_in);
+ssize_t trn_cell_introduce_encrypted_parse(trn_cell_introduce_encrypted_t **output, const uint8_t *input, const size_t len_in);
/** Return the number of bytes we expect to need to encode the
- * hs_cell_introduce_encrypted in 'obj'. On failure, return a negative
- * value. Note that this value may be an overestimate, and can even be
- * an underestimate for certain unencodeable objects.
+ * trn_cell_introduce_encrypted in 'obj'. On failure, return a
+ * negative value. Note that this value may be an overestimate, and
+ * can even be an underestimate for certain unencodeable objects.
*/
-ssize_t hs_cell_introduce_encrypted_encoded_len(const hs_cell_introduce_encrypted_t *obj);
-/** Try to encode the hs_cell_introduce_encrypted from 'input' into
+ssize_t trn_cell_introduce_encrypted_encoded_len(const trn_cell_introduce_encrypted_t *obj);
+/** Try to encode the trn_cell_introduce_encrypted from 'input' into
* the buffer at 'output', using up to 'avail' bytes of the output
* buffer. On success, return the number of bytes used. On failure,
* return -2 if the buffer was not long enough, and -1 if the input
* was invalid.
*/
-ssize_t hs_cell_introduce_encrypted_encode(uint8_t *output, size_t avail, const hs_cell_introduce_encrypted_t *input);
+ssize_t trn_cell_introduce_encrypted_encode(uint8_t *output, size_t avail, const trn_cell_introduce_encrypted_t *input);
/** Check whether the internal state of the
- * hs_cell_introduce_encrypted in 'obj' is consistent. Return NULL if
+ * trn_cell_introduce_encrypted in 'obj' is consistent. Return NULL if
* it is, and a short message if it is not.
*/
-const char *hs_cell_introduce_encrypted_check(const hs_cell_introduce_encrypted_t *obj);
+const char *trn_cell_introduce_encrypted_check(const trn_cell_introduce_encrypted_t *obj);
/** Clear any errors that were set on the object 'obj' by its setter
* functions. Return true iff errors were cleared.
*/
-int hs_cell_introduce_encrypted_clear_errors(hs_cell_introduce_encrypted_t *obj);
+int trn_cell_introduce_encrypted_clear_errors(trn_cell_introduce_encrypted_t *obj);
/** Return the (constant) length of the array holding the rend_cookie
- * field of the hs_cell_introduce_encrypted_t in 'inp'.
+ * field of the trn_cell_introduce_encrypted_t in 'inp'.
*/
-size_t hs_cell_introduce_encrypted_getlen_rend_cookie(const hs_cell_introduce_encrypted_t *inp);
+size_t trn_cell_introduce_encrypted_getlen_rend_cookie(const trn_cell_introduce_encrypted_t *inp);
/** Return the element at position 'idx' of the fixed array field
- * rend_cookie of the hs_cell_introduce_encrypted_t in 'inp'.
+ * rend_cookie of the trn_cell_introduce_encrypted_t in 'inp'.
*/
-uint8_t hs_cell_introduce_encrypted_get_rend_cookie(hs_cell_introduce_encrypted_t *inp, size_t idx);
-/** As hs_cell_introduce_encrypted_get_rend_cookie, but take and
+uint8_t trn_cell_introduce_encrypted_get_rend_cookie(trn_cell_introduce_encrypted_t *inp, size_t idx);
+/** As trn_cell_introduce_encrypted_get_rend_cookie, but take and
* return a const pointer
*/
-uint8_t hs_cell_introduce_encrypted_getconst_rend_cookie(const hs_cell_introduce_encrypted_t *inp, size_t idx);
+uint8_t trn_cell_introduce_encrypted_getconst_rend_cookie(const trn_cell_introduce_encrypted_t *inp, size_t idx);
/** Change the element at position 'idx' of the fixed array field
- * rend_cookie of the hs_cell_introduce_encrypted_t in 'inp', so that
+ * rend_cookie of the trn_cell_introduce_encrypted_t in 'inp', so that
* it will hold the value 'elt'.
*/
-int hs_cell_introduce_encrypted_set_rend_cookie(hs_cell_introduce_encrypted_t *inp, size_t idx, uint8_t elt);
+int trn_cell_introduce_encrypted_set_rend_cookie(trn_cell_introduce_encrypted_t *inp, size_t idx, uint8_t elt);
/** Return a pointer to the TRUNNEL_REND_COOKIE_LEN-element array
* field rend_cookie of 'inp'.
*/
-uint8_t * hs_cell_introduce_encrypted_getarray_rend_cookie(hs_cell_introduce_encrypted_t *inp);
-/** As hs_cell_introduce_encrypted_get_rend_cookie, but take and
+uint8_t * trn_cell_introduce_encrypted_getarray_rend_cookie(trn_cell_introduce_encrypted_t *inp);
+/** As trn_cell_introduce_encrypted_get_rend_cookie, but take and
* return a const pointer
*/
-const uint8_t * hs_cell_introduce_encrypted_getconstarray_rend_cookie(const hs_cell_introduce_encrypted_t *inp);
+const uint8_t * trn_cell_introduce_encrypted_getconstarray_rend_cookie(const trn_cell_introduce_encrypted_t *inp);
/** Return the value of the extensions field of the
- * hs_cell_introduce_encrypted_t in 'inp'
+ * trn_cell_introduce_encrypted_t in 'inp'
*/
-struct cell_extension_st * hs_cell_introduce_encrypted_get_extensions(hs_cell_introduce_encrypted_t *inp);
-/** As hs_cell_introduce_encrypted_get_extensions, but take and return
- * a const pointer
+struct trn_cell_extension_st * trn_cell_introduce_encrypted_get_extensions(trn_cell_introduce_encrypted_t *inp);
+/** As trn_cell_introduce_encrypted_get_extensions, but take and
+ * return a const pointer
*/
-const struct cell_extension_st * hs_cell_introduce_encrypted_getconst_extensions(const hs_cell_introduce_encrypted_t *inp);
+const struct trn_cell_extension_st * trn_cell_introduce_encrypted_getconst_extensions(const trn_cell_introduce_encrypted_t *inp);
/** Set the value of the extensions field of the
- * hs_cell_introduce_encrypted_t in 'inp' to 'val'. Free the old value
- * if any. Steals the referenceto 'val'.Return 0 on success; return -1
- * and set the error code on 'inp' on failure.
+ * trn_cell_introduce_encrypted_t in 'inp' to 'val'. Free the old
+ * value if any. Steals the referenceto 'val'.Return 0 on success;
+ * return -1 and set the error code on 'inp' on failure.
*/
-int hs_cell_introduce_encrypted_set_extensions(hs_cell_introduce_encrypted_t *inp, struct cell_extension_st *val);
-/** As hs_cell_introduce_encrypted_set_extensions, but does not free
+int trn_cell_introduce_encrypted_set_extensions(trn_cell_introduce_encrypted_t *inp, struct trn_cell_extension_st *val);
+/** As trn_cell_introduce_encrypted_set_extensions, but does not free
* the previous value.
*/
-int hs_cell_introduce_encrypted_set0_extensions(hs_cell_introduce_encrypted_t *inp, struct cell_extension_st *val);
+int trn_cell_introduce_encrypted_set0_extensions(trn_cell_introduce_encrypted_t *inp, struct trn_cell_extension_st *val);
/** Return the value of the onion_key_type field of the
- * hs_cell_introduce_encrypted_t in 'inp'
+ * trn_cell_introduce_encrypted_t in 'inp'
*/
-uint8_t hs_cell_introduce_encrypted_get_onion_key_type(const hs_cell_introduce_encrypted_t *inp);
+uint8_t trn_cell_introduce_encrypted_get_onion_key_type(const trn_cell_introduce_encrypted_t *inp);
/** Set the value of the onion_key_type field of the
- * hs_cell_introduce_encrypted_t in 'inp' to 'val'. Return 0 on
+ * trn_cell_introduce_encrypted_t in 'inp' to 'val'. Return 0 on
* success; return -1 and set the error code on 'inp' on failure.
*/
-int hs_cell_introduce_encrypted_set_onion_key_type(hs_cell_introduce_encrypted_t *inp, uint8_t val);
+int trn_cell_introduce_encrypted_set_onion_key_type(trn_cell_introduce_encrypted_t *inp, uint8_t val);
/** Return the value of the onion_key_len field of the
- * hs_cell_introduce_encrypted_t in 'inp'
+ * trn_cell_introduce_encrypted_t in 'inp'
*/
-uint16_t hs_cell_introduce_encrypted_get_onion_key_len(const hs_cell_introduce_encrypted_t *inp);
+uint16_t trn_cell_introduce_encrypted_get_onion_key_len(const trn_cell_introduce_encrypted_t *inp);
/** Set the value of the onion_key_len field of the
- * hs_cell_introduce_encrypted_t in 'inp' to 'val'. Return 0 on
+ * trn_cell_introduce_encrypted_t in 'inp' to 'val'. Return 0 on
* success; return -1 and set the error code on 'inp' on failure.
*/
-int hs_cell_introduce_encrypted_set_onion_key_len(hs_cell_introduce_encrypted_t *inp, uint16_t val);
+int trn_cell_introduce_encrypted_set_onion_key_len(trn_cell_introduce_encrypted_t *inp, uint16_t val);
/** Return the length of the dynamic array holding the onion_key field
- * of the hs_cell_introduce_encrypted_t in 'inp'.
+ * of the trn_cell_introduce_encrypted_t in 'inp'.
*/
-size_t hs_cell_introduce_encrypted_getlen_onion_key(const hs_cell_introduce_encrypted_t *inp);
+size_t trn_cell_introduce_encrypted_getlen_onion_key(const trn_cell_introduce_encrypted_t *inp);
/** Return the element at position 'idx' of the dynamic array field
- * onion_key of the hs_cell_introduce_encrypted_t in 'inp'.
+ * onion_key of the trn_cell_introduce_encrypted_t in 'inp'.
*/
-uint8_t hs_cell_introduce_encrypted_get_onion_key(hs_cell_introduce_encrypted_t *inp, size_t idx);
-/** As hs_cell_introduce_encrypted_get_onion_key, but take and return
+uint8_t trn_cell_introduce_encrypted_get_onion_key(trn_cell_introduce_encrypted_t *inp, size_t idx);
+/** As trn_cell_introduce_encrypted_get_onion_key, but take and return
* a const pointer
*/
-uint8_t hs_cell_introduce_encrypted_getconst_onion_key(const hs_cell_introduce_encrypted_t *inp, size_t idx);
+uint8_t trn_cell_introduce_encrypted_getconst_onion_key(const trn_cell_introduce_encrypted_t *inp, size_t idx);
/** Change the element at position 'idx' of the dynamic array field
- * onion_key of the hs_cell_introduce_encrypted_t in 'inp', so that it
- * will hold the value 'elt'.
+ * onion_key of the trn_cell_introduce_encrypted_t in 'inp', so that
+ * it will hold the value 'elt'.
*/
-int hs_cell_introduce_encrypted_set_onion_key(hs_cell_introduce_encrypted_t *inp, size_t idx, uint8_t elt);
+int trn_cell_introduce_encrypted_set_onion_key(trn_cell_introduce_encrypted_t *inp, size_t idx, uint8_t elt);
/** Append a new element 'elt' to the dynamic array field onion_key of
- * the hs_cell_introduce_encrypted_t in 'inp'.
+ * the trn_cell_introduce_encrypted_t in 'inp'.
*/
-int hs_cell_introduce_encrypted_add_onion_key(hs_cell_introduce_encrypted_t *inp, uint8_t elt);
+int trn_cell_introduce_encrypted_add_onion_key(trn_cell_introduce_encrypted_t *inp, uint8_t elt);
/** Return a pointer to the variable-length array field onion_key of
* 'inp'.
*/
-uint8_t * hs_cell_introduce_encrypted_getarray_onion_key(hs_cell_introduce_encrypted_t *inp);
-/** As hs_cell_introduce_encrypted_get_onion_key, but take and return
+uint8_t * trn_cell_introduce_encrypted_getarray_onion_key(trn_cell_introduce_encrypted_t *inp);
+/** As trn_cell_introduce_encrypted_get_onion_key, but take and return
* a const pointer
*/
-const uint8_t * hs_cell_introduce_encrypted_getconstarray_onion_key(const hs_cell_introduce_encrypted_t *inp);
+const uint8_t * trn_cell_introduce_encrypted_getconstarray_onion_key(const trn_cell_introduce_encrypted_t *inp);
/** Change the length of the variable-length array field onion_key of
* 'inp' to 'newlen'.Fill extra elements with 0. Return 0 on success;
* return -1 and set the error code on 'inp' on failure.
*/
-int hs_cell_introduce_encrypted_setlen_onion_key(hs_cell_introduce_encrypted_t *inp, size_t newlen);
+int trn_cell_introduce_encrypted_setlen_onion_key(trn_cell_introduce_encrypted_t *inp, size_t newlen);
/** Return the value of the nspec field of the
- * hs_cell_introduce_encrypted_t in 'inp'
+ * trn_cell_introduce_encrypted_t in 'inp'
*/
-uint8_t hs_cell_introduce_encrypted_get_nspec(const hs_cell_introduce_encrypted_t *inp);
+uint8_t trn_cell_introduce_encrypted_get_nspec(const trn_cell_introduce_encrypted_t *inp);
/** Set the value of the nspec field of the
- * hs_cell_introduce_encrypted_t in 'inp' to 'val'. Return 0 on
+ * trn_cell_introduce_encrypted_t in 'inp' to 'val'. Return 0 on
* success; return -1 and set the error code on 'inp' on failure.
*/
-int hs_cell_introduce_encrypted_set_nspec(hs_cell_introduce_encrypted_t *inp, uint8_t val);
+int trn_cell_introduce_encrypted_set_nspec(trn_cell_introduce_encrypted_t *inp, uint8_t val);
/** Return the length of the dynamic array holding the nspecs field of
- * the hs_cell_introduce_encrypted_t in 'inp'.
+ * the trn_cell_introduce_encrypted_t in 'inp'.
*/
-size_t hs_cell_introduce_encrypted_getlen_nspecs(const hs_cell_introduce_encrypted_t *inp);
+size_t trn_cell_introduce_encrypted_getlen_nspecs(const trn_cell_introduce_encrypted_t *inp);
/** Return the element at position 'idx' of the dynamic array field
- * nspecs of the hs_cell_introduce_encrypted_t in 'inp'.
+ * nspecs of the trn_cell_introduce_encrypted_t in 'inp'.
*/
-struct link_specifier_st * hs_cell_introduce_encrypted_get_nspecs(hs_cell_introduce_encrypted_t *inp, size_t idx);
-/** As hs_cell_introduce_encrypted_get_nspecs, but take and return a
+struct link_specifier_st * trn_cell_introduce_encrypted_get_nspecs(trn_cell_introduce_encrypted_t *inp, size_t idx);
+/** As trn_cell_introduce_encrypted_get_nspecs, but take and return a
* const pointer
*/
- const struct link_specifier_st * hs_cell_introduce_encrypted_getconst_nspecs(const hs_cell_introduce_encrypted_t *inp, size_t idx);
+ const struct link_specifier_st * trn_cell_introduce_encrypted_getconst_nspecs(const trn_cell_introduce_encrypted_t *inp, size_t idx);
/** Change the element at position 'idx' of the dynamic array field
- * nspecs of the hs_cell_introduce_encrypted_t in 'inp', so that it
+ * nspecs of the trn_cell_introduce_encrypted_t in 'inp', so that it
* will hold the value 'elt'. Free the previous value, if any.
*/
-int hs_cell_introduce_encrypted_set_nspecs(hs_cell_introduce_encrypted_t *inp, size_t idx, struct link_specifier_st * elt);
-/** As hs_cell_introduce_encrypted_set_nspecs, but does not free the
+int trn_cell_introduce_encrypted_set_nspecs(trn_cell_introduce_encrypted_t *inp, size_t idx, struct link_specifier_st * elt);
+/** As trn_cell_introduce_encrypted_set_nspecs, but does not free the
* previous value.
*/
-int hs_cell_introduce_encrypted_set0_nspecs(hs_cell_introduce_encrypted_t *inp, size_t idx, struct link_specifier_st * elt);
+int trn_cell_introduce_encrypted_set0_nspecs(trn_cell_introduce_encrypted_t *inp, size_t idx, struct link_specifier_st * elt);
/** Append a new element 'elt' to the dynamic array field nspecs of
- * the hs_cell_introduce_encrypted_t in 'inp'.
+ * the trn_cell_introduce_encrypted_t in 'inp'.
*/
-int hs_cell_introduce_encrypted_add_nspecs(hs_cell_introduce_encrypted_t *inp, struct link_specifier_st * elt);
+int trn_cell_introduce_encrypted_add_nspecs(trn_cell_introduce_encrypted_t *inp, struct link_specifier_st * elt);
/** Return a pointer to the variable-length array field nspecs of
* 'inp'.
*/
-struct link_specifier_st * * hs_cell_introduce_encrypted_getarray_nspecs(hs_cell_introduce_encrypted_t *inp);
-/** As hs_cell_introduce_encrypted_get_nspecs, but take and return a
+struct link_specifier_st * * trn_cell_introduce_encrypted_getarray_nspecs(trn_cell_introduce_encrypted_t *inp);
+/** As trn_cell_introduce_encrypted_get_nspecs, but take and return a
* const pointer
*/
-const struct link_specifier_st * const * hs_cell_introduce_encrypted_getconstarray_nspecs(const hs_cell_introduce_encrypted_t *inp);
+const struct link_specifier_st * const * trn_cell_introduce_encrypted_getconstarray_nspecs(const trn_cell_introduce_encrypted_t *inp);
/** Change the length of the variable-length array field nspecs of
* 'inp' to 'newlen'.Fill extra elements with NULL; free removed
* elements. Return 0 on success; return -1 and set the error code on
* 'inp' on failure.
*/
-int hs_cell_introduce_encrypted_setlen_nspecs(hs_cell_introduce_encrypted_t *inp, size_t newlen);
+int trn_cell_introduce_encrypted_setlen_nspecs(trn_cell_introduce_encrypted_t *inp, size_t newlen);
/** Return the length of the dynamic array holding the pad field of
- * the hs_cell_introduce_encrypted_t in 'inp'.
+ * the trn_cell_introduce_encrypted_t in 'inp'.
*/
-size_t hs_cell_introduce_encrypted_getlen_pad(const hs_cell_introduce_encrypted_t *inp);
+size_t trn_cell_introduce_encrypted_getlen_pad(const trn_cell_introduce_encrypted_t *inp);
/** Return the element at position 'idx' of the dynamic array field
- * pad of the hs_cell_introduce_encrypted_t in 'inp'.
+ * pad of the trn_cell_introduce_encrypted_t in 'inp'.
*/
-uint8_t hs_cell_introduce_encrypted_get_pad(hs_cell_introduce_encrypted_t *inp, size_t idx);
-/** As hs_cell_introduce_encrypted_get_pad, but take and return a
+uint8_t trn_cell_introduce_encrypted_get_pad(trn_cell_introduce_encrypted_t *inp, size_t idx);
+/** As trn_cell_introduce_encrypted_get_pad, but take and return a
* const pointer
*/
-uint8_t hs_cell_introduce_encrypted_getconst_pad(const hs_cell_introduce_encrypted_t *inp, size_t idx);
+uint8_t trn_cell_introduce_encrypted_getconst_pad(const trn_cell_introduce_encrypted_t *inp, size_t idx);
/** Change the element at position 'idx' of the dynamic array field
- * pad of the hs_cell_introduce_encrypted_t in 'inp', so that it will
+ * pad of the trn_cell_introduce_encrypted_t in 'inp', so that it will
* hold the value 'elt'.
*/
-int hs_cell_introduce_encrypted_set_pad(hs_cell_introduce_encrypted_t *inp, size_t idx, uint8_t elt);
+int trn_cell_introduce_encrypted_set_pad(trn_cell_introduce_encrypted_t *inp, size_t idx, uint8_t elt);
/** Append a new element 'elt' to the dynamic array field pad of the
- * hs_cell_introduce_encrypted_t in 'inp'.
+ * trn_cell_introduce_encrypted_t in 'inp'.
*/
-int hs_cell_introduce_encrypted_add_pad(hs_cell_introduce_encrypted_t *inp, uint8_t elt);
+int trn_cell_introduce_encrypted_add_pad(trn_cell_introduce_encrypted_t *inp, uint8_t elt);
/** Return a pointer to the variable-length array field pad of 'inp'.
*/
-uint8_t * hs_cell_introduce_encrypted_getarray_pad(hs_cell_introduce_encrypted_t *inp);
-/** As hs_cell_introduce_encrypted_get_pad, but take and return a
+uint8_t * trn_cell_introduce_encrypted_getarray_pad(trn_cell_introduce_encrypted_t *inp);
+/** As trn_cell_introduce_encrypted_get_pad, but take and return a
* const pointer
*/
-const uint8_t * hs_cell_introduce_encrypted_getconstarray_pad(const hs_cell_introduce_encrypted_t *inp);
+const uint8_t * trn_cell_introduce_encrypted_getconstarray_pad(const trn_cell_introduce_encrypted_t *inp);
/** Change the length of the variable-length array field pad of 'inp'
* to 'newlen'.Fill extra elements with 0. Return 0 on success; return
* -1 and set the error code on 'inp' on failure.
*/
-int hs_cell_introduce_encrypted_setlen_pad(hs_cell_introduce_encrypted_t *inp, size_t newlen);
+int trn_cell_introduce_encrypted_setlen_pad(trn_cell_introduce_encrypted_t *inp, size_t newlen);
#endif
diff --git a/src/trunnel/hs/cell_introduce1.trunnel b/src/trunnel/hs/cell_introduce1.trunnel
index f7776879cd..7577c1526f 100644
--- a/src/trunnel/hs/cell_introduce1.trunnel
+++ b/src/trunnel/hs/cell_introduce1.trunnel
@@ -5,7 +5,7 @@
*/
/* From cell_common.trunnel. */
-extern struct cell_extension;
+extern struct trn_cell_extension;
/* From ed25519_cert.trunnel. */
extern struct link_specifier;
@@ -13,7 +13,7 @@ const TRUNNEL_SHA1_LEN = 20;
const TRUNNEL_REND_COOKIE_LEN = 20;
/* INTRODUCE1 payload. See details in section 3.2.1. */
-struct hs_cell_introduce1 {
+struct trn_cell_introduce1 {
/* Always zeroed. MUST be checked explicitely by the caller. */
u8 legacy_key_id[TRUNNEL_SHA1_LEN];
@@ -23,28 +23,28 @@ struct hs_cell_introduce1 {
u8 auth_key[auth_key_len];
/* Extension(s). Reserved fields. */
- struct cell_extension extensions;
+ struct trn_cell_extension extensions;
/* Variable length, up to the end of cell. */
u8 encrypted[];
};
/* INTRODUCE_ACK payload. See details in section 3.2.2. */
-struct hs_cell_introduce_ack {
+struct trn_cell_introduce_ack {
/* Status of introduction. */
u16 status IN [0x0000, 0x0001, 0x0002];
/* Extension(s). Reserved fields. */
- struct cell_extension extensions;
+ struct trn_cell_extension extensions;
};
/* Encrypted section of the INTRODUCE1/INTRODUCE2 cell. */
-struct hs_cell_introduce_encrypted {
+struct trn_cell_introduce_encrypted {
/* Rendezvous cookie. */
u8 rend_cookie[TRUNNEL_REND_COOKIE_LEN];
/* Extension(s). Reserved fields. */
- struct cell_extension extensions;
+ struct trn_cell_extension extensions;
/* Onion key material. */
u8 onion_key_type IN [0x01];