protover: Fix old tor hardcoded version check
[tor.git] / src / or / onion_ntor.h
blobf637b437fd7bab00c49e2466d723b659f6b3fa95
1 /* Copyright (c) 2012-2016, The Tor Project, Inc. */
2 /* See LICENSE for licensing information */
4 #ifndef TOR_ONION_NTOR_H
5 #define TOR_ONION_NTOR_H
7 #include "torint.h"
8 #include "crypto_curve25519.h"
9 #include "di_ops.h"
11 /** State to be maintained by a client between sending an ntor onionskin
12 * and receiving a reply. */
13 typedef struct ntor_handshake_state_t ntor_handshake_state_t;
15 /** Length of an ntor onionskin, as sent from the client to server. */
16 #define NTOR_ONIONSKIN_LEN 84
17 /** Length of an ntor reply, as sent from server to client. */
18 #define NTOR_REPLY_LEN 64
20 void ntor_handshake_state_free(ntor_handshake_state_t *state);
22 int onion_skin_ntor_create(const uint8_t *router_id,
23 const curve25519_public_key_t *router_key,
24 ntor_handshake_state_t **handshake_state_out,
25 uint8_t *onion_skin_out);
27 int onion_skin_ntor_server_handshake(const uint8_t *onion_skin,
28 const di_digest256_map_t *private_keys,
29 const curve25519_keypair_t *junk_keypair,
30 const uint8_t *my_node_id,
31 uint8_t *handshake_reply_out,
32 uint8_t *key_out,
33 size_t key_out_len);
35 int onion_skin_ntor_client_handshake(
36 const ntor_handshake_state_t *handshake_state,
37 const uint8_t *handshake_reply,
38 uint8_t *key_out,
39 size_t key_out_len,
40 const char **msg_out);
42 #ifdef ONION_NTOR_PRIVATE
44 /** Storage held by a client while waiting for an ntor reply from a server. */
45 struct ntor_handshake_state_t {
46 /** Identity digest of the router we're talking to. */
47 uint8_t router_id[DIGEST_LEN];
48 /** Onion key of the router we're talking to. */
49 curve25519_public_key_t pubkey_B;
51 /**
52 * Short-lived keypair for use with this handshake.
53 * @{ */
54 curve25519_secret_key_t seckey_x;
55 curve25519_public_key_t pubkey_X;
56 /** @} */
58 #endif
60 #endif