routerkeys.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /* Copyright (c) 2014, The Tor Project, Inc. */
  2. /* See LICENSE for licensing information */
  3. #ifndef TOR_ROUTERKEYS_H
  4. #define TOR_ROUTERKEYS_H
  5. #include "crypto_ed25519.h"
  6. #define INIT_ED_KEY_CREATE (1u<<0)
  7. #define INIT_ED_KEY_REPLACE (1u<<1)
  8. #define INIT_ED_KEY_SPLIT (1u<<2)
  9. #define INIT_ED_KEY_MISSING_SECRET_OK (1u<<3)
  10. #define INIT_ED_KEY_NEEDCERT (1u<<4)
  11. #define INIT_ED_KEY_EXTRA_STRONG (1u<<5)
  12. #define INIT_ED_KEY_INCLUDE_SIGNING_KEY_IN_CERT (1u<<6)
  13. #define INIT_ED_KEY_OMIT_SECRET (1u<<7)
  14. struct tor_cert_st;
  15. ed25519_keypair_t *ed_key_init_from_file(const char *fname, uint32_t flags,
  16. int severity,
  17. const ed25519_keypair_t *signing_key,
  18. time_t now,
  19. time_t lifetime,
  20. uint8_t cert_type,
  21. struct tor_cert_st **cert_out);
  22. ed25519_keypair_t *ed_key_new(const ed25519_keypair_t *signing_key,
  23. uint32_t flags,
  24. time_t now,
  25. time_t lifetime,
  26. uint8_t cert_type,
  27. struct tor_cert_st **cert_out);
  28. const ed25519_public_key_t *get_master_identity_key(void);
  29. const ed25519_keypair_t *get_master_signing_keypair(void);
  30. const struct tor_cert_st *get_master_signing_key_cert(void);
  31. const ed25519_keypair_t *get_current_link_keypair(void);
  32. const ed25519_keypair_t *get_current_auth_keypair(void);
  33. const struct tor_cert_st *get_current_link_key_cert(void);
  34. const struct tor_cert_st *get_current_auth_key_cert(void);
  35. struct tor_cert_st *make_ntor_onion_key_crosscert(
  36. const curve25519_keypair_t *onion_key,
  37. const ed25519_public_key_t *master_id_key,
  38. time_t now, time_t lifetime,
  39. int *sign_out);
  40. uint8_t *make_tap_onion_key_crosscert(const crypto_pk_t *onion_key,
  41. const ed25519_public_key_t *master_id_key,
  42. const crypto_pk_t *rsa_id_key,
  43. int *len_out);
  44. int check_tap_onion_key_crosscert(const uint8_t *crosscert,
  45. int crosscert_len,
  46. const crypto_pk_t *onion_pkey,
  47. const ed25519_public_key_t *master_id_pkey,
  48. const uint8_t *rsa_id_digest);
  49. int load_ed_keys(const or_options_t *options, time_t now);
  50. int should_make_new_ed_keys(const or_options_t *options, const time_t now);
  51. void routerkeys_free_all(void);
  52. #endif