Tor  0.4.7.0-alpha-dev
sigcommon.h
Go to the documentation of this file.
1 /* Copyright (c) 2001 Matej Pfajfar.
2  * Copyright (c) 2001-2004, Roger Dingledine.
3  * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
4  * Copyright (c) 2007-2021, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
6 
7 /**
8  * \file sigcommon.h
9  * \brief Header file for sigcommon.c.
10  **/
11 
12 #ifndef TOR_SIGCOMMON_H
13 #define TOR_SIGCOMMON_H
14 
15 /* TODO: Rename all of these functions */
16 int router_get_hash_impl(const char *s, size_t s_len, char *digest,
17  const char *start_str, const char *end_str,
18  char end_char,
19  digest_algorithm_t alg);
20 
21 #define CST_NO_CHECK_OBJTYPE (1<<0)
22 struct directory_token_t;
23 MOCK_DECL(int, check_signature_token,(const char *digest,
24  ssize_t digest_len,
25  struct directory_token_t *tok,
26  crypto_pk_t *pkey,
27  int flags,
28  const char *doctype));
29 
30 int router_get_hash_impl_helper(const char *s, size_t s_len,
31  const char *start_str,
32  const char *end_str, char end_c,
33  int log_severity,
34  const char **start_out, const char **end_out);
35 int router_get_hashes_impl(const char *s, size_t s_len,
36  common_digests_t *digests,
37  const char *start_str, const char *end_str,
38  char end_char);
39 
40 #ifdef SIGCOMMON_PRIVATE
41 MOCK_DECL(STATIC int, signed_digest_equals,
42  (const uint8_t *d1, const uint8_t *d2, size_t len));
43 MOCK_DECL(STATIC int, router_compute_hash_final,(char *digest,
44  const char *start, size_t len,
45  digest_algorithm_t alg));
46 #endif /* defined(SIGCOMMON_PRIVATE) */
47 
48 #endif /* !defined(TOR_SIGCOMMON_H) */
digest_algorithm_t
Definition: crypto_digest.h:44
STATIC int router_compute_hash_final(char *digest, const char *start, size_t len, digest_algorithm_t alg)
Definition: sigcommon.c:93
int router_get_hash_impl_helper(const char *s, size_t s_len, const char *start_str, const char *end_str, char end_c, int log_severity, const char **start_out, const char **end_out)
Definition: sigcommon.c:27
int router_get_hashes_impl(const char *s, size_t s_len, common_digests_t *digests, const char *start_str, const char *end_str, char end_char)
Definition: sigcommon.c:112
int check_signature_token(const char *digest, ssize_t digest_len, struct directory_token_t *tok, crypto_pk_t *pkey, int flags, const char *doctype)
Definition: sigcommon.c:148
int router_get_hash_impl(const char *s, size_t s_len, char *digest, const char *start_str, const char *end_str, char end_char, digest_algorithm_t alg)
Definition: sigcommon.c:74
#define STATIC
Definition: testsupport.h:32
#define MOCK_DECL(rv, funcname, arglist)
Definition: testsupport.h:127