[tor-commits] [tor/main] trunnel: Make hs/cell_common.trunnel generic

dgoulet at torproject.org dgoulet at torproject.org
Tue Feb 22 20:48:20 UTC 2022


commit b5439d6bd0eb72501abce6e5f897f473d9b27fc1
Author: David Goulet <dgoulet at torproject.org>
Date:   Tue Dec 14 09:42:02 2021 -0500

    trunnel: Make hs/cell_common.trunnel generic
    
    Move it to extension.trunnel instead so that extension ABI construction
    can be used in other parts of tor than just HS cells.
    
    Specifically, we'll use it in the ntorv3 data payload and make a
    congestion control parameter extension using that binary structure.
    
    Only rename. No code behavior changes.
    
    Signed-off-by: David Goulet <dgoulet at torproject.org>
---
 src/feature/hs/hs_cell.c                      |  47 +++---
 src/feature/hs/hs_cell.h                      |   4 +-
 src/feature/hs/hs_circuit.c                   |   1 -
 src/feature/hs/hs_intropoint.c                |  30 ++--
 src/feature/hs/hs_service.c                   |   1 -
 src/test/test_hs_cell.c                       |  36 ++---
 src/test/test_hs_intropoint.c                 |   6 +-
 src/trunnel/{hs/cell_common.c => extension.c} | 187 ++++++++++++------------
 src/trunnel/extension.h                       | 197 +++++++++++++++++++++++++
 src/trunnel/extension.trunnel                 |  14 ++
 src/trunnel/hs/cell_common.h                  | 203 --------------------------
 src/trunnel/hs/cell_common.trunnel            |  12 --
 src/trunnel/hs/cell_establish_intro.c         |  68 ++++-----
 src/trunnel/hs/cell_establish_intro.h         |  22 +--
 src/trunnel/hs/cell_establish_intro.trunnel   |   6 +-
 src/trunnel/hs/cell_introduce1.c              |  94 ++++++------
 src/trunnel/hs/cell_introduce1.h              |  32 ++--
 src/trunnel/hs/cell_introduce1.trunnel        |   8 +-
 src/trunnel/include.am                        |   5 +-
 19 files changed, 483 insertions(+), 490 deletions(-)

diff --git a/src/feature/hs/hs_cell.c b/src/feature/hs/hs_cell.c
index f84407de9e..116395b3c8 100644
--- a/src/feature/hs/hs_cell.c
+++ b/src/feature/hs/hs_cell.c
@@ -19,7 +19,7 @@
 
 /* Trunnel. */
 #include "trunnel/ed25519_cert.h"
-#include "trunnel/hs/cell_common.h"
+#include "trunnel/extension.h"
 #include "trunnel/hs/cell_establish_intro.h"
 #include "trunnel/hs/cell_introduce1.h"
 #include "trunnel/hs/cell_rendezvous.h"
@@ -379,7 +379,7 @@ introduce1_set_encrypted(trn_cell_introduce1_t *cell,
                          const hs_cell_introduce1_data_t *data)
 {
   trn_cell_introduce_encrypted_t *enc_cell;
-  trn_cell_extension_t *ext;
+  trn_extension_t *ext;
 
   tor_assert(cell);
   tor_assert(data);
@@ -388,9 +388,9 @@ introduce1_set_encrypted(trn_cell_introduce1_t *cell,
   tor_assert(enc_cell);
 
   /* Set extension data. None are used. */
-  ext = trn_cell_extension_new();
+  ext = trn_extension_new();
   tor_assert(ext);
-  trn_cell_extension_set_num(ext, 0);
+  trn_extension_set_num(ext, 0);
   trn_cell_introduce_encrypted_set_extensions(enc_cell, ext);
 
   /* Set the rendezvous cookie. */
@@ -454,20 +454,20 @@ build_establish_intro_dos_param(trn_cell_extension_dos_t *dos_ext,
  * possible if there is a bug.) */
 static int
 build_establish_intro_dos_extension(const hs_service_config_t *service_config,
-                                    trn_cell_extension_t *extensions)
+                                    trn_extension_t *extensions)
 {
   ssize_t ret;
   size_t dos_ext_encoded_len;
   uint8_t *field_array;
-  trn_cell_extension_field_t *field = NULL;
+  trn_extension_field_t *field = NULL;
   trn_cell_extension_dos_t *dos_ext = NULL;
 
   tor_assert(service_config);
   tor_assert(extensions);
 
   /* We are creating a cell extension field of the type DoS. */
-  field = trn_cell_extension_field_new();
-  trn_cell_extension_field_set_field_type(field,
+  field = trn_extension_field_new();
+  trn_extension_field_set_field_type(field,
                                           TRUNNEL_CELL_EXTENSION_TYPE_DOS);
 
   /* Build DoS extension field. We will put in two parameters. */
@@ -490,24 +490,23 @@ build_establish_intro_dos_extension(const hs_service_config_t *service_config,
   }
   dos_ext_encoded_len = ret;
   /* Set length field and the field array size length. */
-  trn_cell_extension_field_set_field_len(field, dos_ext_encoded_len);
-  trn_cell_extension_field_setlen_field(field, dos_ext_encoded_len);
+  trn_extension_field_set_field_len(field, dos_ext_encoded_len);
+  trn_extension_field_setlen_field(field, dos_ext_encoded_len);
   /* Encode the DoS extension into the cell extension field. */
-  field_array = trn_cell_extension_field_getarray_field(field);
+  field_array = trn_extension_field_getarray_field(field);
   ret = trn_cell_extension_dos_encode(field_array,
-                 trn_cell_extension_field_getlen_field(field), dos_ext);
+                 trn_extension_field_getlen_field(field), dos_ext);
   if (BUG(ret <= 0)) {
     goto err;
   }
   tor_assert(ret == (ssize_t) dos_ext_encoded_len);
 
   /* Finally, encode field into the cell extension. */
-  trn_cell_extension_add_fields(extensions, field);
+  trn_extension_add_fields(extensions, field);
 
   /* We've just add an extension field to the cell extensions so increment the
    * total number. */
-  trn_cell_extension_set_num(extensions,
-                             trn_cell_extension_get_num(extensions) + 1);
+  trn_extension_set_num(extensions, trn_extension_get_num(extensions) + 1);
 
   /* Cleanup. DoS extension has been encoded at this point. */
   trn_cell_extension_dos_free(dos_ext);
@@ -515,7 +514,7 @@ build_establish_intro_dos_extension(const hs_service_config_t *service_config,
   return 0;
 
  err:
-  trn_cell_extension_field_free(field);
+  trn_extension_field_free(field);
   trn_cell_extension_dos_free(dos_ext);
   return -1;
 }
@@ -526,18 +525,18 @@ build_establish_intro_dos_extension(const hs_service_config_t *service_config,
 
 /** Allocate and build all the ESTABLISH_INTRO cell extension. The given
  * extensions pointer is always set to a valid cell extension object. */
-STATIC trn_cell_extension_t *
+STATIC trn_extension_t *
 build_establish_intro_extensions(const hs_service_config_t *service_config,
                                  const hs_service_intro_point_t *ip)
 {
   int ret;
-  trn_cell_extension_t *extensions;
+  trn_extension_t *extensions;
 
   tor_assert(service_config);
   tor_assert(ip);
 
-  extensions = trn_cell_extension_new();
-  trn_cell_extension_set_num(extensions, 0);
+  extensions = trn_extension_new();
+  trn_extension_set_num(extensions, 0);
 
   /* If the defense has been enabled service side (by the operator with a
    * torrc option) and the intro point does support it. */
@@ -568,7 +567,7 @@ hs_cell_build_establish_intro(const char *circ_nonce,
   ssize_t cell_len = -1;
   uint16_t sig_len = ED25519_SIG_LEN;
   trn_cell_establish_intro_t *cell = NULL;
-  trn_cell_extension_t *extensions;
+  trn_extension_t *extensions;
 
   tor_assert(circ_nonce);
   tor_assert(service_config);
@@ -947,7 +946,7 @@ hs_cell_build_introduce1(const hs_cell_introduce1_data_t *data,
 {
   ssize_t cell_len;
   trn_cell_introduce1_t *cell;
-  trn_cell_extension_t *ext;
+  trn_extension_t *ext;
 
   tor_assert(data);
   tor_assert(cell_out);
@@ -956,9 +955,9 @@ hs_cell_build_introduce1(const hs_cell_introduce1_data_t *data,
   tor_assert(cell);
 
   /* Set extension data. None are used. */
-  ext = trn_cell_extension_new();
+  ext = trn_extension_new();
   tor_assert(ext);
-  trn_cell_extension_set_num(ext, 0);
+  trn_extension_set_num(ext, 0);
   trn_cell_introduce1_set_extensions(cell, ext);
 
   /* Set the authentication key. */
diff --git a/src/feature/hs/hs_cell.h b/src/feature/hs/hs_cell.h
index dc083ca03f..c25fd45567 100644
--- a/src/feature/hs/hs_cell.h
+++ b/src/feature/hs/hs_cell.h
@@ -115,9 +115,9 @@ void hs_cell_introduce1_data_clear(hs_cell_introduce1_data_t *data);
 
 #ifdef TOR_UNIT_TESTS
 
-#include "trunnel/hs/cell_common.h"
+#include "trunnel/extension.h"
 
-STATIC trn_cell_extension_t *
+STATIC trn_extension_t *
 build_establish_intro_extensions(const hs_service_config_t *service_config,
                                  const hs_service_intro_point_t *ip);
 
diff --git a/src/feature/hs/hs_circuit.c b/src/feature/hs/hs_circuit.c
index 0d7dd1c2b8..3347bdca07 100644
--- a/src/feature/hs/hs_circuit.c
+++ b/src/feature/hs/hs_circuit.c
@@ -35,7 +35,6 @@
 
 /* Trunnel. */
 #include "trunnel/ed25519_cert.h"
-#include "trunnel/hs/cell_common.h"
 #include "trunnel/hs/cell_establish_intro.h"
 
 #include "core/or/cpath_build_state_st.h"
diff --git a/src/feature/hs/hs_intropoint.c b/src/feature/hs/hs_intropoint.c
index b589e44cc3..0a656b78dd 100644
--- a/src/feature/hs/hs_intropoint.c
+++ b/src/feature/hs/hs_intropoint.c
@@ -20,7 +20,7 @@
 
 /* Trunnel */
 #include "trunnel/ed25519_cert.h"
-#include "trunnel/hs/cell_common.h"
+#include "trunnel/extension.h"
 #include "trunnel/hs/cell_establish_intro.h"
 #include "trunnel/hs/cell_introduce1.h"
 
@@ -155,14 +155,14 @@ hs_intro_send_intro_established_cell,(or_circuit_t *circ))
   uint8_t *encoded_cell = NULL;
   ssize_t encoded_len, result_len;
   trn_cell_intro_established_t *cell;
-  trn_cell_extension_t *ext;
+  trn_extension_t *ext;
 
   tor_assert(circ);
 
   /* Build the cell payload. */
   cell = trn_cell_intro_established_new();
-  ext = trn_cell_extension_new();
-  trn_cell_extension_set_num(ext, 0);
+  ext = trn_extension_new();
+  trn_extension_set_num(ext, 0);
   trn_cell_intro_established_set_extensions(cell, ext);
   /* Encode the cell to binary format. */
   encoded_len = trn_cell_intro_established_encoded_len(cell);
@@ -249,7 +249,7 @@ cell_dos_extension_parameters_are_valid(uint64_t intro2_rate_per_sec,
  * values, the DoS defenses is disabled on the circuit. */
 static void
 handle_establish_intro_cell_dos_extension(
-                                const trn_cell_extension_field_t *field,
+                                const trn_extension_field_t *field,
                                 or_circuit_t *circ)
 {
   ssize_t ret;
@@ -260,8 +260,8 @@ handle_establish_intro_cell_dos_extension(
   tor_assert(circ);
 
   ret = trn_cell_extension_dos_parse(&dos,
-                 trn_cell_extension_field_getconstarray_field(field),
-                 trn_cell_extension_field_getlen_field(field));
+                 trn_extension_field_getconstarray_field(field),
+                 trn_extension_field_getlen_field(field));
   if (ret < 0) {
     goto end;
   }
@@ -332,7 +332,7 @@ handle_establish_intro_cell_extensions(
                             const trn_cell_establish_intro_t *parsed_cell,
                             or_circuit_t *circ)
 {
-  const trn_cell_extension_t *extensions;
+  const trn_extension_t *extensions;
 
   tor_assert(parsed_cell);
   tor_assert(circ);
@@ -343,15 +343,15 @@ handle_establish_intro_cell_extensions(
   }
 
   /* Go over all extensions. */
-  for (size_t idx = 0; idx < trn_cell_extension_get_num(extensions); idx++) {
-    const trn_cell_extension_field_t *field =
-      trn_cell_extension_getconst_fields(extensions, idx);
+  for (size_t idx = 0; idx < trn_extension_get_num(extensions); idx++) {
+    const trn_extension_field_t *field =
+      trn_extension_getconst_fields(extensions, idx);
     if (BUG(field == NULL)) {
       /* The number of extensions should match the number of fields. */
       break;
     }
 
-    switch (trn_cell_extension_field_get_field_type(field)) {
+    switch (trn_extension_field_get_field_type(field)) {
     case TRUNNEL_CELL_EXTENSION_TYPE_DOS:
       /* After this, the circuit should be set for DoS defenses. */
       handle_establish_intro_cell_dos_extension(field, circ);
@@ -541,7 +541,7 @@ send_introduce_ack_cell(or_circuit_t *circ, uint16_t status)
   uint8_t *encoded_cell = NULL;
   ssize_t encoded_len, result_len;
   trn_cell_introduce_ack_t *cell;
-  trn_cell_extension_t *ext;
+  trn_extension_t *ext;
 
   tor_assert(circ);
 
@@ -550,8 +550,8 @@ send_introduce_ack_cell(or_circuit_t *circ, uint16_t status)
   cell = trn_cell_introduce_ack_new();
   ret = trn_cell_introduce_ack_set_status(cell, status);
   /* We have no cell extensions in an INTRODUCE_ACK cell. */
-  ext = trn_cell_extension_new();
-  trn_cell_extension_set_num(ext, 0);
+  ext = trn_extension_new();
+  trn_extension_set_num(ext, 0);
   trn_cell_introduce_ack_set_extensions(cell, ext);
   /* A wrong status is a very bad code flow error as this value is controlled
    * by the code in this file and not an external input. This means we use a
diff --git a/src/feature/hs/hs_service.c b/src/feature/hs/hs_service.c
index 2b3699422a..bf99ad69bd 100644
--- a/src/feature/hs/hs_service.c
+++ b/src/feature/hs/hs_service.c
@@ -59,7 +59,6 @@
 
 /* Trunnel */
 #include "trunnel/ed25519_cert.h"
-#include "trunnel/hs/cell_common.h"
 #include "trunnel/hs/cell_establish_intro.h"
 
 #ifdef HAVE_SYS_STAT_H
diff --git a/src/test/test_hs_cell.c b/src/test/test_hs_cell.c
index 818f7bfef7..cf7af8a38a 100644
--- a/src/test/test_hs_cell.c
+++ b/src/test/test_hs_cell.c
@@ -20,7 +20,7 @@
 #include "feature/hs/hs_service.h"
 
 /* Trunnel. */
-#include "trunnel/hs/cell_common.h"
+#include "trunnel/extension.h"
 #include "trunnel/hs/cell_establish_intro.h"
 
 /** We simulate the creation of an outgoing ESTABLISH_INTRO cell, and then we
@@ -132,7 +132,7 @@ test_gen_establish_intro_dos_ext(void *arg)
   ssize_t ret;
   hs_service_config_t config;
   hs_service_intro_point_t *ip = NULL;
-  trn_cell_extension_t *extensions = NULL;
+  trn_extension_t *extensions = NULL;
   trn_cell_extension_dos_t *dos = NULL;
 
   (void) arg;
@@ -144,8 +144,8 @@ test_gen_establish_intro_dos_ext(void *arg)
 
   /* Case 1: No DoS parameters so no extension to be built. */
   extensions = build_establish_intro_extensions(&config, ip);
-  tt_int_op(trn_cell_extension_get_num(extensions), OP_EQ, 0);
-  trn_cell_extension_free(extensions);
+  tt_int_op(trn_extension_get_num(extensions), OP_EQ, 0);
+  trn_extension_free(extensions);
   extensions = NULL;
 
   /* Case 2: Enable the DoS extension. Parameter set to 0 should indicate to
@@ -153,15 +153,15 @@ test_gen_establish_intro_dos_ext(void *arg)
    * nonetheless in the cell. */
   config.has_dos_defense_enabled = 1;
   extensions = build_establish_intro_extensions(&config, ip);
-  tt_int_op(trn_cell_extension_get_num(extensions), OP_EQ, 1);
+  tt_int_op(trn_extension_get_num(extensions), OP_EQ, 1);
   /* Validate the extension. */
-  const trn_cell_extension_field_t *field =
-    trn_cell_extension_getconst_fields(extensions, 0);
-  tt_int_op(trn_cell_extension_field_get_field_type(field), OP_EQ,
+  const trn_extension_field_t *field =
+    trn_extension_getconst_fields(extensions, 0);
+  tt_int_op(trn_extension_field_get_field_type(field), OP_EQ,
             TRUNNEL_CELL_EXTENSION_TYPE_DOS);
   ret = trn_cell_extension_dos_parse(&dos,
-                 trn_cell_extension_field_getconstarray_field(field),
-                 trn_cell_extension_field_getlen_field(field));
+                 trn_extension_field_getconstarray_field(field),
+                 trn_extension_field_getlen_field(field));
   tt_int_op(ret, OP_EQ, 19);
   /* Rate per sec param. */
   const trn_cell_extension_dos_param_t *param =
@@ -175,21 +175,21 @@ test_gen_establish_intro_dos_ext(void *arg)
             TRUNNEL_DOS_PARAM_TYPE_INTRO2_BURST_PER_SEC);
   tt_u64_op(trn_cell_extension_dos_param_get_value(param), OP_EQ, 0);
   trn_cell_extension_dos_free(dos); dos = NULL;
-  trn_cell_extension_free(extensions); extensions = NULL;
+  trn_extension_free(extensions); extensions = NULL;
 
   /* Case 3: Enable the DoS extension. Parameter set to some normal values. */
   config.has_dos_defense_enabled = 1;
   config.intro_dos_rate_per_sec = 42;
   config.intro_dos_burst_per_sec = 250;
   extensions = build_establish_intro_extensions(&config, ip);
-  tt_int_op(trn_cell_extension_get_num(extensions), OP_EQ, 1);
+  tt_int_op(trn_extension_get_num(extensions), OP_EQ, 1);
   /* Validate the extension. */
-  field = trn_cell_extension_getconst_fields(extensions, 0);
-  tt_int_op(trn_cell_extension_field_get_field_type(field), OP_EQ,
+  field = trn_extension_getconst_fields(extensions, 0);
+  tt_int_op(trn_extension_field_get_field_type(field), OP_EQ,
             TRUNNEL_CELL_EXTENSION_TYPE_DOS);
   ret = trn_cell_extension_dos_parse(&dos,
-                 trn_cell_extension_field_getconstarray_field(field),
-                 trn_cell_extension_field_getlen_field(field));
+                 trn_extension_field_getconstarray_field(field),
+                 trn_extension_field_getlen_field(field));
   tt_int_op(ret, OP_EQ, 19);
   /* Rate per sec param. */
   param = trn_cell_extension_dos_getconst_params(dos, 0);
@@ -202,12 +202,12 @@ test_gen_establish_intro_dos_ext(void *arg)
             TRUNNEL_DOS_PARAM_TYPE_INTRO2_BURST_PER_SEC);
   tt_u64_op(trn_cell_extension_dos_param_get_value(param), OP_EQ, 250);
   trn_cell_extension_dos_free(dos); dos = NULL;
-  trn_cell_extension_free(extensions); extensions = NULL;
+  trn_extension_free(extensions); extensions = NULL;
 
  done:
   service_intro_point_free(ip);
   trn_cell_extension_dos_free(dos);
-  trn_cell_extension_free(extensions);
+  trn_extension_free(extensions);
 }
 
 struct testcase_t hs_cell_tests[] = {
diff --git a/src/test/test_hs_intropoint.c b/src/test/test_hs_intropoint.c
index a1ed281b4d..cbcdeade92 100644
--- a/src/test/test_hs_intropoint.c
+++ b/src/test/test_hs_intropoint.c
@@ -33,9 +33,9 @@
 #include "core/or/or_circuit_st.h"
 
 /* Trunnel. */
+#include "trunnel/extension.h"
 #include "trunnel/hs/cell_establish_intro.h"
 #include "trunnel/hs/cell_introduce1.h"
-#include "trunnel/hs/cell_common.h"
 
 static size_t
 new_establish_intro_cell(const char *circ_nonce,
@@ -159,8 +159,8 @@ helper_create_introduce1_cell(void)
 
   /* Set the cell extensions to none. */
   {
-    trn_cell_extension_t *ext = trn_cell_extension_new();
-    trn_cell_extension_set_num(ext, 0);
+    trn_extension_t *ext = trn_extension_new();
+    trn_extension_set_num(ext, 0);
     trn_cell_introduce1_set_extensions(cell, ext);
   }
 
diff --git a/src/trunnel/hs/cell_common.c b/src/trunnel/extension.c
similarity index 59%
rename from src/trunnel/hs/cell_common.c
rename to src/trunnel/extension.c
index 1f50961d69..538ac62928 100644
--- a/src/trunnel/hs/cell_common.c
+++ b/src/trunnel/extension.c
@@ -1,11 +1,11 @@
-/* cell_common.c -- generated by Trunnel v1.5.3.
+/* extension.c -- generated by Trunnel v1.5.3.
  * https://gitweb.torproject.org/trunnel.git
  * You probably shouldn't edit this file.
  */
 #include <stdlib.h>
 #include "trunnel-impl.h"
 
-#include "cell_common.h"
+#include "extension.h"
 
 #define TRUNNEL_SET_ERROR_CODE(obj) \
   do {                              \
@@ -15,8 +15,8 @@
 #if defined(__COVERITY__) || defined(__clang_analyzer__)
 /* If we're running a static analysis tool, we don't want it to complain
  * that some of our remaining-bytes checks are dead-code. */
-int cellcommon_deadcode_dummy__ = 0;
-#define OR_DEADCODE_DUMMY || cellcommon_deadcode_dummy__
+int extension_deadcode_dummy__ = 0;
+#define OR_DEADCODE_DUMMY || extension_deadcode_dummy__
 #else
 #define OR_DEADCODE_DUMMY
 #endif
@@ -28,10 +28,10 @@ int cellcommon_deadcode_dummy__ = 0;
     }                                                            \
   } while (0)
 
-trn_cell_extension_field_t *
-trn_cell_extension_field_new(void)
+trn_extension_field_t *
+trn_extension_field_new(void)
 {
-  trn_cell_extension_field_t *val = trunnel_calloc(1, sizeof(trn_cell_extension_field_t));
+  trn_extension_field_t *val = trunnel_calloc(1, sizeof(trn_extension_field_t));
   if (NULL == val)
     return NULL;
   return val;
@@ -40,7 +40,7 @@ trn_cell_extension_field_new(void)
 /** Release all storage held inside 'obj', but do not free 'obj'.
  */
 static void
-trn_cell_extension_field_clear(trn_cell_extension_field_t *obj)
+trn_extension_field_clear(trn_extension_field_t *obj)
 {
   (void) obj;
   TRUNNEL_DYNARRAY_WIPE(&obj->field);
@@ -48,62 +48,62 @@ trn_cell_extension_field_clear(trn_cell_extension_field_t *obj)
 }
 
 void
-trn_cell_extension_field_free(trn_cell_extension_field_t *obj)
+trn_extension_field_free(trn_extension_field_t *obj)
 {
   if (obj == NULL)
     return;
-  trn_cell_extension_field_clear(obj);
-  trunnel_memwipe(obj, sizeof(trn_cell_extension_field_t));
+  trn_extension_field_clear(obj);
+  trunnel_memwipe(obj, sizeof(trn_extension_field_t));
   trunnel_free_(obj);
 }
 
 uint8_t
-trn_cell_extension_field_get_field_type(const trn_cell_extension_field_t *inp)
+trn_extension_field_get_field_type(const trn_extension_field_t *inp)
 {
   return inp->field_type;
 }
 int
-trn_cell_extension_field_set_field_type(trn_cell_extension_field_t *inp, uint8_t val)
+trn_extension_field_set_field_type(trn_extension_field_t *inp, uint8_t val)
 {
   inp->field_type = val;
   return 0;
 }
 uint8_t
-trn_cell_extension_field_get_field_len(const trn_cell_extension_field_t *inp)
+trn_extension_field_get_field_len(const trn_extension_field_t *inp)
 {
   return inp->field_len;
 }
 int
-trn_cell_extension_field_set_field_len(trn_cell_extension_field_t *inp, uint8_t val)
+trn_extension_field_set_field_len(trn_extension_field_t *inp, uint8_t val)
 {
   inp->field_len = val;
   return 0;
 }
 size_t
-trn_cell_extension_field_getlen_field(const trn_cell_extension_field_t *inp)
+trn_extension_field_getlen_field(const trn_extension_field_t *inp)
 {
   return TRUNNEL_DYNARRAY_LEN(&inp->field);
 }
 
 uint8_t
-trn_cell_extension_field_get_field(trn_cell_extension_field_t *inp, size_t idx)
+trn_extension_field_get_field(trn_extension_field_t *inp, size_t idx)
 {
   return TRUNNEL_DYNARRAY_GET(&inp->field, idx);
 }
 
 uint8_t
-trn_cell_extension_field_getconst_field(const trn_cell_extension_field_t *inp, size_t idx)
+trn_extension_field_getconst_field(const trn_extension_field_t *inp, size_t idx)
 {
-  return trn_cell_extension_field_get_field((trn_cell_extension_field_t*)inp, idx);
+  return trn_extension_field_get_field((trn_extension_field_t*)inp, idx);
 }
 int
-trn_cell_extension_field_set_field(trn_cell_extension_field_t *inp, size_t idx, uint8_t elt)
+trn_extension_field_set_field(trn_extension_field_t *inp, size_t idx, uint8_t elt)
 {
   TRUNNEL_DYNARRAY_SET(&inp->field, idx, elt);
   return 0;
 }
 int
-trn_cell_extension_field_add_field(trn_cell_extension_field_t *inp, uint8_t elt)
+trn_extension_field_add_field(trn_extension_field_t *inp, uint8_t elt)
 {
 #if SIZE_MAX >= UINT8_MAX
   if (inp->field.n_ == UINT8_MAX)
@@ -117,17 +117,17 @@ trn_cell_extension_field_add_field(trn_cell_extension_field_t *inp, uint8_t elt)
 }
 
 uint8_t *
-trn_cell_extension_field_getarray_field(trn_cell_extension_field_t *inp)
+trn_extension_field_getarray_field(trn_extension_field_t *inp)
 {
   return inp->field.elts_;
 }
 const uint8_t  *
-trn_cell_extension_field_getconstarray_field(const trn_cell_extension_field_t *inp)
+trn_extension_field_getconstarray_field(const trn_extension_field_t *inp)
 {
-  return (const uint8_t  *)trn_cell_extension_field_getarray_field((trn_cell_extension_field_t*)inp);
+  return (const uint8_t  *)trn_extension_field_getarray_field((trn_extension_field_t*)inp);
 }
 int
-trn_cell_extension_field_setlen_field(trn_cell_extension_field_t *inp, size_t newlen)
+trn_extension_field_setlen_field(trn_extension_field_t *inp, size_t newlen)
 {
   uint8_t *newptr;
 #if UINT8_MAX < SIZE_MAX
@@ -147,7 +147,7 @@ trn_cell_extension_field_setlen_field(trn_cell_extension_field_t *inp, size_t ne
   return -1;
 }
 const char *
-trn_cell_extension_field_check(const trn_cell_extension_field_t *obj)
+trn_extension_field_check(const trn_extension_field_t *obj)
 {
   if (obj == NULL)
     return "Object was NULL";
@@ -159,11 +159,11 @@ trn_cell_extension_field_check(const trn_cell_extension_field_t *obj)
 }
 
 ssize_t
-trn_cell_extension_field_encoded_len(const trn_cell_extension_field_t *obj)
+trn_extension_field_encoded_len(const trn_extension_field_t *obj)
 {
   ssize_t result = 0;
 
-  if (NULL != trn_cell_extension_field_check(obj))
+  if (NULL != trn_extension_field_check(obj))
      return -1;
 
 
@@ -178,24 +178,24 @@ trn_cell_extension_field_encoded_len(const trn_cell_extension_field_t *obj)
   return result;
 }
 int
-trn_cell_extension_field_clear_errors(trn_cell_extension_field_t *obj)
+trn_extension_field_clear_errors(trn_extension_field_t *obj)
 {
   int r = obj->trunnel_error_code_;
   obj->trunnel_error_code_ = 0;
   return r;
 }
 ssize_t
-trn_cell_extension_field_encode(uint8_t *output, const size_t avail, const trn_cell_extension_field_t *obj)
+trn_extension_field_encode(uint8_t *output, const size_t avail, const trn_extension_field_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 = trn_cell_extension_field_encoded_len(obj);
+  const ssize_t encoded_len = trn_extension_field_encoded_len(obj);
 #endif
 
-  if (NULL != (msg = trn_cell_extension_field_check(obj)))
+  if (NULL != (msg = trn_extension_field_check(obj)))
     goto check_failed;
 
 #ifdef TRUNNEL_CHECK_ENCODED_LEN
@@ -252,11 +252,11 @@ trn_cell_extension_field_encode(uint8_t *output, const size_t avail, const trn_c
   return result;
 }
 
-/** As trn_cell_extension_field_parse(), but do not allocate the
- * output object.
+/** As trn_extension_field_parse(), but do not allocate the output
+ * object.
  */
 static ssize_t
-trn_cell_extension_field_parse_into(trn_cell_extension_field_t *obj, const uint8_t *input, const size_t len_in)
+trn_extension_field_parse_into(trn_extension_field_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 @@ trn_cell_extension_field_parse_into(trn_cell_extension_field_t *obj, const uint8
 }
 
 ssize_t
-trn_cell_extension_field_parse(trn_cell_extension_field_t **output, const uint8_t *input, const size_t len_in)
+trn_extension_field_parse(trn_extension_field_t **output, const uint8_t *input, const size_t len_in)
 {
   ssize_t result;
-  *output = trn_cell_extension_field_new();
+  *output = trn_extension_field_new();
   if (NULL == *output)
     return -1;
-  result = trn_cell_extension_field_parse_into(*output, input, len_in);
+  result = trn_extension_field_parse_into(*output, input, len_in);
   if (result < 0) {
-    trn_cell_extension_field_free(*output);
+    trn_extension_field_free(*output);
     *output = NULL;
   }
   return result;
 }
-trn_cell_extension_t *
-trn_cell_extension_new(void)
+trn_extension_t *
+trn_extension_new(void)
 {
-  trn_cell_extension_t *val = trunnel_calloc(1, sizeof(trn_cell_extension_t));
+  trn_extension_t *val = trunnel_calloc(1, sizeof(trn_extension_t));
   if (NULL == val)
     return NULL;
   return val;
@@ -315,14 +315,14 @@ trn_cell_extension_new(void)
 /** Release all storage held inside 'obj', but do not free 'obj'.
  */
 static void
-trn_cell_extension_clear(trn_cell_extension_t *obj)
+trn_extension_clear(trn_extension_t *obj)
 {
   (void) obj;
   {
 
     unsigned idx;
     for (idx = 0; idx < TRUNNEL_DYNARRAY_LEN(&obj->fields); ++idx) {
-      trn_cell_extension_field_free(TRUNNEL_DYNARRAY_GET(&obj->fields, idx));
+      trn_extension_field_free(TRUNNEL_DYNARRAY_GET(&obj->fields, idx));
     }
   }
   TRUNNEL_DYNARRAY_WIPE(&obj->fields);
@@ -330,92 +330,92 @@ trn_cell_extension_clear(trn_cell_extension_t *obj)
 }
 
 void
-trn_cell_extension_free(trn_cell_extension_t *obj)
+trn_extension_free(trn_extension_t *obj)
 {
   if (obj == NULL)
     return;
-  trn_cell_extension_clear(obj);
-  trunnel_memwipe(obj, sizeof(trn_cell_extension_t));
+  trn_extension_clear(obj);
+  trunnel_memwipe(obj, sizeof(trn_extension_t));
   trunnel_free_(obj);
 }
 
 uint8_t
-trn_cell_extension_get_num(const trn_cell_extension_t *inp)
+trn_extension_get_num(const trn_extension_t *inp)
 {
   return inp->num;
 }
 int
-trn_cell_extension_set_num(trn_cell_extension_t *inp, uint8_t val)
+trn_extension_set_num(trn_extension_t *inp, uint8_t val)
 {
   inp->num = val;
   return 0;
 }
 size_t
-trn_cell_extension_getlen_fields(const trn_cell_extension_t *inp)
+trn_extension_getlen_fields(const trn_extension_t *inp)
 {
   return TRUNNEL_DYNARRAY_LEN(&inp->fields);
 }
 
-struct trn_cell_extension_field_st *
-trn_cell_extension_get_fields(trn_cell_extension_t *inp, size_t idx)
+struct trn_extension_field_st *
+trn_extension_get_fields(trn_extension_t *inp, size_t idx)
 {
   return TRUNNEL_DYNARRAY_GET(&inp->fields, idx);
 }
 
- const struct trn_cell_extension_field_st *
-trn_cell_extension_getconst_fields(const trn_cell_extension_t *inp, size_t idx)
+ const struct trn_extension_field_st *
+trn_extension_getconst_fields(const trn_extension_t *inp, size_t idx)
 {
-  return trn_cell_extension_get_fields((trn_cell_extension_t*)inp, idx);
+  return trn_extension_get_fields((trn_extension_t*)inp, idx);
 }
 int
-trn_cell_extension_set_fields(trn_cell_extension_t *inp, size_t idx, struct trn_cell_extension_field_st * elt)
+trn_extension_set_fields(trn_extension_t *inp, size_t idx, struct trn_extension_field_st * elt)
 {
-  trn_cell_extension_field_t *oldval = TRUNNEL_DYNARRAY_GET(&inp->fields, idx);
+  trn_extension_field_t *oldval = TRUNNEL_DYNARRAY_GET(&inp->fields, idx);
   if (oldval && oldval != elt)
-    trn_cell_extension_field_free(oldval);
-  return trn_cell_extension_set0_fields(inp, idx, elt);
+    trn_extension_field_free(oldval);
+  return trn_extension_set0_fields(inp, idx, elt);
 }
 int
-trn_cell_extension_set0_fields(trn_cell_extension_t *inp, size_t idx, struct trn_cell_extension_field_st * elt)
+trn_extension_set0_fields(trn_extension_t *inp, size_t idx, struct trn_extension_field_st * elt)
 {
   TRUNNEL_DYNARRAY_SET(&inp->fields, idx, elt);
   return 0;
 }
 int
-trn_cell_extension_add_fields(trn_cell_extension_t *inp, struct trn_cell_extension_field_st * elt)
+trn_extension_add_fields(trn_extension_t *inp, struct trn_extension_field_st * elt)
 {
 #if SIZE_MAX >= UINT8_MAX
   if (inp->fields.n_ == UINT8_MAX)
     goto trunnel_alloc_failed;
 #endif
-  TRUNNEL_DYNARRAY_ADD(struct trn_cell_extension_field_st *, &inp->fields, elt, {});
+  TRUNNEL_DYNARRAY_ADD(struct trn_extension_field_st *, &inp->fields, elt, {});
   return 0;
  trunnel_alloc_failed:
   TRUNNEL_SET_ERROR_CODE(inp);
   return -1;
 }
 
-struct trn_cell_extension_field_st * *
-trn_cell_extension_getarray_fields(trn_cell_extension_t *inp)
+struct trn_extension_field_st * *
+trn_extension_getarray_fields(trn_extension_t *inp)
 {
   return inp->fields.elts_;
 }
-const struct trn_cell_extension_field_st *  const  *
-trn_cell_extension_getconstarray_fields(const trn_cell_extension_t *inp)
+const struct trn_extension_field_st *  const  *
+trn_extension_getconstarray_fields(const trn_extension_t *inp)
 {
-  return (const struct trn_cell_extension_field_st *  const  *)trn_cell_extension_getarray_fields((trn_cell_extension_t*)inp);
+  return (const struct trn_extension_field_st *  const  *)trn_extension_getarray_fields((trn_extension_t*)inp);
 }
 int
-trn_cell_extension_setlen_fields(trn_cell_extension_t *inp, size_t newlen)
+trn_extension_setlen_fields(trn_extension_t *inp, size_t newlen)
 {
-  struct trn_cell_extension_field_st * *newptr;
+  struct trn_extension_field_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) trn_cell_extension_field_free,
+                 sizeof(inp->fields.elts_[0]), (trunnel_free_fn_t) trn_extension_field_free,
                  &inp->trunnel_error_code_);
   if (newlen != 0 && newptr == NULL)
     goto trunnel_alloc_failed;
@@ -426,7 +426,7 @@ trn_cell_extension_setlen_fields(trn_cell_extension_t *inp, size_t newlen)
   return -1;
 }
 const char *
-trn_cell_extension_check(const trn_cell_extension_t *obj)
+trn_extension_check(const trn_extension_t *obj)
 {
   if (obj == NULL)
     return "Object was NULL";
@@ -437,7 +437,7 @@ trn_cell_extension_check(const trn_cell_extension_t *obj)
 
     unsigned idx;
     for (idx = 0; idx < TRUNNEL_DYNARRAY_LEN(&obj->fields); ++idx) {
-      if (NULL != (msg = trn_cell_extension_field_check(TRUNNEL_DYNARRAY_GET(&obj->fields, idx))))
+      if (NULL != (msg = trn_extension_field_check(TRUNNEL_DYNARRAY_GET(&obj->fields, idx))))
         return msg;
     }
   }
@@ -447,46 +447,46 @@ trn_cell_extension_check(const trn_cell_extension_t *obj)
 }
 
 ssize_t
-trn_cell_extension_encoded_len(const trn_cell_extension_t *obj)
+trn_extension_encoded_len(const trn_extension_t *obj)
 {
   ssize_t result = 0;
 
-  if (NULL != trn_cell_extension_check(obj))
+  if (NULL != trn_extension_check(obj))
      return -1;
 
 
   /* Length of u8 num */
   result += 1;
 
-  /* Length of struct trn_cell_extension_field fields[num] */
+  /* Length of struct trn_extension_field fields[num] */
   {
 
     unsigned idx;
     for (idx = 0; idx < TRUNNEL_DYNARRAY_LEN(&obj->fields); ++idx) {
-      result += trn_cell_extension_field_encoded_len(TRUNNEL_DYNARRAY_GET(&obj->fields, idx));
+      result += trn_extension_field_encoded_len(TRUNNEL_DYNARRAY_GET(&obj->fields, idx));
     }
   }
   return result;
 }
 int
-trn_cell_extension_clear_errors(trn_cell_extension_t *obj)
+trn_extension_clear_errors(trn_extension_t *obj)
 {
   int r = obj->trunnel_error_code_;
   obj->trunnel_error_code_ = 0;
   return r;
 }
 ssize_t
-trn_cell_extension_encode(uint8_t *output, const size_t avail, const trn_cell_extension_t *obj)
+trn_extension_encode(uint8_t *output, const size_t avail, const trn_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 = trn_cell_extension_encoded_len(obj);
+  const ssize_t encoded_len = trn_extension_encoded_len(obj);
 #endif
 
-  if (NULL != (msg = trn_cell_extension_check(obj)))
+  if (NULL != (msg = trn_extension_check(obj)))
     goto check_failed;
 
 #ifdef TRUNNEL_CHECK_ENCODED_LEN
@@ -500,13 +500,13 @@ trn_cell_extension_encode(uint8_t *output, const size_t avail, const trn_cell_ex
   trunnel_set_uint8(ptr, (obj->num));
   written += 1; ptr += 1;
 
-  /* Encode struct trn_cell_extension_field fields[num] */
+  /* Encode struct trn_extension_field fields[num] */
   {
 
     unsigned idx;
     for (idx = 0; idx < TRUNNEL_DYNARRAY_LEN(&obj->fields); ++idx) {
       trunnel_assert(written <= avail);
-      result = trn_cell_extension_field_encode(ptr, avail - written, TRUNNEL_DYNARRAY_GET(&obj->fields, idx));
+      result = trn_extension_field_encode(ptr, avail - written, TRUNNEL_DYNARRAY_GET(&obj->fields, idx));
       if (result < 0)
         goto fail; /* XXXXXXX !*/
       written += result; ptr += result;
@@ -537,11 +537,10 @@ trn_cell_extension_encode(uint8_t *output, const size_t avail, const trn_cell_ex
   return result;
 }
 
-/** As trn_cell_extension_parse(), but do not allocate the output
- * object.
+/** As trn_extension_parse(), but do not allocate the output object.
  */
 static ssize_t
-trn_cell_extension_parse_into(trn_cell_extension_t *obj, const uint8_t *input, const size_t len_in)
+trn_extension_parse_into(trn_extension_t *obj, const uint8_t *input, const size_t len_in)
 {
   const uint8_t *ptr = input;
   size_t remaining = len_in;
@@ -553,18 +552,18 @@ trn_cell_extension_parse_into(trn_cell_extension_t *obj, const uint8_t *input, c
   obj->num = (trunnel_get_uint8(ptr));
   remaining -= 1; ptr += 1;
 
-  /* Parse struct trn_cell_extension_field fields[num] */
-  TRUNNEL_DYNARRAY_EXPAND(trn_cell_extension_field_t *, &obj->fields, obj->num, {});
+  /* Parse struct trn_extension_field fields[num] */
+  TRUNNEL_DYNARRAY_EXPAND(trn_extension_field_t *, &obj->fields, obj->num, {});
   {
-    trn_cell_extension_field_t * elt;
+    trn_extension_field_t * elt;
     unsigned idx;
     for (idx = 0; idx < obj->num; ++idx) {
-      result = trn_cell_extension_field_parse(&elt, ptr, remaining);
+      result = trn_extension_field_parse(&elt, ptr, remaining);
       if (result < 0)
         goto relay_fail;
       trunnel_assert((size_t)result <= remaining);
       remaining -= result; ptr += result;
-      TRUNNEL_DYNARRAY_ADD(trn_cell_extension_field_t *, &obj->fields, elt, {trn_cell_extension_field_free(elt);});
+      TRUNNEL_DYNARRAY_ADD(trn_extension_field_t *, &obj->fields, elt, {trn_extension_field_free(elt);});
     }
   }
   trunnel_assert(ptr + remaining == input + len_in);
@@ -580,15 +579,15 @@ trn_cell_extension_parse_into(trn_cell_extension_t *obj, const uint8_t *input, c
 }
 
 ssize_t
-trn_cell_extension_parse(trn_cell_extension_t **output, const uint8_t *input, const size_t len_in)
+trn_extension_parse(trn_extension_t **output, const uint8_t *input, const size_t len_in)
 {
   ssize_t result;
-  *output = trn_cell_extension_new();
+  *output = trn_extension_new();
   if (NULL == *output)
     return -1;
-  result = trn_cell_extension_parse_into(*output, input, len_in);
+  result = trn_extension_parse_into(*output, input, len_in);
   if (result < 0) {
-    trn_cell_extension_free(*output);
+    trn_extension_free(*output);
     *output = NULL;
   }
   return result;
diff --git a/src/trunnel/extension.h b/src/trunnel/extension.h
new file mode 100644
index 0000000000..eed89d140e
--- /dev/null
+++ b/src/trunnel/extension.h
@@ -0,0 +1,197 @@
+/* extension.h -- generated by Trunnel v1.5.3.
+ * https://gitweb.torproject.org/trunnel.git
+ * You probably shouldn't edit this file.
+ */
+#ifndef TRUNNEL_EXTENSION_H
+#define TRUNNEL_EXTENSION_H
+
+#include <stdint.h>
+#include "trunnel.h"
+
+#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_TRN_EXTENSION_FIELD)
+struct trn_extension_field_st {
+  uint8_t field_type;
+  uint8_t field_len;
+  TRUNNEL_DYNARRAY_HEAD(, uint8_t) field;
+  uint8_t trunnel_error_code_;
+};
+#endif
+typedef struct trn_extension_field_st trn_extension_field_t;
+#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_TRN_EXTENSION)
+struct trn_extension_st {
+  uint8_t num;
+  TRUNNEL_DYNARRAY_HEAD(, struct trn_extension_field_st *) fields;
+  uint8_t trunnel_error_code_;
+};
+#endif
+typedef struct trn_extension_st trn_extension_t;
+/** Return a newly allocated trn_extension_field with all elements set
+ * to zero.
+ */
+trn_extension_field_t *trn_extension_field_new(void);
+/** Release all storage held by the trn_extension_field in 'victim'.
+ * (Do nothing if 'victim' is NULL.)
+ */
+void trn_extension_field_free(trn_extension_field_t *victim);
+/** Try to parse a trn_extension_field 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_extension_field_t. On failure, return -2 if the input
+ * appears truncated, and -1 if the input is otherwise invalid.
+ */
+ssize_t trn_extension_field_parse(trn_extension_field_t **output, const uint8_t *input, const size_t len_in);
+/** Return the number of bytes we expect to need to encode the
+ * trn_extension_field 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 trn_extension_field_encoded_len(const trn_extension_field_t *obj);
+/** Try to encode the trn_extension_field 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 trn_extension_field_encode(uint8_t *output, size_t avail, const trn_extension_field_t *input);
+/** Check whether the internal state of the trn_extension_field in
+ * 'obj' is consistent. Return NULL if it is, and a short message if
+ * it is not.
+ */
+const char *trn_extension_field_check(const trn_extension_field_t *obj);
+/** Clear any errors that were set on the object 'obj' by its setter
+ * functions. Return true iff errors were cleared.
+ */
+int trn_extension_field_clear_errors(trn_extension_field_t *obj);
+/** Return the value of the field_type field of the
+ * trn_extension_field_t in 'inp'
+ */
+uint8_t trn_extension_field_get_field_type(const trn_extension_field_t *inp);
+/** Set the value of the field_type field of the trn_extension_field_t
+ * in 'inp' to 'val'. Return 0 on success; return -1 and set the error
+ * code on 'inp' on failure.
+ */
+int trn_extension_field_set_field_type(trn_extension_field_t *inp, uint8_t val);
+/** Return the value of the field_len field of the
+ * trn_extension_field_t in 'inp'
+ */
+uint8_t trn_extension_field_get_field_len(const trn_extension_field_t *inp);
+/** Set the value of the field_len field of the trn_extension_field_t
+ * in 'inp' to 'val'. Return 0 on success; return -1 and set the error
+ * code on 'inp' on failure.
+ */
+int trn_extension_field_set_field_len(trn_extension_field_t *inp, uint8_t val);
+/** Return the length of the dynamic array holding the field field of
+ * the trn_extension_field_t in 'inp'.
+ */
+size_t trn_extension_field_getlen_field(const trn_extension_field_t *inp);
+/** Return the element at position 'idx' of the dynamic array field
+ * field of the trn_extension_field_t in 'inp'.
+ */
+uint8_t trn_extension_field_get_field(trn_extension_field_t *inp, size_t idx);
+/** As trn_extension_field_get_field, but take and return a const
+ * pointer
+ */
+uint8_t trn_extension_field_getconst_field(const trn_extension_field_t *inp, size_t idx);
+/** Change the element at position 'idx' of the dynamic array field
+ * field of the trn_extension_field_t in 'inp', so that it will hold
+ * the value 'elt'.
+ */
+int trn_extension_field_set_field(trn_extension_field_t *inp, size_t idx, uint8_t elt);
+/** Append a new element 'elt' to the dynamic array field field of the
+ * trn_extension_field_t in 'inp'.
+ */
+int trn_extension_field_add_field(trn_extension_field_t *inp, uint8_t elt);
+/** Return a pointer to the variable-length array field field of
+ * 'inp'.
+ */
+uint8_t * trn_extension_field_getarray_field(trn_extension_field_t *inp);
+/** As trn_extension_field_get_field, but take and return a const
+ * pointer
+ */
+const uint8_t  * trn_extension_field_getconstarray_field(const trn_extension_field_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 trn_extension_field_setlen_field(trn_extension_field_t *inp, size_t newlen);
+/** Return a newly allocated trn_extension with all elements set to
+ * zero.
+ */
+trn_extension_t *trn_extension_new(void);
+/** Release all storage held by the trn_extension in 'victim'. (Do
+ * nothing if 'victim' is NULL.)
+ */
+void trn_extension_free(trn_extension_t *victim);
+/** Try to parse a trn_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_extension_t. On failure, return -2 if the input appears
+ * truncated, and -1 if the input is otherwise invalid.
+ */
+ssize_t trn_extension_parse(trn_extension_t **output, const uint8_t *input, const size_t len_in);
+/** Return the number of bytes we expect to need to encode the
+ * trn_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 trn_extension_encoded_len(const trn_extension_t *obj);
+/** Try to encode the trn_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 trn_extension_encode(uint8_t *output, size_t avail, const trn_extension_t *input);
+/** Check whether the internal state of the trn_extension in 'obj' is
+ * consistent. Return NULL if it is, and a short message if it is not.
+ */
+const char *trn_extension_check(const trn_extension_t *obj);
+/** Clear any errors that were set on the object 'obj' by its setter
+ * functions. Return true iff errors were cleared.
+ */
+int trn_extension_clear_errors(trn_extension_t *obj);
+/** Return the value of the num field of the trn_extension_t in 'inp'
+ */
+uint8_t trn_extension_get_num(const trn_extension_t *inp);
+/** Set the value of the num field of the trn_extension_t in 'inp' to
+ * 'val'. Return 0 on success; return -1 and set the error code on
+ * 'inp' on failure.
+ */
+int trn_extension_set_num(trn_extension_t *inp, uint8_t val);
+/** Return the length of the dynamic array holding the fields field of
+ * the trn_extension_t in 'inp'.
+ */
+size_t trn_extension_getlen_fields(const trn_extension_t *inp);
+/** Return the element at position 'idx' of the dynamic array field
+ * fields of the trn_extension_t in 'inp'.
+ */
+struct trn_extension_field_st * trn_extension_get_fields(trn_extension_t *inp, size_t idx);
+/** As trn_extension_get_fields, but take and return a const pointer
+ */
+ const struct trn_extension_field_st * trn_extension_getconst_fields(const trn_extension_t *inp, size_t idx);
+/** Change the element at position 'idx' of the dynamic array field
+ * fields of the trn_extension_t in 'inp', so that it will hold the
+ * value 'elt'. Free the previous value, if any.
+ */
+int trn_extension_set_fields(trn_extension_t *inp, size_t idx, struct trn_extension_field_st * elt);
+/** As trn_extension_set_fields, but does not free the previous value.
+ */
+int trn_extension_set0_fields(trn_extension_t *inp, size_t idx, struct trn_extension_field_st * elt);
+/** Append a new element 'elt' to the dynamic array field fields of
+ * the trn_extension_t in 'inp'.
+ */
+int trn_extension_add_fields(trn_extension_t *inp, struct trn_extension_field_st * elt);
+/** Return a pointer to the variable-length array field fields of
+ * 'inp'.
+ */
+struct trn_extension_field_st * * trn_extension_getarray_fields(trn_extension_t *inp);
+/** As trn_extension_get_fields, but take and return a const pointer
+ */
+const struct trn_extension_field_st *  const  * trn_extension_getconstarray_fields(const trn_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 trn_extension_setlen_fields(trn_extension_t *inp, size_t newlen);
+
+
+#endif
diff --git a/src/trunnel/extension.trunnel b/src/trunnel/extension.trunnel
new file mode 100644
index 0000000000..177eba0596
--- /dev/null
+++ b/src/trunnel/extension.trunnel
@@ -0,0 +1,14 @@
+
+/* The cell extension ABI that is also used within other type of structures
+ * such as the ntorv3 data payload. */
+
+struct trn_extension_field {
+  u8 field_type;
+  u8 field_len;
+  u8 field[field_len];
+};
+
+struct trn_extension {
+  u8 num;
+  struct trn_extension_field fields[num];
+};
diff --git a/src/trunnel/hs/cell_common.h b/src/trunnel/hs/cell_common.h
deleted file mode 100644
index beb65e015f..0000000000
--- a/src/trunnel/hs/cell_common.h
+++ /dev/null
@@ -1,203 +0,0 @@
-/* cell_common.h -- generated by Trunnel v1.5.3.
- * https://gitweb.torproject.org/trunnel.git
- * You probably shouldn't edit this file.
- */
-#ifndef TRUNNEL_CELL_COMMON_H
-#define TRUNNEL_CELL_COMMON_H
-
-#include <stdint.h>
-#include "trunnel.h"
-
-#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_TRN_CELL_EXTENSION_FIELD)
-struct trn_cell_extension_field_st {
-  uint8_t field_type;
-  uint8_t field_len;
-  TRUNNEL_DYNARRAY_HEAD(, uint8_t) field;
-  uint8_t trunnel_error_code_;
-};
-#endif
-typedef struct trn_cell_extension_field_st trn_cell_extension_field_t;
-#if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_TRN_CELL_EXTENSION)
-struct trn_cell_extension_st {
-  uint8_t num;
-  TRUNNEL_DYNARRAY_HEAD(, struct trn_cell_extension_field_st *) fields;
-  uint8_t trunnel_error_code_;
-};
-#endif
-typedef struct trn_cell_extension_st trn_cell_extension_t;
-/** Return a newly allocated trn_cell_extension_field with all
- * elements set to zero.
- */
-trn_cell_extension_field_t *trn_cell_extension_field_new(void);
-/** Release all storage held by the trn_cell_extension_field in
- * 'victim'. (Do nothing if 'victim' is NULL.)
- */
-void trn_cell_extension_field_free(trn_cell_extension_field_t *victim);
-/** Try to parse a trn_cell_extension_field 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_field_t. On failure, return -2
- * if the input appears truncated, and -1 if the input is otherwise
- * invalid.
- */
-ssize_t trn_cell_extension_field_parse(trn_cell_extension_field_t **output, const uint8_t *input, const size_t len_in);
-/** Return the number of bytes we expect to need to encode the
- * trn_cell_extension_field 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 trn_cell_extension_field_encoded_len(const trn_cell_extension_field_t *obj);
-/** Try to encode the trn_cell_extension_field 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 trn_cell_extension_field_encode(uint8_t *output, size_t avail, const trn_cell_extension_field_t *input);
-/** Check whether the internal state of the trn_cell_extension_field
- * in 'obj' is consistent. Return NULL if it is, and a short message
- * if it is not.
- */
-const char *trn_cell_extension_field_check(const trn_cell_extension_field_t *obj);
-/** Clear any errors that were set on the object 'obj' by its setter
- * functions. Return true iff errors were cleared.
- */
-int trn_cell_extension_field_clear_errors(trn_cell_extension_field_t *obj);
-/** Return the value of the field_type field of the
- * trn_cell_extension_field_t in 'inp'
- */
-uint8_t trn_cell_extension_field_get_field_type(const trn_cell_extension_field_t *inp);
-/** Set the value of the field_type field of the
- * trn_cell_extension_field_t in 'inp' to 'val'. Return 0 on success;
- * return -1 and set the error code on 'inp' on failure.
- */
-int trn_cell_extension_field_set_field_type(trn_cell_extension_field_t *inp, uint8_t val);
-/** Return the value of the field_len field of the
- * trn_cell_extension_field_t in 'inp'
- */
-uint8_t trn_cell_extension_field_get_field_len(const trn_cell_extension_field_t *inp);
-/** Set the value of the field_len field of the
- * trn_cell_extension_field_t in 'inp' to 'val'. Return 0 on success;
- * return -1 and set the error code on 'inp' on failure.
- */
-int trn_cell_extension_field_set_field_len(trn_cell_extension_field_t *inp, uint8_t val);
-/** Return the length of the dynamic array holding the field field of
- * the trn_cell_extension_field_t in 'inp'.
- */
-size_t trn_cell_extension_field_getlen_field(const trn_cell_extension_field_t *inp);
-/** Return the element at position 'idx' of the dynamic array field
- * field of the trn_cell_extension_field_t in 'inp'.
- */
-uint8_t trn_cell_extension_field_get_field(trn_cell_extension_field_t *inp, size_t idx);
-/** As trn_cell_extension_field_get_field, but take and return a const
- * pointer
- */
-uint8_t trn_cell_extension_field_getconst_field(const trn_cell_extension_field_t *inp, size_t idx);
-/** Change the element at position 'idx' of the dynamic array field
- * field of the trn_cell_extension_field_t in 'inp', so that it will
- * hold the value 'elt'.
- */
-int trn_cell_extension_field_set_field(trn_cell_extension_field_t *inp, size_t idx, uint8_t elt);
-/** Append a new element 'elt' to the dynamic array field field of the
- * trn_cell_extension_field_t in 'inp'.
- */
-int trn_cell_extension_field_add_field(trn_cell_extension_field_t *inp, uint8_t elt);
-/** Return a pointer to the variable-length array field field of
- * 'inp'.
- */
-uint8_t * trn_cell_extension_field_getarray_field(trn_cell_extension_field_t *inp);
-/** As trn_cell_extension_field_get_field, but take and return a const
- * pointer
- */
-const uint8_t  * trn_cell_extension_field_getconstarray_field(const trn_cell_extension_field_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 trn_cell_extension_field_setlen_field(trn_cell_extension_field_t *inp, size_t newlen);
-/** Return a newly allocated trn_cell_extension with all elements set
- * to zero.
- */
-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 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 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
- * 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 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 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 *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 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 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 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 trn_cell_extension_t in '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 trn_cell_extension_t in 'inp'.
- */
-struct trn_cell_extension_field_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 trn_cell_extension_field_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 trn_cell_extension_t in 'inp', so that it will hold
- * the value 'elt'. Free the previous value, if any.
- */
-int trn_cell_extension_set_fields(trn_cell_extension_t *inp, size_t idx, struct trn_cell_extension_field_st * elt);
-/** As trn_cell_extension_set_fields, but does not free the previous
- * value.
- */
-int trn_cell_extension_set0_fields(trn_cell_extension_t *inp, size_t idx, struct trn_cell_extension_field_st * elt);
-/** Append a new element 'elt' to the dynamic array field fields of
- * the trn_cell_extension_t in 'inp'.
- */
-int trn_cell_extension_add_fields(trn_cell_extension_t *inp, struct trn_cell_extension_field_st * elt);
-/** Return a pointer to the variable-length array field fields of
- * 'inp'.
- */
-struct trn_cell_extension_field_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 trn_cell_extension_field_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 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
deleted file mode 100644
index 7e99cbfa66..0000000000
--- a/src/trunnel/hs/cell_common.trunnel
+++ /dev/null
@@ -1,12 +0,0 @@
-/* This file contains common data structure that cells use. */
-
-struct trn_cell_extension_field {
-  u8 field_type;
-  u8 field_len;
-  u8 field[field_len];
-};
-
-struct trn_cell_extension {
-  u8 num;
-  struct trn_cell_extension_field fields[num];
-};
diff --git a/src/trunnel/hs/cell_establish_intro.c b/src/trunnel/hs/cell_establish_intro.c
index f31404c55f..0f561b121b 100644
--- a/src/trunnel/hs/cell_establish_intro.c
+++ b/src/trunnel/hs/cell_establish_intro.c
@@ -28,14 +28,14 @@ int cellestablishintro_deadcode_dummy__ = 0;
     }                                                            \
   } while (0)
 
-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 trn_extension_st trn_extension_t;
+trn_extension_t *trn_extension_new(void);
+void trn_extension_free(trn_extension_t *victim);
+ssize_t trn_extension_parse(trn_extension_t **output, const uint8_t *input, const size_t len_in);
+ssize_t trn_extension_encoded_len(const trn_extension_t *obj);
+ssize_t trn_extension_encode(uint8_t *output, size_t avail, const trn_extension_t *input);
+const char *trn_extension_check(const trn_extension_t *obj);
+int trn_extension_clear_errors(trn_extension_t *obj);
 trn_cell_extension_dos_param_t *
 trn_cell_extension_dos_param_new(void)
 {
@@ -232,7 +232,7 @@ 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);
-  trn_cell_extension_free(obj->extensions);
+  trn_extension_free(obj->extensions);
   obj->extensions = NULL;
   TRUNNEL_DYNARRAY_WIPE(&obj->sig);
   TRUNNEL_DYNARRAY_CLEAR(&obj->sig);
@@ -346,25 +346,25 @@ trn_cell_establish_intro_setlen_auth_key(trn_cell_establish_intro_t *inp, size_t
   TRUNNEL_SET_ERROR_CODE(inp);
   return -1;
 }
-struct trn_cell_extension_st *
+struct trn_extension_st *
 trn_cell_establish_intro_get_extensions(trn_cell_establish_intro_t *inp)
 {
   return inp->extensions;
 }
-const struct trn_cell_extension_st *
+const struct trn_extension_st *
 trn_cell_establish_intro_getconst_extensions(const trn_cell_establish_intro_t *inp)
 {
   return trn_cell_establish_intro_get_extensions((trn_cell_establish_intro_t*) inp);
 }
 int
-trn_cell_establish_intro_set_extensions(trn_cell_establish_intro_t *inp, struct trn_cell_extension_st *val)
+trn_cell_establish_intro_set_extensions(trn_cell_establish_intro_t *inp, struct trn_extension_st *val)
 {
   if (inp->extensions && inp->extensions != val)
-    trn_cell_extension_free(inp->extensions);
+    trn_extension_free(inp->extensions);
   return trn_cell_establish_intro_set0_extensions(inp, val);
 }
 int
-trn_cell_establish_intro_set0_extensions(trn_cell_establish_intro_t *inp, struct trn_cell_extension_st *val)
+trn_cell_establish_intro_set0_extensions(trn_cell_establish_intro_t *inp, struct trn_extension_st *val)
 {
   inp->extensions = val;
   return 0;
@@ -506,7 +506,7 @@ trn_cell_establish_intro_check(const trn_cell_establish_intro_t *obj)
     return "Length mismatch for auth_key";
   {
     const char *msg;
-    if (NULL != (msg = trn_cell_extension_check(obj->extensions)))
+    if (NULL != (msg = trn_extension_check(obj->extensions)))
       return msg;
   }
   if (TRUNNEL_DYNARRAY_LEN(&obj->sig) != obj->sig_len)
@@ -532,8 +532,8 @@ trn_cell_establish_intro_encoded_len(const trn_cell_establish_intro_t *obj)
   /* Length of u8 auth_key[auth_key_len] */
   result += TRUNNEL_DYNARRAY_LEN(&obj->auth_key);
 
-  /* Length of struct trn_cell_extension extensions */
-  result += trn_cell_extension_encoded_len(obj->extensions);
+  /* Length of struct trn_extension extensions */
+  result += trn_extension_encoded_len(obj->extensions);
 
   /* Length of u8 handshake_mac[TRUNNEL_SHA3_256_LEN] */
   result += TRUNNEL_SHA3_256_LEN;
@@ -596,9 +596,9 @@ trn_cell_establish_intro_encode(uint8_t *output, const size_t avail, const trn_c
     written += elt_len; ptr += elt_len;
   }
 
-  /* Encode struct trn_cell_extension extensions */
+  /* Encode struct trn_extension extensions */
   trunnel_assert(written <= avail);
-  result = trn_cell_extension_encode(ptr, avail - written, obj->extensions);
+  result = trn_extension_encode(ptr, avail - written, obj->extensions);
   if (result < 0)
     goto fail; /* XXXXXXX !*/
   written += result; ptr += result;
@@ -685,8 +685,8 @@ trn_cell_establish_intro_parse_into(trn_cell_establish_intro_t *obj, const uint8
     memcpy(obj->auth_key.elts_, ptr, obj->auth_key_len);
   ptr += obj->auth_key_len; remaining -= obj->auth_key_len;
 
-  /* Parse struct trn_cell_extension extensions */
-  result = trn_cell_extension_parse(&obj->extensions, ptr, remaining);
+  /* Parse struct trn_extension extensions */
+  result = trn_extension_parse(&obj->extensions, ptr, remaining);
   if (result < 0)
     goto relay_fail;
   trunnel_assert((size_t)result <= remaining);
@@ -1045,7 +1045,7 @@ static void
 trn_cell_intro_established_clear(trn_cell_intro_established_t *obj)
 {
   (void) obj;
-  trn_cell_extension_free(obj->extensions);
+  trn_extension_free(obj->extensions);
   obj->extensions = NULL;
 }
 
@@ -1059,25 +1059,25 @@ trn_cell_intro_established_free(trn_cell_intro_established_t *obj)
   trunnel_free_(obj);
 }
 
-struct trn_cell_extension_st *
+struct trn_extension_st *
 trn_cell_intro_established_get_extensions(trn_cell_intro_established_t *inp)
 {
   return inp->extensions;
 }
-const struct trn_cell_extension_st *
+const struct trn_extension_st *
 trn_cell_intro_established_getconst_extensions(const trn_cell_intro_established_t *inp)
 {
   return trn_cell_intro_established_get_extensions((trn_cell_intro_established_t*) inp);
 }
 int
-trn_cell_intro_established_set_extensions(trn_cell_intro_established_t *inp, struct trn_cell_extension_st *val)
+trn_cell_intro_established_set_extensions(trn_cell_intro_established_t *inp, struct trn_extension_st *val)
 {
   if (inp->extensions && inp->extensions != val)
-    trn_cell_extension_free(inp->extensions);
+    trn_extension_free(inp->extensions);
   return trn_cell_intro_established_set0_extensions(inp, val);
 }
 int
-trn_cell_intro_established_set0_extensions(trn_cell_intro_established_t *inp, struct trn_cell_extension_st *val)
+trn_cell_intro_established_set0_extensions(trn_cell_intro_established_t *inp, struct trn_extension_st *val)
 {
   inp->extensions = val;
   return 0;
@@ -1091,7 +1091,7 @@ trn_cell_intro_established_check(const trn_cell_intro_established_t *obj)
     return "A set function failed on this object";
   {
     const char *msg;
-    if (NULL != (msg = trn_cell_extension_check(obj->extensions)))
+    if (NULL != (msg = trn_extension_check(obj->extensions)))
       return msg;
   }
   return NULL;
@@ -1106,8 +1106,8 @@ trn_cell_intro_established_encoded_len(const trn_cell_intro_established_t *obj)
      return -1;
 
 
-  /* Length of struct trn_cell_extension extensions */
-  result += trn_cell_extension_encoded_len(obj->extensions);
+  /* Length of struct trn_extension extensions */
+  result += trn_extension_encoded_len(obj->extensions);
   return result;
 }
 int
@@ -1135,9 +1135,9 @@ trn_cell_intro_established_encode(uint8_t *output, const size_t avail, const trn
   trunnel_assert(encoded_len >= 0);
 #endif
 
-  /* Encode struct trn_cell_extension extensions */
+  /* Encode struct trn_extension extensions */
   trunnel_assert(written <= avail);
-  result = trn_cell_extension_encode(ptr, avail - written, obj->extensions);
+  result = trn_extension_encode(ptr, avail - written, obj->extensions);
   if (result < 0)
     goto fail; /* XXXXXXX !*/
   written += result; ptr += result;
@@ -1174,8 +1174,8 @@ trn_cell_intro_established_parse_into(trn_cell_intro_established_t *obj, const u
   ssize_t result = 0;
   (void)result;
 
-  /* Parse struct trn_cell_extension extensions */
-  result = trn_cell_extension_parse(&obj->extensions, ptr, remaining);
+  /* Parse struct trn_extension extensions */
+  result = trn_extension_parse(&obj->extensions, ptr, remaining);
   if (result < 0)
     goto relay_fail;
   trunnel_assert((size_t)result <= remaining);
diff --git a/src/trunnel/hs/cell_establish_intro.h b/src/trunnel/hs/cell_establish_intro.h
index 1924d9cab6..8be1531ed1 100644
--- a/src/trunnel/hs/cell_establish_intro.h
+++ b/src/trunnel/hs/cell_establish_intro.h
@@ -8,7 +8,7 @@
 #include <stdint.h>
 #include "trunnel.h"
 
-struct trn_cell_extension_st;
+struct trn_extension_st;
 #define TRUNNEL_SHA3_256_LEN 32
 #define TRUNNEL_CELL_EXTENSION_TYPE_DOS 1
 #define TRUNNEL_DOS_PARAM_TYPE_INTRO2_RATE_PER_SEC 1
@@ -27,7 +27,7 @@ struct trn_cell_establish_intro_st {
   uint8_t auth_key_type;
   uint16_t auth_key_len;
   TRUNNEL_DYNARRAY_HEAD(, uint8_t) auth_key;
-  struct trn_cell_extension_st *extensions;
+  struct trn_extension_st *extensions;
   const uint8_t *end_mac_fields;
   uint8_t handshake_mac[TRUNNEL_SHA3_256_LEN];
   const uint8_t *end_sig_fields;
@@ -47,7 +47,7 @@ struct trn_cell_extension_dos_st {
 typedef struct trn_cell_extension_dos_st trn_cell_extension_dos_t;
 #if !defined(TRUNNEL_OPAQUE) && !defined(TRUNNEL_OPAQUE_TRN_CELL_INTRO_ESTABLISHED)
 struct trn_cell_intro_established_st {
-  struct trn_cell_extension_st *extensions;
+  struct trn_extension_st *extensions;
   uint8_t trunnel_error_code_;
 };
 #endif
@@ -203,21 +203,21 @@ int trn_cell_establish_intro_setlen_auth_key(trn_cell_establish_intro_t *inp, si
 /** Return the value of the extensions field of the
  * trn_cell_establish_intro_t in 'inp'
  */
-struct trn_cell_extension_st * trn_cell_establish_intro_get_extensions(trn_cell_establish_intro_t *inp);
+struct trn_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 trn_cell_extension_st * trn_cell_establish_intro_getconst_extensions(const trn_cell_establish_intro_t *inp);
+const struct trn_extension_st * trn_cell_establish_intro_getconst_extensions(const trn_cell_establish_intro_t *inp);
 /** Set the value of the extensions field of the
  * 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 trn_cell_establish_intro_set_extensions(trn_cell_establish_intro_t *inp, struct trn_cell_extension_st *val);
+int trn_cell_establish_intro_set_extensions(trn_cell_establish_intro_t *inp, struct trn_extension_st *val);
 /** As trn_cell_establish_intro_set_extensions, but does not free the
  * previous value.
  */
-int trn_cell_establish_intro_set0_extensions(trn_cell_establish_intro_t *inp, struct trn_cell_extension_st *val);
+int trn_cell_establish_intro_set0_extensions(trn_cell_establish_intro_t *inp, struct trn_extension_st *val);
 /** Return the position for end_mac_fields when we parsed this object
  */
 const uint8_t * trn_cell_establish_intro_get_end_mac_fields(const trn_cell_establish_intro_t *inp);
@@ -415,21 +415,21 @@ int trn_cell_intro_established_clear_errors(trn_cell_intro_established_t *obj);
 /** Return the value of the extensions field of the
  * trn_cell_intro_established_t in 'inp'
  */
-struct trn_cell_extension_st * trn_cell_intro_established_get_extensions(trn_cell_intro_established_t *inp);
+struct trn_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 trn_cell_extension_st * trn_cell_intro_established_getconst_extensions(const trn_cell_intro_established_t *inp);
+const struct trn_extension_st * trn_cell_intro_established_getconst_extensions(const trn_cell_intro_established_t *inp);
 /** Set the value of the extensions field of the
  * 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 trn_cell_intro_established_set_extensions(trn_cell_intro_established_t *inp, struct trn_cell_extension_st *val);
+int trn_cell_intro_established_set_extensions(trn_cell_intro_established_t *inp, struct trn_extension_st *val);
 /** As trn_cell_intro_established_set_extensions, but does not free
  * the previous value.
  */
-int trn_cell_intro_established_set0_extensions(trn_cell_intro_established_t *inp, struct trn_cell_extension_st *val);
+int trn_cell_intro_established_set0_extensions(trn_cell_intro_established_t *inp, struct trn_extension_st *val);
 
 
 #endif
diff --git a/src/trunnel/hs/cell_establish_intro.trunnel b/src/trunnel/hs/cell_establish_intro.trunnel
index e30938f6c2..b33f8c1c93 100644
--- a/src/trunnel/hs/cell_establish_intro.trunnel
+++ b/src/trunnel/hs/cell_establish_intro.trunnel
@@ -4,7 +4,7 @@
  * specified in proposal 224 section 3.1.
  */
 
-extern struct trn_cell_extension;
+extern struct trn_extension;
 
 const TRUNNEL_SHA3_256_LEN = 32;
 
@@ -19,7 +19,7 @@ struct trn_cell_establish_intro {
   u8 auth_key[auth_key_len];
 
   /* Extension(s). Reserved fields. */
-  struct trn_cell_extension extensions;
+  struct trn_extension extensions;
   @ptr end_mac_fields;
 
   /* Handshake MAC. */
@@ -37,7 +37,7 @@ struct trn_cell_establish_intro {
  * to version >= 3. */
 struct trn_cell_intro_established {
   /* Extension(s). Reserved fields. */
-  struct trn_cell_extension extensions;
+  struct trn_extension extensions;
 };
 
 /*
diff --git a/src/trunnel/hs/cell_introduce1.c b/src/trunnel/hs/cell_introduce1.c
index 016c9fa8d6..a6873b4199 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 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 trn_extension_st trn_extension_t;
+trn_extension_t *trn_extension_new(void);
+void trn_extension_free(trn_extension_t *victim);
+ssize_t trn_extension_parse(trn_extension_t **output, const uint8_t *input, const size_t len_in);
+ssize_t trn_extension_encoded_len(const trn_extension_t *obj);
+ssize_t trn_extension_encode(uint8_t *output, size_t avail, const trn_extension_t *input);
+const char *trn_extension_check(const trn_extension_t *obj);
+int trn_extension_clear_errors(trn_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);
@@ -62,7 +62,7 @@ trn_cell_introduce1_clear(trn_cell_introduce1_t *obj)
   (void) obj;
   TRUNNEL_DYNARRAY_WIPE(&obj->auth_key);
   TRUNNEL_DYNARRAY_CLEAR(&obj->auth_key);
-  trn_cell_extension_free(obj->extensions);
+  trn_extension_free(obj->extensions);
   obj->extensions = NULL;
   TRUNNEL_DYNARRAY_WIPE(&obj->encrypted);
   TRUNNEL_DYNARRAY_CLEAR(&obj->encrypted);
@@ -207,25 +207,25 @@ trn_cell_introduce1_setlen_auth_key(trn_cell_introduce1_t *inp, size_t newlen)
   TRUNNEL_SET_ERROR_CODE(inp);
   return -1;
 }
-struct trn_cell_extension_st *
+struct trn_extension_st *
 trn_cell_introduce1_get_extensions(trn_cell_introduce1_t *inp)
 {
   return inp->extensions;
 }
-const struct trn_cell_extension_st *
+const struct trn_extension_st *
 trn_cell_introduce1_getconst_extensions(const trn_cell_introduce1_t *inp)
 {
   return trn_cell_introduce1_get_extensions((trn_cell_introduce1_t*) inp);
 }
 int
-trn_cell_introduce1_set_extensions(trn_cell_introduce1_t *inp, struct trn_cell_extension_st *val)
+trn_cell_introduce1_set_extensions(trn_cell_introduce1_t *inp, struct trn_extension_st *val)
 {
   if (inp->extensions && inp->extensions != val)
-    trn_cell_extension_free(inp->extensions);
+    trn_extension_free(inp->extensions);
   return trn_cell_introduce1_set0_extensions(inp, val);
 }
 int
-trn_cell_introduce1_set0_extensions(trn_cell_introduce1_t *inp, struct trn_cell_extension_st *val)
+trn_cell_introduce1_set0_extensions(trn_cell_introduce1_t *inp, struct trn_extension_st *val)
 {
   inp->extensions = val;
   return 0;
@@ -302,7 +302,7 @@ trn_cell_introduce1_check(const trn_cell_introduce1_t *obj)
     return "Length mismatch for auth_key";
   {
     const char *msg;
-    if (NULL != (msg = trn_cell_extension_check(obj->extensions)))
+    if (NULL != (msg = trn_extension_check(obj->extensions)))
       return msg;
   }
   return NULL;
@@ -329,8 +329,8 @@ trn_cell_introduce1_encoded_len(const trn_cell_introduce1_t *obj)
   /* Length of u8 auth_key[auth_key_len] */
   result += TRUNNEL_DYNARRAY_LEN(&obj->auth_key);
 
-  /* Length of struct trn_cell_extension extensions */
-  result += trn_cell_extension_encoded_len(obj->extensions);
+  /* Length of struct trn_extension extensions */
+  result += trn_extension_encoded_len(obj->extensions);
 
   /* Length of u8 encrypted[] */
   result += TRUNNEL_DYNARRAY_LEN(&obj->encrypted);
@@ -394,9 +394,9 @@ trn_cell_introduce1_encode(uint8_t *output, const size_t avail, const trn_cell_i
     written += elt_len; ptr += elt_len;
   }
 
-  /* Encode struct trn_cell_extension extensions */
+  /* Encode struct trn_extension extensions */
   trunnel_assert(written <= avail);
-  result = trn_cell_extension_encode(ptr, avail - written, obj->extensions);
+  result = trn_extension_encode(ptr, avail - written, obj->extensions);
   if (result < 0)
     goto fail; /* XXXXXXX !*/
   written += result; ptr += result;
@@ -472,8 +472,8 @@ trn_cell_introduce1_parse_into(trn_cell_introduce1_t *obj, const uint8_t *input,
     memcpy(obj->auth_key.elts_, ptr, obj->auth_key_len);
   ptr += obj->auth_key_len; remaining -= obj->auth_key_len;
 
-  /* Parse struct trn_cell_extension extensions */
-  result = trn_cell_extension_parse(&obj->extensions, ptr, remaining);
+  /* Parse struct trn_extension extensions */
+  result = trn_extension_parse(&obj->extensions, ptr, remaining);
   if (result < 0)
     goto relay_fail;
   trunnel_assert((size_t)result <= remaining);
@@ -529,7 +529,7 @@ static void
 trn_cell_introduce_ack_clear(trn_cell_introduce_ack_t *obj)
 {
   (void) obj;
-  trn_cell_extension_free(obj->extensions);
+  trn_extension_free(obj->extensions);
   obj->extensions = NULL;
 }
 
@@ -554,25 +554,25 @@ trn_cell_introduce_ack_set_status(trn_cell_introduce_ack_t *inp, uint16_t val)
   inp->status = val;
   return 0;
 }
-struct trn_cell_extension_st *
+struct trn_extension_st *
 trn_cell_introduce_ack_get_extensions(trn_cell_introduce_ack_t *inp)
 {
   return inp->extensions;
 }
-const struct trn_cell_extension_st *
+const struct trn_extension_st *
 trn_cell_introduce_ack_getconst_extensions(const trn_cell_introduce_ack_t *inp)
 {
   return trn_cell_introduce_ack_get_extensions((trn_cell_introduce_ack_t*) inp);
 }
 int
-trn_cell_introduce_ack_set_extensions(trn_cell_introduce_ack_t *inp, struct trn_cell_extension_st *val)
+trn_cell_introduce_ack_set_extensions(trn_cell_introduce_ack_t *inp, struct trn_extension_st *val)
 {
   if (inp->extensions && inp->extensions != val)
-    trn_cell_extension_free(inp->extensions);
+    trn_extension_free(inp->extensions);
   return trn_cell_introduce_ack_set0_extensions(inp, val);
 }
 int
-trn_cell_introduce_ack_set0_extensions(trn_cell_introduce_ack_t *inp, struct trn_cell_extension_st *val)
+trn_cell_introduce_ack_set0_extensions(trn_cell_introduce_ack_t *inp, struct trn_extension_st *val)
 {
   inp->extensions = val;
   return 0;
@@ -586,7 +586,7 @@ trn_cell_introduce_ack_check(const trn_cell_introduce_ack_t *obj)
     return "A set function failed on this object";
   {
     const char *msg;
-    if (NULL != (msg = trn_cell_extension_check(obj->extensions)))
+    if (NULL != (msg = trn_extension_check(obj->extensions)))
       return msg;
   }
   return NULL;
@@ -604,8 +604,8 @@ trn_cell_introduce_ack_encoded_len(const trn_cell_introduce_ack_t *obj)
   /* Length of u16 status */
   result += 2;
 
-  /* Length of struct trn_cell_extension extensions */
-  result += trn_cell_extension_encoded_len(obj->extensions);
+  /* Length of struct trn_extension extensions */
+  result += trn_extension_encoded_len(obj->extensions);
   return result;
 }
 int
@@ -640,9 +640,9 @@ trn_cell_introduce_ack_encode(uint8_t *output, const size_t avail, const trn_cel
   trunnel_set_uint16(ptr, trunnel_htons(obj->status));
   written += 2; ptr += 2;
 
-  /* Encode struct trn_cell_extension extensions */
+  /* Encode struct trn_extension extensions */
   trunnel_assert(written <= avail);
-  result = trn_cell_extension_encode(ptr, avail - written, obj->extensions);
+  result = trn_extension_encode(ptr, avail - written, obj->extensions);
   if (result < 0)
     goto fail; /* XXXXXXX !*/
   written += result; ptr += result;
@@ -687,8 +687,8 @@ trn_cell_introduce_ack_parse_into(trn_cell_introduce_ack_t *obj, const uint8_t *
   obj->status = trunnel_ntohs(trunnel_get_uint16(ptr));
   remaining -= 2; ptr += 2;
 
-  /* Parse struct trn_cell_extension extensions */
-  result = trn_cell_extension_parse(&obj->extensions, ptr, remaining);
+  /* Parse struct trn_extension extensions */
+  result = trn_extension_parse(&obj->extensions, ptr, remaining);
   if (result < 0)
     goto relay_fail;
   trunnel_assert((size_t)result <= remaining);
@@ -733,7 +733,7 @@ static void
 trn_cell_introduce_encrypted_clear(trn_cell_introduce_encrypted_t *obj)
 {
   (void) obj;
-  trn_cell_extension_free(obj->extensions);
+  trn_extension_free(obj->extensions);
   obj->extensions = NULL;
   TRUNNEL_DYNARRAY_WIPE(&obj->onion_key);
   TRUNNEL_DYNARRAY_CLEAR(&obj->onion_key);
@@ -796,25 +796,25 @@ trn_cell_introduce_encrypted_getconstarray_rend_cookie(const trn_cell_introduce_
 {
   return (const uint8_t  *)trn_cell_introduce_encrypted_getarray_rend_cookie((trn_cell_introduce_encrypted_t*)inp);
 }
-struct trn_cell_extension_st *
+struct trn_extension_st *
 trn_cell_introduce_encrypted_get_extensions(trn_cell_introduce_encrypted_t *inp)
 {
   return inp->extensions;
 }
-const struct trn_cell_extension_st *
+const struct trn_extension_st *
 trn_cell_introduce_encrypted_getconst_extensions(const trn_cell_introduce_encrypted_t *inp)
 {
   return trn_cell_introduce_encrypted_get_extensions((trn_cell_introduce_encrypted_t*) inp);
 }
 int
-trn_cell_introduce_encrypted_set_extensions(trn_cell_introduce_encrypted_t *inp, struct trn_cell_extension_st *val)
+trn_cell_introduce_encrypted_set_extensions(trn_cell_introduce_encrypted_t *inp, struct trn_extension_st *val)
 {
   if (inp->extensions && inp->extensions != val)
-    trn_cell_extension_free(inp->extensions);
+    trn_extension_free(inp->extensions);
   return trn_cell_introduce_encrypted_set0_extensions(inp, val);
 }
 int
-trn_cell_introduce_encrypted_set0_extensions(trn_cell_introduce_encrypted_t *inp, struct trn_cell_extension_st *val)
+trn_cell_introduce_encrypted_set0_extensions(trn_cell_introduce_encrypted_t *inp, struct trn_extension_st *val)
 {
   inp->extensions = val;
   return 0;
@@ -1066,7 +1066,7 @@ trn_cell_introduce_encrypted_check(const trn_cell_introduce_encrypted_t *obj)
     return "A set function failed on this object";
   {
     const char *msg;
-    if (NULL != (msg = trn_cell_extension_check(obj->extensions)))
+    if (NULL != (msg = trn_extension_check(obj->extensions)))
       return msg;
   }
   if (! (obj->onion_key_type == TRUNNEL_HS_INTRO_ONION_KEY_TYPE_NTOR))
@@ -1099,8 +1099,8 @@ trn_cell_introduce_encrypted_encoded_len(const trn_cell_introduce_encrypted_t *o
   /* Length of u8 rend_cookie[TRUNNEL_REND_COOKIE_LEN] */
   result += TRUNNEL_REND_COOKIE_LEN;
 
-  /* Length of struct trn_cell_extension extensions */
-  result += trn_cell_extension_encoded_len(obj->extensions);
+  /* Length of struct trn_extension extensions */
+  result += trn_extension_encoded_len(obj->extensions);
 
   /* Length of u8 onion_key_type IN [TRUNNEL_HS_INTRO_ONION_KEY_TYPE_NTOR] */
   result += 1;
@@ -1159,9 +1159,9 @@ trn_cell_introduce_encrypted_encode(uint8_t *output, const size_t avail, const t
   memcpy(ptr, obj->rend_cookie, TRUNNEL_REND_COOKIE_LEN);
   written += TRUNNEL_REND_COOKIE_LEN; ptr += TRUNNEL_REND_COOKIE_LEN;
 
-  /* Encode struct trn_cell_extension extensions */
+  /* Encode struct trn_extension extensions */
   trunnel_assert(written <= avail);
-  result = trn_cell_extension_encode(ptr, avail - written, obj->extensions);
+  result = trn_extension_encode(ptr, avail - written, obj->extensions);
   if (result < 0)
     goto fail; /* XXXXXXX !*/
   written += result; ptr += result;
@@ -1263,8 +1263,8 @@ trn_cell_introduce_encrypted_parse_into(trn_cell_introduce_encrypted_t *obj, con
   memcpy(obj->rend_cookie, ptr, TRUNNEL_REND_COOKIE_LEN);
   remaining -= TRUNNEL_REND_COOKIE_LEN; ptr += TRUNNEL_REND_COOKIE_LEN;
 
-  /* Parse struct trn_cell_extension extensions */
-  result = trn_cell_extension_parse(&obj->extensions, ptr, remaining);
+  /* Parse struct trn_extension extensions */
+  result = trn_extension_parse(&obj->extensions, ptr, remaining);
   if (result < 0)
     goto relay_fail;
   trunnel_assert((size_t)result <= remaining);
diff --git a/src/trunnel/hs/cell_introduce1.h b/src/trunnel/hs/cell_introduce1.h
index 8dabff3cb5..ea37502d8e 100644
--- a/src/trunnel/hs/cell_introduce1.h
+++ b/src/trunnel/hs/cell_introduce1.h
@@ -8,7 +8,7 @@
 #include <stdint.h>
 #include "trunnel.h"
 
-struct trn_cell_extension_st;
+struct trn_extension_st;
 struct link_specifier_st;
 #define TRUNNEL_SHA1_LEN 20
 #define TRUNNEL_REND_COOKIE_LEN 20
@@ -25,7 +25,7 @@ struct trn_cell_introduce1_st {
   uint8_t auth_key_type;
   uint16_t auth_key_len;
   TRUNNEL_DYNARRAY_HEAD(, uint8_t) auth_key;
-  struct trn_cell_extension_st *extensions;
+  struct trn_extension_st *extensions;
   TRUNNEL_DYNARRAY_HEAD(, uint8_t) encrypted;
   uint8_t trunnel_error_code_;
 };
@@ -34,7 +34,7 @@ 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 trn_cell_extension_st *extensions;
+  struct trn_extension_st *extensions;
   uint8_t trunnel_error_code_;
 };
 #endif
@@ -42,7 +42,7 @@ 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 trn_cell_extension_st *extensions;
+  struct trn_extension_st *extensions;
   uint8_t onion_key_type;
   uint16_t onion_key_len;
   TRUNNEL_DYNARRAY_HEAD(, uint8_t) onion_key;
@@ -169,21 +169,21 @@ int trn_cell_introduce1_setlen_auth_key(trn_cell_introduce1_t *inp, size_t newle
 /** Return the value of the extensions field of the
  * trn_cell_introduce1_t in 'inp'
  */
-struct trn_cell_extension_st * trn_cell_introduce1_get_extensions(trn_cell_introduce1_t *inp);
+struct trn_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 trn_cell_extension_st * trn_cell_introduce1_getconst_extensions(const trn_cell_introduce1_t *inp);
+const struct trn_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 trn_cell_introduce1_set_extensions(trn_cell_introduce1_t *inp, struct trn_cell_extension_st *val);
+int trn_cell_introduce1_set_extensions(trn_cell_introduce1_t *inp, struct trn_extension_st *val);
 /** As trn_cell_introduce1_set_extensions, but does not free the
  * previous value.
  */
-int trn_cell_introduce1_set0_extensions(trn_cell_introduce1_t *inp, struct trn_cell_extension_st *val);
+int trn_cell_introduce1_set0_extensions(trn_cell_introduce1_t *inp, struct trn_extension_st *val);
 /** Return the length of the dynamic array holding the encrypted field
  * of the trn_cell_introduce1_t in 'inp'.
  */
@@ -266,21 +266,21 @@ int trn_cell_introduce_ack_set_status(trn_cell_introduce_ack_t *inp, uint16_t va
 /** Return the value of the extensions field of the
  * trn_cell_introduce_ack_t in 'inp'
  */
-struct trn_cell_extension_st * trn_cell_introduce_ack_get_extensions(trn_cell_introduce_ack_t *inp);
+struct trn_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 trn_cell_extension_st * trn_cell_introduce_ack_getconst_extensions(const trn_cell_introduce_ack_t *inp);
+const struct trn_extension_st * trn_cell_introduce_ack_getconst_extensions(const trn_cell_introduce_ack_t *inp);
 /** Set the value of the extensions field of the
  * 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 trn_cell_introduce_ack_set_extensions(trn_cell_introduce_ack_t *inp, struct trn_cell_extension_st *val);
+int trn_cell_introduce_ack_set_extensions(trn_cell_introduce_ack_t *inp, struct trn_extension_st *val);
 /** As trn_cell_introduce_ack_set_extensions, but does not free the
  * previous value.
  */
-int trn_cell_introduce_ack_set0_extensions(trn_cell_introduce_ack_t *inp, struct trn_cell_extension_st *val);
+int trn_cell_introduce_ack_set0_extensions(trn_cell_introduce_ack_t *inp, struct trn_extension_st *val);
 /** Return a newly allocated trn_cell_introduce_encrypted with all
  * elements set to zero.
  */
@@ -347,21 +347,21 @@ const uint8_t  * trn_cell_introduce_encrypted_getconstarray_rend_cookie(const tr
 /** Return the value of the extensions field of the
  * trn_cell_introduce_encrypted_t in 'inp'
  */
-struct trn_cell_extension_st * trn_cell_introduce_encrypted_get_extensions(trn_cell_introduce_encrypted_t *inp);
+struct trn_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 trn_cell_extension_st * trn_cell_introduce_encrypted_getconst_extensions(const trn_cell_introduce_encrypted_t *inp);
+const struct trn_extension_st * trn_cell_introduce_encrypted_getconst_extensions(const trn_cell_introduce_encrypted_t *inp);
 /** Set the value of the extensions field of the
  * 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 trn_cell_introduce_encrypted_set_extensions(trn_cell_introduce_encrypted_t *inp, struct trn_cell_extension_st *val);
+int trn_cell_introduce_encrypted_set_extensions(trn_cell_introduce_encrypted_t *inp, struct trn_extension_st *val);
 /** As trn_cell_introduce_encrypted_set_extensions, but does not free
  * the previous value.
  */
-int trn_cell_introduce_encrypted_set0_extensions(trn_cell_introduce_encrypted_t *inp, struct trn_cell_extension_st *val);
+int trn_cell_introduce_encrypted_set0_extensions(trn_cell_introduce_encrypted_t *inp, struct trn_extension_st *val);
 /** Return the value of the onion_key_type field of the
  * trn_cell_introduce_encrypted_t in 'inp'
  */
diff --git a/src/trunnel/hs/cell_introduce1.trunnel b/src/trunnel/hs/cell_introduce1.trunnel
index 5911c695a2..6682227b44 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 trn_cell_extension;
+extern struct trn_extension;
 /* From ed25519_cert.trunnel. */
 extern struct link_specifier;
 
@@ -38,7 +38,7 @@ struct trn_cell_introduce1 {
   u8 auth_key[auth_key_len];
 
   /* Extension(s). Reserved fields. */
-  struct trn_cell_extension extensions;
+  struct trn_extension extensions;
 
   /* Variable length, up to the end of cell. */
   u8 encrypted[];
@@ -50,7 +50,7 @@ struct trn_cell_introduce_ack {
   u16 status;
 
   /* Extension(s). Reserved fields. */
-  struct trn_cell_extension extensions;
+  struct trn_extension extensions;
 };
 
 /* Encrypted section of the INTRODUCE1/INTRODUCE2 cell. */
@@ -59,7 +59,7 @@ struct trn_cell_introduce_encrypted {
   u8 rend_cookie[TRUNNEL_REND_COOKIE_LEN];
 
   /* Extension(s). Reserved fields. */
-  struct trn_cell_extension extensions;
+  struct trn_extension extensions;
 
   /* Onion key material. */
   u8 onion_key_type IN [TRUNNEL_HS_INTRO_ONION_KEY_TYPE_NTOR];
diff --git a/src/trunnel/include.am b/src/trunnel/include.am
index d551af83bd..43d44d7720 100644
--- a/src/trunnel/include.am
+++ b/src/trunnel/include.am
@@ -8,6 +8,7 @@ endif
 
 TRUNNELINPUTS = \
 	src/trunnel/ed25519_cert.trunnel \
+	src/trunnel/extension.trunnel \
 	src/trunnel/link_handshake.trunnel \
 	src/trunnel/pwbox.trunnel \
 	src/trunnel/channelpadding_negotiation.trunnel \
@@ -20,9 +21,9 @@ TRUNNELINPUTS = \
 TRUNNELSOURCES = \
 	src/ext/trunnel/trunnel.c \
 	src/trunnel/ed25519_cert.c \
+	src/trunnel/extension.c \
 	src/trunnel/link_handshake.c \
 	src/trunnel/pwbox.c			\
-	src/trunnel/hs/cell_common.c            \
 	src/trunnel/hs/cell_establish_intro.c	\
 	src/trunnel/hs/cell_introduce1.c \
 	src/trunnel/hs/cell_rendezvous.c \
@@ -39,9 +40,9 @@ TRUNNELHEADERS = \
 	src/ext/trunnel/trunnel-impl.h		\
 	src/trunnel/trunnel-local.h		\
 	src/trunnel/ed25519_cert.h		\
+	src/trunnel/extension.h \
 	src/trunnel/link_handshake.h		\
 	src/trunnel/pwbox.h			\
-	src/trunnel/hs/cell_common.h            \
 	src/trunnel/hs/cell_establish_intro.h	\
 	src/trunnel/hs/cell_introduce1.h \
 	src/trunnel/hs/cell_rendezvous.h \





More information about the tor-commits mailing list