Tor  0.4.7.0-alpha-dev
authcert.h
Go to the documentation of this file.
1 /* Copyright (c) 2001-2004, Roger Dingledine.
2  * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
3  * Copyright (c) 2007-2021, The Tor Project, Inc. */
4 /* See LICENSE for licensing information */
5 
6 /**
7  * \file authcert.h
8  * \brief Header file for authcert.c
9  **/
10 
11 #ifndef TOR_AUTHCERT_H
12 #define TOR_AUTHCERT_H
13 
15 
17 
18 /*
19  * Pass one of these as source to trusted_dirs_load_certs_from_string()
20  * to indicate whence string originates; this controls error handling
21  * behavior such as marking downloads as failed.
22  */
23 
24 #define TRUSTED_DIRS_CERTS_SRC_SELF 0
25 #define TRUSTED_DIRS_CERTS_SRC_FROM_STORE 1
26 #define TRUSTED_DIRS_CERTS_SRC_DL_BY_ID_DIGEST 2
27 #define TRUSTED_DIRS_CERTS_SRC_DL_BY_ID_SK_DIGEST 3
28 #define TRUSTED_DIRS_CERTS_SRC_FROM_VOTE 4
29 
30 int trusted_dirs_load_certs_from_string(const char *contents, int source,
31  int flush, const char *source_dir);
36 authority_cert_t *authority_cert_get_by_digests(const char *id_digest,
37  const char *sk_digest);
38 void authority_cert_get_all(smartlist_t *certs_out);
39 void authority_cert_dl_failed(const char *id_digest,
40  const char *signing_key_digest, int status);
41 void authority_certs_fetch_missing(networkstatus_t *status, time_t now,
42  const char *dir_hint);
43 int authority_cert_dl_looks_uncertain(const char *id_digest);
45 
47 #define authority_cert_free(cert) \
48  FREE_AND_NULL(authority_cert_t, authority_cert_free_, (cert))
49 
52  (const char *digest));
54  (const char *digest));
56  (const char *id_digest, const char *sk_digest));
57 
58 void authcert_free_all(void);
59 
60 #endif /* !defined(TOR_AUTHCERT_H) */
void authority_cert_dl_failed(const char *id_digest, const char *signing_key_digest, int status)
Definition: authcert.c:681
int trusted_dirs_load_certs_from_string(const char *contents, int source, int flush, const char *source_dir)
Definition: authcert.c:373
download_status_t * download_status_for_authority_id_and_sk(const char *id_digest, const char *sk_digest)
Definition: authcert.c:282
download_status_t * id_only_download_status_for_authority_id(const char *digest)
Definition: authcert.c:227
void trusted_dirs_remove_old_certs(void)
Definition: authcert.c:548
authority_cert_t * authority_cert_get_newest_by_id(const char *id_digest)
Definition: authcert.c:601
void authority_cert_get_all(smartlist_t *certs_out)
Definition: authcert.c:664
authority_cert_t * authority_cert_get_by_digests(const char *id_digest, const char *sk_digest)
Definition: authcert.c:648
int trusted_dirs_reload_certs(void)
Definition: authcert.c:324
void authority_certs_fetch_missing(networkstatus_t *status, time_t now, const char *dir_hint)
Definition: authcert.c:853
authority_cert_t * authority_cert_get_by_sk_digest(const char *sk_digest)
Definition: authcert.c:621
int authority_cert_is_denylisted(const authority_cert_t *cert)
Definition: authcert.c:744
void trusted_dirs_flush_certs_to_disk(void)
Definition: authcert.c:499
void authority_cert_free_(authority_cert_t *cert)
Definition: authcert.c:1162
int authority_cert_dl_looks_uncertain(const char *id_digest)
Definition: authcert.c:763
smartlist_t * list_authority_ids_with_downloads(void)
Definition: authcert.c:196
smartlist_t * list_sk_digests_for_authority_id(const char *digest)
Definition: authcert.c:247
Macros to implement mocking and selective exposure for the test code.
#define MOCK_DECL(rv, funcname, arglist)
Definition: testsupport.h:127