commit 1e4e9db8157e8691327fe9ee9de5df6fe9891040 Author: Nick Mathewson nickm@torproject.org Date: Fri Jun 15 14:14:11 2018 -0400
Extract authority_cert_t into its own header --- src/or/authority_cert_st.h | 30 ++++++++++++++++++++++++++++++ src/or/dirauth/dirvote.c | 1 + src/or/dirauth/shared_random.c | 1 + src/or/directory.c | 1 + src/or/include.am | 1 + src/or/networkstatus.c | 1 + src/or/or.h | 19 +------------------ src/or/router.c | 1 + src/or/routerlist.c | 1 + src/or/routerparse.c | 1 + src/test/test_dir.c | 1 + src/test/test_dir_common.c | 1 + src/test/test_routerlist.c | 1 + 13 files changed, 42 insertions(+), 18 deletions(-)
diff --git a/src/or/authority_cert_st.h b/src/or/authority_cert_st.h new file mode 100644 index 000000000..b1dbcddbe --- /dev/null +++ b/src/or/authority_cert_st.h @@ -0,0 +1,30 @@ +/* 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 AUTHORITY_CERT_ST_H +#define AUTHORITY_CERT_ST_H + +/** Certificate for v3 directory protocol: binds long-term authority identity + * keys to medium-term authority signing keys. */ +struct authority_cert_t { + /** Information relating to caching this cert on disk and looking it up. */ + signed_descriptor_t cache_info; + /** This authority's long-term authority identity key. */ + crypto_pk_t *identity_key; + /** This authority's medium-term signing key. */ + crypto_pk_t *signing_key; + /** The digest of <b>signing_key</b> */ + char signing_key_digest[DIGEST_LEN]; + /** The listed expiration time of this certificate. */ + time_t expires; + /** This authority's IPv4 address, in host order. */ + uint32_t addr; + /** This authority's directory port. */ + uint16_t dir_port; +}; + +#endif + diff --git a/src/or/dirauth/dirvote.c b/src/or/dirauth/dirvote.c index 1f95b985c..29134868c 100644 --- a/src/or/dirauth/dirvote.c +++ b/src/or/dirauth/dirvote.c @@ -28,6 +28,7 @@ #include "dirauth/mode.h" #include "dirauth/shared_random_state.h"
+#include "authority_cert_st.h" #include "dir_server_st.h" #include "document_signature_st.h" #include "networkstatus_st.h" diff --git a/src/or/dirauth/shared_random.c b/src/or/dirauth/shared_random.c index 137f695db..c042acda1 100644 --- a/src/or/dirauth/shared_random.c +++ b/src/or/dirauth/shared_random.c @@ -105,6 +105,7 @@ #include "dirauth/dirvote.h" #include "dirauth/mode.h"
+#include "authority_cert_st.h" #include "networkstatus_st.h"
/* String prefix of shared random values in votes/consensuses. */ diff --git a/src/or/directory.c b/src/or/directory.c index b5a07f6b3..f3080bc1f 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -54,6 +54,7 @@ #include "dirauth/mode.h" #include "dirauth/shared_random.h"
+#include "authority_cert_st.h" #include "dir_connection_st.h" #include "dir_server_st.h" #include "entry_connection_st.h" diff --git a/src/or/include.am b/src/or/include.am index 396cfea5a..e73432d3c 100644 --- a/src/or/include.am +++ b/src/or/include.am @@ -181,6 +181,7 @@ endif
ORHEADERS = \ src/or/addressmap.h \ + src/or/authority_cert_st.h \ src/or/auth_dirs.inc \ src/or/bridges.h \ src/or/channel.h \ diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c index 6f7223b60..1951414a8 100644 --- a/src/or/networkstatus.c +++ b/src/or/networkstatus.c @@ -74,6 +74,7 @@ #include "dirauth/mode.h" #include "dirauth/shared_random.h"
+#include "authority_cert_st.h" #include "dir_connection_st.h" #include "dir_server_st.h" #include "document_signature_st.h" diff --git a/src/or/or.h b/src/or/or.h index a8ddcd240..1f7c4be50 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -1911,24 +1911,7 @@ typedef struct extend_info_t { curve25519_public_key_t curve25519_onion_key; } extend_info_t;
-/** Certificate for v3 directory protocol: binds long-term authority identity - * keys to medium-term authority signing keys. */ -typedef struct authority_cert_t { - /** Information relating to caching this cert on disk and looking it up. */ - signed_descriptor_t cache_info; - /** This authority's long-term authority identity key. */ - crypto_pk_t *identity_key; - /** This authority's medium-term signing key. */ - crypto_pk_t *signing_key; - /** The digest of <b>signing_key</b> */ - char signing_key_digest[DIGEST_LEN]; - /** The listed expiration time of this certificate. */ - time_t expires; - /** This authority's IPv4 address, in host order. */ - uint32_t addr; - /** This authority's directory port. */ - uint16_t dir_port; -} authority_cert_t; +typedef struct authority_cert_t authority_cert_t;
/** Bitfield enum type listing types of information that directory authorities * can be authoritative about, and that directory caches may or may not cache. diff --git a/src/or/router.c b/src/or/router.c index 6d8f61d71..961fab129 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -39,6 +39,7 @@
#include "dirauth/mode.h"
+#include "authority_cert_st.h" #include "crypt_path_st.h" #include "dir_connection_st.h" #include "dir_server_st.h" diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 102f3125a..3170ce601 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -125,6 +125,7 @@ #include "dirauth/dirvote.h" #include "dirauth/mode.h"
+#include "authority_cert_st.h" #include "dir_connection_st.h" #include "dir_server_st.h" #include "document_signature_st.h" diff --git a/src/or/routerparse.c b/src/or/routerparse.c index ea1320de7..34c851a1b 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -81,6 +81,7 @@
#include "dirauth/dirvote.h"
+#include "authority_cert_st.h" #include "document_signature_st.h" #include "networkstatus_st.h" #include "networkstatus_voter_info_st.h" diff --git a/src/test/test_dir.c b/src/test/test_dir.c index 9412f879d..ecce48942 100644 --- a/src/test/test_dir.c +++ b/src/test/test_dir.c @@ -45,6 +45,7 @@ #include "log_test_helpers.h" #include "voting_schedule.h"
+#include "authority_cert_st.h" #include "document_signature_st.h" #include "networkstatus_st.h" #include "networkstatus_voter_info_st.h" diff --git a/src/test/test_dir_common.c b/src/test/test_dir_common.c index 3fad1c3af..c23282ba8 100644 --- a/src/test/test_dir_common.c +++ b/src/test/test_dir_common.c @@ -14,6 +14,7 @@ #include "test_dir_common.h" #include "voting_schedule.h"
+#include "authority_cert_st.h" #include "networkstatus_st.h" #include "networkstatus_voter_info_st.h" #include "vote_microdesc_hash_st.h" diff --git a/src/test/test_routerlist.c b/src/test/test_routerlist.c index 45d63a806..1c2ba9d67 100644 --- a/src/test/test_routerlist.c +++ b/src/test/test_routerlist.c @@ -34,6 +34,7 @@ #include "dirauth/shared_random.h" #include "statefile.h"
+#include "authority_cert_st.h" #include "dir_connection_st.h" #include "networkstatus_st.h" #include "node_st.h"