From 3191ba389d12146b786ffd8af842a80e58c8c802 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 15 Jun 2018 15:37:05 -0400 Subject: [PATCH] Move extend_info_t into its own header. --- src/or/bridges.c | 1 + src/or/channeltls.c | 1 + src/or/circpathbias.c | 1 + src/or/circuitbuild.c | 1 + src/or/circuitlist.c | 1 + src/or/circuituse.c | 1 + src/or/connection_edge.c | 1 + src/or/extend_info_st.h | 28 ++++++++++++++++++++++++++++ src/or/hs_client.c | 1 + src/or/hs_descriptor.c | 2 ++ src/or/hs_service.c | 1 + src/or/include.am | 1 + src/or/onion.c | 1 + src/or/or.h | 19 +------------------ src/or/relay.c | 1 + src/or/rendcache.c | 1 + src/or/rendclient.c | 1 + src/or/rendcommon.c | 1 + src/or/rendservice.c | 1 + src/or/router.c | 1 + src/or/routerparse.c | 1 + src/or/routerset.c | 1 + src/test/rend_test_helpers.c | 1 + src/test/test.c | 1 + src/test/test_circuitbuild.c | 2 ++ src/test/test_circuitstats.c | 1 + src/test/test_hs_client.c | 1 + src/test/test_rendcache.c | 1 + src/test/test_routerset.c | 1 + 29 files changed, 58 insertions(+), 18 deletions(-) create mode 100644 src/or/extend_info_st.h diff --git a/src/or/bridges.c b/src/or/bridges.c index 013c45cd53..793f292a54 100644 --- a/src/or/bridges.c +++ b/src/or/bridges.c @@ -27,6 +27,7 @@ #include "routerset.h" #include "transports.h" +#include "extend_info_st.h" #include "node_st.h" #include "routerinfo_st.h" #include "routerstatus_st.h" diff --git a/src/or/channeltls.c b/src/or/channeltls.c index e2b6cabd46..c345364cde 100644 --- a/src/or/channeltls.c +++ b/src/or/channeltls.c @@ -62,6 +62,7 @@ #include "cell_st.h" #include "cell_queue_st.h" +#include "extend_info_st.h" #include "or_connection_st.h" #include "or_handshake_certs_st.h" #include "or_handshake_state_st.h" diff --git a/src/or/circpathbias.c b/src/or/circpathbias.c index a36d67526d..6586fe4472 100644 --- a/src/or/circpathbias.c +++ b/src/or/circpathbias.c @@ -38,6 +38,7 @@ #include "cell_st.h" #include "cpath_build_state_st.h" #include "crypt_path_st.h" +#include "extend_info_st.h" #include "origin_circuit_st.h" static void pathbias_count_successful_close(origin_circuit_t *circ); diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index 41afb75439..dfe293d4e7 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -68,6 +68,7 @@ #include "cell_st.h" #include "cpath_build_state_st.h" #include "entry_connection_st.h" +#include "extend_info_st.h" #include "node_st.h" #include "or_circuit_st.h" #include "origin_circuit_st.h" diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c index 46974aea43..95463fde38 100644 --- a/src/or/circuitlist.c +++ b/src/or/circuitlist.c @@ -96,6 +96,7 @@ #include "crypt_path_reference_st.h" #include "dir_connection_st.h" #include "edge_connection_st.h" +#include "extend_info_st.h" #include "or_circuit_st.h" #include "origin_circuit_st.h" diff --git a/src/or/circuituse.c b/src/or/circuituse.c index 370e2c0b74..60ffe95b1b 100644 --- a/src/or/circuituse.c +++ b/src/or/circuituse.c @@ -60,6 +60,7 @@ #include "cpath_build_state_st.h" #include "dir_connection_st.h" #include "entry_connection_st.h" +#include "extend_info_st.h" #include "or_circuit_st.h" #include "origin_circuit_st.h" #include "socks_request_st.h" diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index 4f1b5d2d58..7ceb97e7cc 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -101,6 +101,7 @@ #include "cpath_build_state_st.h" #include "dir_connection_st.h" #include "entry_connection_st.h" +#include "extend_info_st.h" #include "node_st.h" #include "or_circuit_st.h" #include "origin_circuit_st.h" diff --git a/src/or/extend_info_st.h b/src/or/extend_info_st.h new file mode 100644 index 0000000000..42c638d6d5 --- /dev/null +++ b/src/or/extend_info_st.h @@ -0,0 +1,28 @@ +/* Copyright (c) 2001 Matej Pfajfar. + * Copyright (c) 2001-2004, Roger Dingledine. + * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. + * Copyright (c) 2007-2017, The Tor Project, Inc. */ +/* See LICENSE for licensing information */ + +#ifndef EXTEND_INFO_ST_H +#define EXTEND_INFO_ST_H + +/** Information on router used when extending a circuit. We don't need a + * full routerinfo_t to extend: we only need addr:port:keyid to build an OR + * connection, and onion_key to create the onionskin. Note that for onehop + * general-purpose tunnels, the onion_key is NULL. */ +struct extend_info_t { + char nickname[MAX_HEX_NICKNAME_LEN+1]; /**< This router's nickname for + * display. */ + /** Hash of this router's RSA identity key. */ + char identity_digest[DIGEST_LEN]; + /** Ed25519 identity for this router, if any. */ + ed25519_public_key_t ed_identity; + uint16_t port; /**< OR port. */ + tor_addr_t addr; /**< IP address. */ + crypto_pk_t *onion_key; /**< Current onionskin key. */ + curve25519_public_key_t curve25519_onion_key; +}; + +#endif + diff --git a/src/or/hs_client.c b/src/or/hs_client.c index 18276bfb84..2237699bc7 100644 --- a/src/or/hs_client.c +++ b/src/or/hs_client.c @@ -38,6 +38,7 @@ #include "cpath_build_state_st.h" #include "dir_connection_st.h" #include "entry_connection_st.h" +#include "extend_info_st.h" #include "origin_circuit_st.h" /* Return a human-readable string for the client fetch status code. */ diff --git a/src/or/hs_descriptor.c b/src/or/hs_descriptor.c index 096122392d..bda4dd64b7 100644 --- a/src/or/hs_descriptor.c +++ b/src/or/hs_descriptor.c @@ -67,6 +67,8 @@ #include "hs_config.h" #include "torcert.h" /* tor_cert_encode_ed22519() */ +#include "extend_info_st.h" + /* Constant string value used for the descriptor format. */ #define str_hs_desc "hs-descriptor" #define str_desc_cert "descriptor-signing-key-cert" diff --git a/src/or/hs_service.c b/src/or/hs_service.c index ef809a69f4..46fb3bf682 100644 --- a/src/or/hs_service.c +++ b/src/or/hs_service.c @@ -41,6 +41,7 @@ #include "dir_connection_st.h" #include "edge_connection_st.h" +#include "extend_info_st.h" #include "networkstatus_st.h" #include "node_st.h" #include "origin_circuit_st.h" diff --git a/src/or/include.am b/src/or/include.am index ec8e275562..06e61e00d0 100644 --- a/src/or/include.am +++ b/src/or/include.am @@ -230,6 +230,7 @@ ORHEADERS = \ src/or/entry_connection_st.h \ src/or/entry_port_cfg_st.h \ src/or/ext_orport.h \ + src/or/extend_info_st.h \ src/or/extrainfo_st.h \ src/or/fallback_dirs.inc \ src/or/fp_pair.h \ diff --git a/src/or/onion.c b/src/or/onion.c index ac2f40a553..c84cb13ade 100644 --- a/src/or/onion.c +++ b/src/or/onion.c @@ -78,6 +78,7 @@ #include "router.h" #include "cell_st.h" +#include "extend_info_st.h" #include "or_circuit_st.h" // trunnel diff --git a/src/or/or.h b/src/or/or.h index 66c863a828..b164cf0e7f 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -1502,24 +1502,7 @@ typedef enum store_type_t { typedef struct desc_store_t desc_store_t; typedef struct routerlist_t routerlist_t; - -/** Information on router used when extending a circuit. We don't need a - * full routerinfo_t to extend: we only need addr:port:keyid to build an OR - * connection, and onion_key to create the onionskin. Note that for onehop - * general-purpose tunnels, the onion_key is NULL. */ -typedef struct extend_info_t { - char nickname[MAX_HEX_NICKNAME_LEN+1]; /**< This router's nickname for - * display. */ - /** Hash of this router's RSA identity key. */ - char identity_digest[DIGEST_LEN]; - /** Ed25519 identity for this router, if any. */ - ed25519_public_key_t ed_identity; - uint16_t port; /**< OR port. */ - tor_addr_t addr; /**< IP address. */ - crypto_pk_t *onion_key; /**< Current onionskin key. */ - curve25519_public_key_t curve25519_onion_key; -} extend_info_t; - +typedef struct extend_info_t extend_info_t; typedef struct authority_cert_t authority_cert_t; /** Bitfield enum type listing types of information that directory authorities diff --git a/src/or/relay.c b/src/or/relay.c index 62c9204dbe..6af7c8d1d6 100644 --- a/src/or/relay.c +++ b/src/or/relay.c @@ -88,6 +88,7 @@ #include "dir_connection_st.h" #include "destroy_cell_queue_st.h" #include "entry_connection_st.h" +#include "extend_info_st.h" #include "or_circuit_st.h" #include "origin_circuit_st.h" #include "routerinfo_st.h" diff --git a/src/or/rendcache.c b/src/or/rendcache.c index 093cbe7ce2..196ae9ad1a 100644 --- a/src/or/rendcache.c +++ b/src/or/rendcache.c @@ -15,6 +15,7 @@ #include "routerparse.h" #include "rendcommon.h" +#include "extend_info_st.h" #include "rend_intro_point_st.h" #include "rend_service_descriptor_st.h" diff --git a/src/or/rendclient.c b/src/or/rendclient.c index 3236127852..4154030b8f 100644 --- a/src/or/rendclient.c +++ b/src/or/rendclient.c @@ -37,6 +37,7 @@ #include "crypt_path_st.h" #include "dir_connection_st.h" #include "entry_connection_st.h" +#include "extend_info_st.h" #include "origin_circuit_st.h" #include "rend_intro_point_st.h" #include "rend_service_descriptor_st.h" diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c index 9049699465..80cb798466 100644 --- a/src/or/rendcommon.c +++ b/src/or/rendcommon.c @@ -33,6 +33,7 @@ #include "cpath_build_state_st.h" #include "crypt_path_st.h" +#include "extend_info_st.h" #include "networkstatus_st.h" #include "origin_circuit_st.h" #include "rend_encoded_v2_service_descriptor_st.h" diff --git a/src/or/rendservice.c b/src/or/rendservice.c index 170d78147a..e207707e93 100644 --- a/src/or/rendservice.c +++ b/src/or/rendservice.c @@ -40,6 +40,7 @@ #include "crypt_path_st.h" #include "crypt_path_reference_st.h" #include "edge_connection_st.h" +#include "extend_info_st.h" #include "networkstatus_st.h" #include "origin_circuit_st.h" #include "rend_authorized_client_st.h" diff --git a/src/or/router.c b/src/or/router.c index ddbfb03135..614860f611 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -43,6 +43,7 @@ #include "crypt_path_st.h" #include "dir_connection_st.h" #include "dir_server_st.h" +#include "extend_info_st.h" #include "extrainfo_st.h" #include "node_st.h" #include "origin_circuit_st.h" diff --git a/src/or/routerparse.c b/src/or/routerparse.c index 040745f651..31c545edf4 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -83,6 +83,7 @@ #include "authority_cert_st.h" #include "document_signature_st.h" +#include "extend_info_st.h" #include "extrainfo_st.h" #include "microdesc_st.h" #include "networkstatus_st.h" diff --git a/src/or/routerset.c b/src/or/routerset.c index 415fa0ce7c..6da1c201b7 100644 --- a/src/or/routerset.c +++ b/src/or/routerset.c @@ -36,6 +36,7 @@ #include "routerparse.h" #include "routerset.h" +#include "extend_info_st.h" #include "node_st.h" #include "routerinfo_st.h" #include "routerstatus_st.h" diff --git a/src/test/rend_test_helpers.c b/src/test/rend_test_helpers.c index fb2e4cf50b..ec252c39b3 100644 --- a/src/test/rend_test_helpers.c +++ b/src/test/rend_test_helpers.c @@ -7,6 +7,7 @@ #include "rendcommon.h" #include "rend_test_helpers.h" +#include "extend_info_st.h" #include "rend_intro_point_st.h" #include "rend_service_descriptor_st.h" diff --git a/src/test/test.c b/src/test/test.c index 871498aa01..14456d8666 100644 --- a/src/test/test.c +++ b/src/test/test.c @@ -62,6 +62,7 @@ double fabs(double x); #include "statefile.h" #include "crypto_curve25519.h" +#include "extend_info_st.h" #include "or_circuit_st.h" #include "rend_encoded_v2_service_descriptor_st.h" #include "rend_intro_point_st.h" diff --git a/src/test/test_circuitbuild.c b/src/test/test_circuitbuild.c index a5282df69d..b09f7bf553 100644 --- a/src/test/test_circuitbuild.c +++ b/src/test/test_circuitbuild.c @@ -12,6 +12,8 @@ #include "config.h" #include "circuitbuild.h" +#include "extend_info_st.h" + /* Dummy nodes smartlist for testing */ static smartlist_t dummy_nodes; /* Dummy exit extend_info for testing */ diff --git a/src/test/test_circuitstats.c b/src/test/test_circuitstats.c index 9f6f4626da..b8056e0d1d 100644 --- a/src/test/test_circuitstats.c +++ b/src/test/test_circuitstats.c @@ -19,6 +19,7 @@ #include "cpath_build_state_st.h" #include "crypt_path_st.h" +#include "extend_info_st.h" #include "origin_circuit_st.h" void test_circuitstats_timeout(void *arg); diff --git a/src/test/test_hs_client.c b/src/test/test_hs_client.c index ca87d5e92d..64c098dbb1 100644 --- a/src/test/test_hs_client.c +++ b/src/test/test_hs_client.c @@ -41,6 +41,7 @@ #include "crypt_path_st.h" #include "dir_connection_st.h" #include "entry_connection_st.h" +#include "extend_info_st.h" #include "networkstatus_st.h" #include "origin_circuit_st.h" #include "socks_request_st.h" diff --git a/src/test/test_rendcache.c b/src/test/test_rendcache.c index 22af3473ba..6bc8038281 100644 --- a/src/test/test_rendcache.c +++ b/src/test/test_rendcache.c @@ -12,6 +12,7 @@ #include "config.h" #include "hs_common.h" +#include "extend_info_st.h" #include "rend_encoded_v2_service_descriptor_st.h" #include "rend_intro_point_st.h" #include "rend_service_descriptor_st.h" diff --git a/src/test/test_routerset.c b/src/test/test_routerset.c index 004b88ac83..11a1ff2aff 100644 --- a/src/test/test_routerset.c +++ b/src/test/test_routerset.c @@ -10,6 +10,7 @@ #include "policies.h" #include "nodelist.h" +#include "extend_info_st.h" #include "node_st.h" #include "routerinfo_st.h" #include "routerstatus_st.h"