onion_fast.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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-2017, The Tor Project, Inc. */
  5. /* See LICENSE for licensing information */
  6. /**
  7. * \file onion_fast.h
  8. * \brief Header file for onion_fast.c.
  9. **/
  10. #ifndef TOR_ONION_FAST_H
  11. #define TOR_ONION_FAST_H
  12. #define CREATE_FAST_LEN DIGEST_LEN
  13. #define CREATED_FAST_LEN (DIGEST_LEN*2)
  14. typedef struct fast_handshake_state_t {
  15. uint8_t state[DIGEST_LEN];
  16. } fast_handshake_state_t;
  17. void fast_handshake_state_free_(fast_handshake_state_t *victim);
  18. #define fast_handshake_state_free(st) \
  19. FREE_AND_NULL(fast_handshake_state_t, fast_handshake_state_free_, (st))
  20. int fast_onionskin_create(fast_handshake_state_t **handshake_state_out,
  21. uint8_t *handshake_out);
  22. int fast_server_handshake(const uint8_t *message_in,
  23. uint8_t *handshake_reply_out,
  24. uint8_t *key_out,
  25. size_t key_out_len);
  26. int fast_client_handshake(const fast_handshake_state_t *handshake_state,
  27. const uint8_t *handshake_reply_out,
  28. uint8_t *key_out,
  29. size_t key_out_len,
  30. const char **msg_out);
  31. #endif /* !defined(TOR_ONION_FAST_H) */