Tor 0.4.9.0-alpha-dev
or_handshake_state_st.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 or_handshake_state_st.h
9 * @brief OR handshake state structure
10 **/
11
12#ifndef OR_HANDSHAKE_STATE_ST
13#define OR_HANDSHAKE_STATE_ST
14
15/** Stores flags and information related to the portion of a v2/v3 Tor OR
16 * connection handshake that happens after the TLS handshake is finished.
17 */
19 /** When was the VERSIONS cell sent on this connection? Used to get
20 * an estimate of the skew in the returning NETINFO reply. */
22 /** True iff we originated this connection */
23 unsigned int started_here : 1;
24 /** True iff we have received and processed a VERSIONS cell. */
25 unsigned int received_versions : 1;
26 /** True iff we have received and processed an AUTH_CHALLENGE cell */
27 unsigned int received_auth_challenge : 1;
28 /** True iff we have received and processed a CERTS cell. */
29 unsigned int received_certs_cell : 1;
30 /** True iff we have received and processed an AUTHENTICATE cell */
31 unsigned int received_authenticate : 1;
32
33 /* True iff we've received valid authentication to some identity. */
34 unsigned int authenticated : 1;
35 unsigned int authenticated_rsa : 1;
36 unsigned int authenticated_ed25519 : 1;
37
38 /* True iff we have sent a netinfo cell */
39 unsigned int sent_netinfo : 1;
40
41 /** The signing->ed25519 link certificate corresponding to the x509
42 * certificate we used on the TLS connection (if this is a server-side
43 * connection). We make a copy of this here to prevent a race condition
44 * caused by TLS context rotation. */
45 struct tor_cert_st *own_link_cert;
46
47 /** True iff we should feed outgoing cells into digest_sent and
48 * digest_received respectively.
49 *
50 * From the server's side of the v3 handshake, we want to capture everything
51 * from the VERSIONS cell through and including the AUTH_CHALLENGE cell.
52 * From the client's, we want to capture everything from the VERSIONS cell
53 * through but *not* including the AUTHENTICATE cell.
54 *
55 * @{ */
56 unsigned int digest_sent_data : 1;
57 unsigned int digest_received_data : 1;
58 /**@}*/
59
60 /** Identity RSA digest that we have received and authenticated for our peer
61 * on this connection. */
63 /** Identity Ed25519 public key that we have received and authenticated for
64 * our peer on this connection. */
66
67 /** Digests of the cells that we have sent or received as part of a V3
68 * handshake. Used for making and checking AUTHENTICATE cells.
69 *
70 * @{
71 */
73 crypto_digest_t *digest_received;
74 /** @} */
75
76 /** Certificates that a connection initiator sent us in a CERTS cell; we're
77 * holding on to them until we get an AUTHENTICATE cell.
78 */
80};
81
82#endif /* !defined(OR_HANDSHAKE_STATE_ST) */
#define DIGEST_LEN
Definition: digest_sizes.h:20
unsigned int received_authenticate
unsigned int received_auth_challenge
struct tor_cert_st * own_link_cert
crypto_digest_t * digest_sent
or_handshake_certs_t * certs
ed25519_public_key_t authenticated_ed25519_peer_id
uint8_t authenticated_rsa_peer_id[DIGEST_LEN]