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