Tor  0.4.7.0-alpha-dev
onion_crypto.h
Go to the documentation of this file.
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-2021, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
6 
7 /**
8  * \file onion_crypto.h
9  * \brief Header file for onion_crypto.c.
10  **/
11 
12 #ifndef TOR_ONION_CRYPTO_H
13 #define TOR_ONION_CRYPTO_H
14 
15 typedef struct server_onion_keys_t {
16  uint8_t my_identity[DIGEST_LEN];
17  crypto_pk_t *onion_key;
18  crypto_pk_t *last_onion_key;
19  struct di_digest256_map_t *curve25519_key_map;
20  struct curve25519_keypair_t *junk_keypair;
22 
24 
25 int onion_skin_create(int type,
26  const extend_info_t *node,
27  onion_handshake_state_t *state_out,
28  uint8_t *onion_skin_out);
29 int onion_skin_server_handshake(int type,
30  const uint8_t *onion_skin, size_t onionskin_len,
31  const server_onion_keys_t *keys,
32  uint8_t *reply_out,
33  uint8_t *keys_out, size_t key_out_len,
34  uint8_t *rend_nonce_out);
35 int onion_skin_client_handshake(int type,
36  const onion_handshake_state_t *handshake_state,
37  const uint8_t *reply, size_t reply_len,
38  uint8_t *keys_out, size_t key_out_len,
39  uint8_t *rend_authenticator_out,
40  const char **msg_out);
41 
44 #define server_onion_keys_free(keys) \
45  FREE_AND_NULL(server_onion_keys_t, server_onion_keys_free_, (keys))
46 
47 #endif /* !defined(TOR_ONION_CRYPTO_H) */
#define DIGEST_LEN
Definition: digest_sizes.h:20
server_onion_keys_t * server_onion_keys_new(void)
Definition: onion_crypto.c:51
void server_onion_keys_free_(server_onion_keys_t *keys)
Definition: onion_crypto.c:63
void onion_handshake_state_release(onion_handshake_state_t *state)
Definition: onion_crypto.c:79
int onion_skin_create(int type, const extend_info_t *node, onion_handshake_state_t *state_out, uint8_t *onion_skin_out)
Definition: onion_crypto.c:110
int onion_skin_server_handshake(int type, const uint8_t *onion_skin, size_t onionskin_len, const server_onion_keys_t *keys, uint8_t *reply_out, uint8_t *keys_out, size_t key_out_len, uint8_t *rend_nonce_out)
Definition: onion_crypto.c:174
int onion_skin_client_handshake(int type, const onion_handshake_state_t *handshake_state, const uint8_t *reply, size_t reply_len, uint8_t *keys_out, size_t key_out_len, uint8_t *rend_authenticator_out, const char **msg_out)
Definition: onion_crypto.c:247