onion.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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-2012, The Tor Project, Inc. */
  5. /* See LICENSE for licensing information */
  6. /**
  7. * \file onion.h
  8. * \brief Header file for onion.c.
  9. **/
  10. #ifndef TOR_ONION_H
  11. #define TOR_ONION_H
  12. int onion_pending_add(or_circuit_t *circ, char *onionskin);
  13. or_circuit_t *onion_next_task(char **onionskin_out);
  14. void onion_pending_remove(or_circuit_t *circ);
  15. void clear_pending_onions(void);
  16. typedef struct server_onion_keys_t {
  17. uint8_t my_identity[DIGEST_LEN];
  18. crypto_pk_t *onion_key;
  19. crypto_pk_t *last_onion_key;
  20. #ifdef CURVE25519_ENABLED
  21. di_digest256_map_t *curve25519_key_map;
  22. #endif
  23. } server_onion_keys_t;
  24. #define MAX_ONIONSKIN_CHALLENGE_LEN 255
  25. #define MAX_ONIONSKIN_REPLY_LEN 255
  26. void setup_server_onion_keys(server_onion_keys_t *keys);
  27. void release_server_onion_keys(server_onion_keys_t *keys);
  28. void onion_handshake_state_release(onion_handshake_state_t *state);
  29. int onion_skin_create(int type,
  30. const extend_info_t *node,
  31. onion_handshake_state_t *state_out,
  32. uint8_t *onion_skin_out);
  33. int onion_skin_server_handshake(int type,
  34. const uint8_t *onion_skin,
  35. const server_onion_keys_t *keys,
  36. uint8_t *reply_out,
  37. uint8_t *keys_out, size_t key_out_len);
  38. // uint8_t *rend_authenticator_out);
  39. int onion_skin_client_handshake(int type,
  40. const onion_handshake_state_t *handshake_state,
  41. const uint8_t *reply,
  42. uint8_t *keys_out, size_t key_out_len,
  43. uint8_t *rend_authenticator_out);
  44. #endif