ed25519_cert.trunnel 1.3 KB

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