diff options
author | David Goulet <dgoulet@torproject.org> | 2017-04-11 13:46:41 -0400 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2017-04-11 13:46:41 -0400 |
commit | 6bacc3c7a88509043613d3bc29534c0ecf8803b1 (patch) | |
tree | f8216478ca43bf5988d57b7df5065d9496fa0114 /src/trunnel/hs/cell_introduce1.c | |
parent | 01fc93ffef3843a86710718c12ba9be67dcca2bc (diff) | |
download | tor-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/hs/cell_introduce1.c')
-rw-r--r-- | src/trunnel/hs/cell_introduce1.c | 398 |
1 files changed, 199 insertions, 199 deletions
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; |