hs: abolish hs_desc_link_specifier_dup()

The previous commits introduced link_specifier_dup(), which is
implemented using trunnel's opaque interfaces. So we can now
remove hs_desc_link_specifier_dup().

Cleanup after bug 22781.
This commit is contained in:
teor 2019-03-08 16:47:20 +10:00 committed by Nick Mathewson
parent 257cea8876
commit 680b2afd84
4 changed files with 1 additions and 27 deletions

View File

@ -759,7 +759,7 @@ hs_cell_parse_introduce2(hs_cell_introduce2_data_t *data,
if (BUG(!lspec)) {
goto done;
}
link_specifier_t *lspec_dup = hs_link_specifier_dup(lspec);
link_specifier_t *lspec_dup = link_specifier_dup(lspec);
if (BUG(!lspec_dup)) {
goto done;
}

View File

@ -1009,24 +1009,6 @@ hs_build_address(const ed25519_public_key_t *key, uint8_t version,
tor_assert(hs_address_is_valid(addr_out));
}
/* Return a newly allocated copy of lspec. */
link_specifier_t *
hs_link_specifier_dup(const link_specifier_t *lspec)
{
link_specifier_t *result = link_specifier_new();
memcpy(result, lspec, sizeof(*result));
/* The unrecognized field is a dynamic array so make sure to copy its
* content and not the pointer. */
link_specifier_setlen_un_unrecognized(
result, link_specifier_getlen_un_unrecognized(lspec));
if (link_specifier_getlen_un_unrecognized(result)) {
memcpy(link_specifier_getarray_un_unrecognized(result),
link_specifier_getconstarray_un_unrecognized(lspec),
link_specifier_getlen_un_unrecognized(result));
}
return result;
}
/* From a given ed25519 public key pk and an optional secret, compute a
* blinded public key and put it in blinded_pk_out. This is only useful to
* the client side because the client only has access to the identity public

View File

@ -217,8 +217,6 @@ uint64_t hs_get_time_period_num(time_t now);
uint64_t hs_get_next_time_period_num(time_t now);
time_t hs_get_start_time_of_next_time_period(time_t now);
link_specifier_t *hs_link_specifier_dup(const link_specifier_t *lspec);
MOCK_DECL(int, hs_in_period_between_tp_and_srv,
(const networkstatus_t *consensus, time_t now));

View File

@ -28,12 +28,6 @@ const LS_IPV6 = 0x01;
const LS_LEGACY_ID = 0x02;
const LS_ED25519_ID = 0x03;
// XXX hs_link_specifier_dup() violates the opaqueness of link_specifier_t by
// taking its sizeof(). If we ever want to turn on TRUNNEL_OPAQUE, or
// if we ever make link_specifier contain other types, we will
// need to refactor that function to do the copy by encoding and decoding the
// object.
// amended from tor.trunnel
struct link_specifier {
u8 ls_type;