ed25519_cert.trunnel (1333B)
1 2 struct ed25519_cert { 3 u8 version IN [1]; 4 u8 cert_type; 5 u32 exp_field; 6 u8 cert_key_type; 7 u8 certified_key[32]; 8 u8 n_extensions; 9 struct ed25519_cert_extension ext[n_extensions]; 10 u8 signature[64]; 11 } 12 13 const CERTEXT_SIGNED_WITH_KEY = 4; 14 const CERTEXT_FLAG_AFFECTS_VALIDATION = 1; 15 16 struct ed25519_cert_extension { 17 u16 ext_length; 18 u8 ext_type; 19 u8 ext_flags; 20 union un[ext_type] with length ext_length { 21 CERTEXT_SIGNED_WITH_KEY : u8 signing_key[32]; 22 default: u8 unparsed[]; 23 }; 24 } 25 26 const LS_IPV4 = 0x00; 27 const LS_IPV6 = 0x01; 28 const LS_LEGACY_ID = 0x02; 29 const LS_ED25519_ID = 0x03; 30 31 // amended from tor.trunnel 32 struct link_specifier { 33 u8 ls_type; 34 u8 ls_len; 35 union un[ls_type] with length ls_len { 36 LS_IPV4: u32 ipv4_addr; u16 ipv4_port; 37 LS_IPV6: u8 ipv6_addr[16]; u16 ipv6_port; 38 LS_LEGACY_ID: u8 legacy_id[20]; 39 LS_ED25519_ID: u8 ed25519_id[32]; 40 default: u8 unrecognized[]; 41 }; 42 } 43 44 struct link_specifier_list { 45 u8 n_spec; 46 struct link_specifier spec[n_spec]; 47 } 48 49 struct extend1_cell_body { 50 u32 ipv4addr; 51 u16 port; 52 u8 onionskin[186]; 53 u8 identity[20]; 54 } 55 56 struct create2_cell_body { 57 u16 handshake_type; 58 u16 handshake_len; 59 u8 handshake_data[handshake_len]; 60 } 61 62 struct extend2_cell_body { 63 u8 n_spec; 64 struct link_specifier ls[n_spec]; 65 struct create2_cell_body create2; 66 }