blob: e30938f6c2f3514cd746d9b683e51509b1ebc995 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
/*
* This contains the definition of the ESTABLISH_INTRO and INTRO_ESTABLISHED
* cell for onion service version 3 and onward. The following format is
* specified in proposal 224 section 3.1.
*/
extern struct trn_cell_extension;
const TRUNNEL_SHA3_256_LEN = 32;
/* ESTABLISH_INTRO payload. See details in section 3.1.1 */
struct trn_cell_establish_intro {
/* Indicate the start of the handshake authentication data. */
@ptr start_cell;
/* Authentication key material. */
u8 auth_key_type IN [0x00, 0x01, 0x02];
u16 auth_key_len;
u8 auth_key[auth_key_len];
/* Extension(s). Reserved fields. */
struct trn_cell_extension extensions;
@ptr end_mac_fields;
/* Handshake MAC. */
u8 handshake_mac[TRUNNEL_SHA3_256_LEN];
/* Signature */
/* Indicate the end of the handshake authentication data. */
@ptr end_sig_fields;
u16 sig_len;
u8 sig[sig_len];
};
/* INTRO_ESTABLISHED payload which is an acknowledge of the ESTABLISH_INTRO
* cell. For legacy node, this payload is empty so the following only applies
* to version >= 3. */
struct trn_cell_intro_established {
/* Extension(s). Reserved fields. */
struct trn_cell_extension extensions;
};
/*
* ESTABLISH_INTRO cell extensions.
*/
const TRUNNEL_CELL_EXTENSION_TYPE_DOS = 0x01;
/* DoS Parameter types. */
const TRUNNEL_DOS_PARAM_TYPE_INTRO2_RATE_PER_SEC = 0x01;
const TRUNNEL_DOS_PARAM_TYPE_INTRO2_BURST_PER_SEC = 0x02;
/*
* DoS Parameters Extension. See proposal 305 for more details.
*/
struct trn_cell_extension_dos_param {
u8 type;
u64 value;
};
struct trn_cell_extension_dos {
u8 n_params;
struct trn_cell_extension_dos_param params[n_params];
};
|