sigcommon.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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-2018, The Tor Project, Inc. */
  5. /* See LICENSE for licensing information */
  6. /**
  7. * \file sigcommon.h
  8. * \brief Header file for sigcommon.c.
  9. **/
  10. #ifndef TOR_SIGCOMMON_H
  11. #define TOR_SIGCOMMON_H
  12. /* TODO: Rename all of these functions */
  13. int router_get_hash_impl(const char *s, size_t s_len, char *digest,
  14. const char *start_str, const char *end_str,
  15. char end_char,
  16. digest_algorithm_t alg);
  17. #define CST_NO_CHECK_OBJTYPE (1<<0)
  18. struct directory_token_t;
  19. int check_signature_token(const char *digest,
  20. ssize_t digest_len,
  21. struct directory_token_t *tok,
  22. crypto_pk_t *pkey,
  23. int flags,
  24. const char *doctype);
  25. int router_get_hash_impl_helper(const char *s, size_t s_len,
  26. const char *start_str,
  27. const char *end_str, char end_c,
  28. int log_severity,
  29. const char **start_out, const char **end_out);
  30. int router_get_hashes_impl(const char *s, size_t s_len,
  31. common_digests_t *digests,
  32. const char *start_str, const char *end_str,
  33. char end_char);
  34. #ifdef SIGCOMMON_PRIVATE
  35. MOCK_DECL(STATIC int, signed_digest_equals,
  36. (const uint8_t *d1, const uint8_t *d2, size_t len));
  37. MOCK_DECL(STATIC int, router_compute_hash_final,(char *digest,
  38. const char *start, size_t len,
  39. digest_algorithm_t alg));
  40. #endif
  41. #endif /* !defined(TOR_SIGCOMMON_H) */