From 5cdc2343302f8fec9d71a6f1e7ec28befb7379cf Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 15 Jun 2018 12:36:59 -0400 Subject: [PATCH] Split rend_authorized_client_t and encoded_.._t into their own headers --- src/or/control.c | 2 ++ src/or/include.am | 2 ++ src/or/or.h | 15 +++------------ src/or/rend_authorized_client_st.h | 18 ++++++++++++++++++ src/or/rend_encoded_v2_service_descriptor_st.h | 17 +++++++++++++++++ src/or/rendcommon.c | 1 + src/or/rendservice.c | 2 ++ src/or/routerparse.c | 1 + src/test/test.c | 1 + src/test/test_dir_handle_get.c | 1 + src/test/test_hs.c | 1 + src/test/test_rendcache.c | 1 + 12 files changed, 50 insertions(+), 12 deletions(-) create mode 100644 src/or/rend_authorized_client_st.h create mode 100644 src/or/rend_encoded_v2_service_descriptor_st.h diff --git a/src/or/control.c b/src/or/control.c index 401135ca82..966ddfa8c5 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -87,6 +87,8 @@ #include "or_connection_st.h" #include "or_circuit_st.h" #include "origin_circuit_st.h" +#include "rend_authorized_client_st.h" +#include "rend_encoded_v2_service_descriptor_st.h" #include "rend_service_descriptor_st.h" #ifndef _WIN32 diff --git a/src/or/include.am b/src/or/include.am index ede01c79e4..353d52ea2b 100644 --- a/src/or/include.am +++ b/src/or/include.am @@ -279,6 +279,8 @@ ORHEADERS = \ src/or/rendcommon.h \ src/or/rendmid.h \ src/or/rendservice.h \ + src/or/rend_authorized_client_st.h \ + src/or/rend_encoded_v2_service_descriptor_st.h \ src/or/rend_intro_point_st.h \ src/or/rend_service_descriptor_st.h \ src/or/rephist.h \ diff --git a/src/or/or.h b/src/or/or.h index 41953806ac..d390c47bf0 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -4038,18 +4038,9 @@ typedef enum { /********************************* rendcommon.c ***************************/ -/** Hidden-service side configuration of client authorization. */ -typedef struct rend_authorized_client_t { - char *client_name; - uint8_t descriptor_cookie[REND_DESC_COOKIE_LEN]; - crypto_pk_t *client_key; -} rend_authorized_client_t; - -/** ASCII-encoded v2 hidden service descriptor. */ -typedef struct rend_encoded_v2_service_descriptor_t { - char desc_id[DIGEST_LEN]; /**< Descriptor ID. */ - char *desc_str; /**< Descriptor string. */ -} rend_encoded_v2_service_descriptor_t; +typedef struct rend_authorized_client_t rend_authorized_client_t; +typedef struct rend_encoded_v2_service_descriptor_t + rend_encoded_v2_service_descriptor_t; /** The maximum number of non-circuit-build-timeout failures a hidden * service client will tolerate while trying to build a circuit to an diff --git a/src/or/rend_authorized_client_st.h b/src/or/rend_authorized_client_st.h new file mode 100644 index 0000000000..e06620fb86 --- /dev/null +++ b/src/or/rend_authorized_client_st.h @@ -0,0 +1,18 @@ +/* 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 REND_AUTHORIZED_CLIENT_ST_H +#define REND_AUTHORIZED_CLIENT_ST_H + +/** Hidden-service side configuration of client authorization. */ +struct rend_authorized_client_t { + char *client_name; + uint8_t descriptor_cookie[REND_DESC_COOKIE_LEN]; + crypto_pk_t *client_key; +}; + +#endif + diff --git a/src/or/rend_encoded_v2_service_descriptor_st.h b/src/or/rend_encoded_v2_service_descriptor_st.h new file mode 100644 index 0000000000..05176eb012 --- /dev/null +++ b/src/or/rend_encoded_v2_service_descriptor_st.h @@ -0,0 +1,17 @@ +/* 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 REND_ENCODED_V2_SERVICE_DESCRIPTOR_ST_H +#define REND_ENCODED_V2_SERVICE_DESCRIPTOR_ST_H + +/** ASCII-encoded v2 hidden service descriptor. */ +struct rend_encoded_v2_service_descriptor_t { + char desc_id[DIGEST_LEN]; /**< Descriptor ID. */ + char *desc_str; /**< Descriptor string. */ +}; + +#endif + diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c index 2494311cb5..0ab42fb426 100644 --- a/src/or/rendcommon.c +++ b/src/or/rendcommon.c @@ -34,6 +34,7 @@ #include "cpath_build_state_st.h" #include "crypt_path_st.h" #include "origin_circuit_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/or/rendservice.c b/src/or/rendservice.c index d82ea4789e..4a8b7a0e15 100644 --- a/src/or/rendservice.c +++ b/src/or/rendservice.c @@ -41,6 +41,8 @@ #include "crypt_path_reference_st.h" #include "edge_connection_st.h" #include "origin_circuit_st.h" +#include "rend_authorized_client_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/or/routerparse.c b/src/or/routerparse.c index 20a6f85a42..e75dc2ee97 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -81,6 +81,7 @@ #include "dirauth/dirvote.h" +#include "rend_authorized_client_st.h" #include "rend_intro_point_st.h" #include "rend_service_descriptor_st.h" #include "tor_version_st.h" diff --git a/src/test/test.c b/src/test/test.c index 4476319a4b..871498aa01 100644 --- a/src/test/test.c +++ b/src/test/test.c @@ -63,6 +63,7 @@ double fabs(double x); #include "crypto_curve25519.h" #include "or_circuit_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_dir_handle_get.c b/src/test/test_dir_handle_get.c index 188735a542..ff9740b911 100644 --- a/src/test/test_dir_handle_get.c +++ b/src/test/test_dir_handle_get.c @@ -36,6 +36,7 @@ #include "dir_connection_st.h" #include "dir_server_st.h" +#include "rend_encoded_v2_service_descriptor_st.h" #ifdef _WIN32 /* For mkdir() */ diff --git a/src/test/test_hs.c b/src/test/test_hs.c index 0505285f3d..9343d131f2 100644 --- a/src/test/test_hs.c +++ b/src/test/test_hs.c @@ -22,6 +22,7 @@ #include "routerset.h" #include "circuitbuild.h" +#include "rend_encoded_v2_service_descriptor_st.h" #include "rend_intro_point_st.h" #include "test_helpers.h" diff --git a/src/test/test_rendcache.c b/src/test/test_rendcache.c index b4b76df882..e5d5316179 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 "rend_encoded_v2_service_descriptor_st.h" #include "rend_intro_point_st.h" #include "rend_service_descriptor_st.h"