Tor 0.4.9.0-alpha-dev
onion_ntor.h
Go to the documentation of this file.
1/* Copyright (c) 2012-2021, The Tor Project, Inc. */
2/* See LICENSE for licensing information */
3
4/**
5 * @file onion_ntor.h
6 * @brief Header for onion_ntor.c
7 **/
8
9#ifndef TOR_ONION_NTOR_H
10#define TOR_ONION_NTOR_H
11
12#include "lib/cc/torint.h"
13
17
18/** State to be maintained by a client between sending an ntor onionskin
19 * and receiving a reply. */
21
22/** Length of an ntor onionskin, as sent from the client to server. */
23#define NTOR_ONIONSKIN_LEN 84
24/** Length of an ntor reply, as sent from server to client. */
25#define NTOR_REPLY_LEN 64
26
28#define ntor_handshake_state_free(state) \
29 FREE_AND_NULL(ntor_handshake_state_t, ntor_handshake_state_free_, (state))
30
31int onion_skin_ntor_create(const uint8_t *router_id,
32 const struct curve25519_public_key_t *router_key,
33 ntor_handshake_state_t **handshake_state_out,
34 uint8_t *onion_skin_out);
35
36int onion_skin_ntor_server_handshake(const uint8_t *onion_skin,
37 const struct di_digest256_map_t *private_keys,
38 const struct curve25519_keypair_t *junk_keypair,
39 const uint8_t *my_node_id,
40 uint8_t *handshake_reply_out,
41 uint8_t *key_out,
42 size_t key_out_len);
43
45 const ntor_handshake_state_t *handshake_state,
46 const uint8_t *handshake_reply,
47 uint8_t *key_out,
48 size_t key_out_len,
49 const char **msg_out);
50
51#ifdef ONION_NTOR_PRIVATE
53
54/** Storage held by a client while waiting for an ntor reply from a server. */
56 /** Identity digest of the router we're talking to. */
57 uint8_t router_id[DIGEST_LEN];
58 /** Onion key of the router we're talking to. */
60
61 /**
62 * Short-lived keypair for use with this handshake.
63 * @{ */
66 /** @} */
67};
68#endif /* defined(ONION_NTOR_PRIVATE) */
69
70#endif /* !defined(TOR_ONION_NTOR_H) */
Header for crypto_curve25519.c.
#define DIGEST_LEN
Definition: digest_sizes.h:20
int onion_skin_ntor_server_handshake(const uint8_t *onion_skin, const di_digest256_map_t *private_keys, const curve25519_keypair_t *junk_keys, const uint8_t *my_node_id, uint8_t *handshake_reply_out, uint8_t *key_out, size_t key_out_len)
Definition: onion_ntor.c:149
int onion_skin_ntor_create(const uint8_t *router_id, const curve25519_public_key_t *router_key, ntor_handshake_state_t **handshake_state_out, uint8_t *onion_skin_out)
Definition: onion_ntor.c:93
int onion_skin_ntor_client_handshake(const ntor_handshake_state_t *handshake_state, const uint8_t *handshake_reply, uint8_t *key_out, size_t key_out_len, const char **msg_out)
Definition: onion_ntor.c:254
struct ntor_handshake_state_t ntor_handshake_state_t
Definition: onion_ntor.h:20
void ntor_handshake_state_free_(ntor_handshake_state_t *state)
Definition: onion_ntor.c:38
Integer definitions used throughout Tor.