Tor  0.4.7.0-alpha-dev
Macros | Functions
sigcommon.h File Reference

Header file for sigcommon.c. More...

Go to the source code of this file.

Macros

#define CST_NO_CHECK_OBJTYPE   (1<<0)
 

Functions

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)
 
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)
 
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)
 
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)
 

Detailed Description

Header file for sigcommon.c.

Definition in file sigcommon.h.

Function Documentation

◆ check_signature_token()

int check_signature_token ( const char *  digest,
ssize_t  digest_len,
directory_token_t tok,
crypto_pk_t pkey,
int  flags,
const char *  doctype 
)

Check whether the object body of the token in tok has a good signature for digest using key pkey. If CST_NO_CHECK_OBJTYPE is set, do not check the object type of the signature object. Use doctype as the type of the document when generating log messages. Return 0 on success, negative on failure.

Definition at line 148 of file sigcommon.c.

◆ router_get_hash_impl()

int router_get_hash_impl ( const char *  s,
size_t  s_len,
char *  digest,
const char *  start_str,
const char *  end_str,
char  end_c,
digest_algorithm_t  alg 
)

Compute the digest of the substring of s taken from the first occurrence of start_str through the first instance of c after the first subsequent occurrence of end_str; store the 20-byte or 32-byte result in digest; return 0 on success.

If no such substring exists, return -1.

Definition at line 74 of file sigcommon.c.

Referenced by router_get_extrainfo_hash(), and router_get_router_hash().

◆ router_get_hash_impl_helper()

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 
)

Helper function for router_get_hash_impl: given s, s_len, start_str, end_str, and end_c with the same semantics as in that function, set *start_out (inclusive) and *end_out (exclusive) to the boundaries of the string to be hashed.

Return 0 on success and -1 on failure.

Definition at line 27 of file sigcommon.c.

Referenced by router_get_hash_impl(), router_get_hashes_impl(), and router_get_networkstatus_v3_signed_boundaries().

◆ router_get_hashes_impl()

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_c 
)

As router_get_hash_impl, but compute all hashes.

Definition at line 112 of file sigcommon.c.

Referenced by router_get_networkstatus_v3_hashes().