summaryrefslogtreecommitdiff
path: root/src/feature/dirparse/sigcommon.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-09-30 23:08:25 -0500
committerNick Mathewson <nickm@torproject.org>2018-10-01 00:09:00 -0500
commit430ca38f706be08e0df0c1cf025786cb25e46172 (patch)
tree278406566788d370c0373caceefc19b1e9905fb0 /src/feature/dirparse/sigcommon.h
parent2f5dc486993b88eb23de7f06043991f08e4d0d73 (diff)
downloadtor-430ca38f706be08e0df0c1cf025786cb25e46172.tar.gz
tor-430ca38f706be08e0df0c1cf025786cb25e46172.zip
Split the authority-cert and signature/hash code from routerparse
Diffstat (limited to 'src/feature/dirparse/sigcommon.h')
-rw-r--r--src/feature/dirparse/sigcommon.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/feature/dirparse/sigcommon.h b/src/feature/dirparse/sigcommon.h
new file mode 100644
index 0000000000..5f25817cdb
--- /dev/null
+++ b/src/feature/dirparse/sigcommon.h
@@ -0,0 +1,48 @@
+/* Copyright (c) 2001 Matej Pfajfar.
+ * Copyright (c) 2001-2004, Roger Dingledine.
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2018, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+/**
+ * \file sigcommon.h
+ * \brief Header file for sigcommon.c.
+ **/
+
+#ifndef TOR_SIGCOMMON_H
+#define TOR_SIGCOMMON_H
+
+/* TODO: Rename all of these 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);
+
+#define CST_NO_CHECK_OBJTYPE (1<<0)
+struct directory_token_t;
+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);
+
+#ifdef SIGCOMMON_PRIVATE
+MOCK_DECL(STATIC int, signed_digest_equals,
+ (const uint8_t *d1, const uint8_t *d2, size_t len));
+MOCK_DECL(STATIC int, router_compute_hash_final,(char *digest,
+ const char *start, size_t len,
+ digest_algorithm_t alg));
+#endif
+
+#endif /* !defined(TOR_SIGCOMMON_H) */