tor  0.4.1.0-alpha-dev
onion_ntor.h
1 /* Copyright (c) 2012-2019, The Tor Project, Inc. */
2 /* See LICENSE for licensing information */
3 
4 #ifndef TOR_ONION_NTOR_H
5 #define TOR_ONION_NTOR_H
6 
7 #include "lib/cc/torint.h"
8 
9 struct di_digest256_map_t;
12 
15 typedef struct ntor_handshake_state_t ntor_handshake_state_t;
16 
18 #define NTOR_ONIONSKIN_LEN 84
19 
20 #define NTOR_REPLY_LEN 64
21 
22 void ntor_handshake_state_free_(ntor_handshake_state_t *state);
23 #define ntor_handshake_state_free(state) \
24  FREE_AND_NULL(ntor_handshake_state_t, ntor_handshake_state_free_, (state))
25 
26 int onion_skin_ntor_create(const uint8_t *router_id,
27  const struct curve25519_public_key_t *router_key,
28  ntor_handshake_state_t **handshake_state_out,
29  uint8_t *onion_skin_out);
30 
31 int onion_skin_ntor_server_handshake(const uint8_t *onion_skin,
32  const struct di_digest256_map_t *private_keys,
33  const struct curve25519_keypair_t *junk_keypair,
34  const uint8_t *my_node_id,
35  uint8_t *handshake_reply_out,
36  uint8_t *key_out,
37  size_t key_out_len);
38 
40  const ntor_handshake_state_t *handshake_state,
41  const uint8_t *handshake_reply,
42  uint8_t *key_out,
43  size_t key_out_len,
44  const char **msg_out);
45 
46 #ifdef ONION_NTOR_PRIVATE
48 
50 struct ntor_handshake_state_t {
52  uint8_t router_id[DIGEST_LEN];
54  curve25519_public_key_t pubkey_B;
55 
59  curve25519_secret_key_t seckey_x;
60  curve25519_public_key_t pubkey_X;
62 };
63 #endif /* defined(ONION_NTOR_PRIVATE) */
64 
65 #endif /* !defined(TOR_ONION_NTOR_H) */
void ntor_handshake_state_free_(ntor_handshake_state_t *state)
Definition: onion_ntor.c:38
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
Integer definitions used throughout Tor.
#define DIGEST_LEN
Definition: digest_sizes.h:20
Header for crypto_curve25519.c.
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