Use ((x + 7) >> 3) instead of (x >> 3) when converting from bits to bytes.
[tor.git] / src / trunnel / hs / cell_establish_intro.trunnel
blob011ee62a159d934e2116eef4de17fa4c3a534ade
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  */
7 extern struct trn_cell_extension;
9 const TRUNNEL_SHA3_256_LEN = 32;
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;
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];
21   /* Extension(s). Reserved fields. */
22   struct trn_cell_extension extensions;
23   @ptr end_mac_fields;
25   /* Handshake MAC. */
26   u8 handshake_mac[TRUNNEL_SHA3_256_LEN];
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];
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_cell_extension extensions;