Use ((x + 7) >> 3) instead of (x >> 3) when converting from bits to bytes.
[tor.git] / src / trunnel / link_handshake.trunnel
blobb858e17c60754f34662c6402bf3395cb085d051f
2 struct certs_cell {
3   u8 n_certs;
4   struct certs_cell_cert certs[n_certs];
7 const CERTTYPE_RSA1024_ID_LINK = 1;
8 const CERTTYPE_RSA1024_ID_ID   = 2;
9 const CERTTYPE_RSA1024_ID_AUTH = 3;
10 const CERTTYPE_ED_ID_SIGN      = 4;
11 const CERTTYPE_ED_SIGN_LINK    = 5;
12 const CERTTYPE_ED_SIGN_AUTH    = 6;
13 const CERTTYPE_RSA1024_ID_EDID = 7;
15 struct certs_cell_cert {
16   u8 cert_type;
17   u16 cert_len;
18   u8 body[cert_len];
21 struct rsa_ed_crosscert {
22   u8 ed_key[32];
23   u32 expiration;
24   @ptr end_of_signed;
25   u8 sig_len;
26   u8 sig[sig_len]; // mismatches spec.
29 struct auth_challenge_cell {
30   u8 challenge[32];
31   u16 n_methods;
32   u16 methods[n_methods];
35 context auth_ctx {
36   u8 is_ed;
39 struct auth1 with context auth_ctx {
40   u8 type[8];
41   u8 cid[32];
42   u8 sid[32];
43   union u1[auth_ctx.is_ed] {
44     0 : ;
45     1 : u8 cid_ed[32];
46         u8 sid_ed[32];
47     default: fail;
48   };
49   u8 slog[32];
50   u8 clog[32];
51   u8 scert[32];
52   u8 tlssecrets[32];
53   @ptr end_of_fixed_part;
54   u8 rand[24];
55   @ptr end_of_signed;
56   u8 sig[];