auth_x_protocol.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #ifndef __FS_CEPH_AUTH_X_PROTOCOL
  2. #define __FS_CEPH_AUTH_X_PROTOCOL
  3. #define CEPHX_GET_AUTH_SESSION_KEY 0x0100
  4. #define CEPHX_GET_PRINCIPAL_SESSION_KEY 0x0200
  5. #define CEPHX_GET_ROTATING_KEY 0x0400
  6. /* common bits */
  7. struct ceph_x_ticket_blob {
  8. __u8 struct_v;
  9. __le64 secret_id;
  10. __le32 blob_len;
  11. char blob[];
  12. } __attribute__ ((packed));
  13. /* common request/reply headers */
  14. struct ceph_x_request_header {
  15. __le16 op;
  16. } __attribute__ ((packed));
  17. struct ceph_x_reply_header {
  18. __le16 op;
  19. __le32 result;
  20. } __attribute__ ((packed));
  21. /* authenticate handshake */
  22. /* initial hello (no reply header) */
  23. struct ceph_x_server_challenge {
  24. __u8 struct_v;
  25. __le64 server_challenge;
  26. } __attribute__ ((packed));
  27. struct ceph_x_authenticate {
  28. __u8 struct_v;
  29. __le64 client_challenge;
  30. __le64 key;
  31. /* ticket blob */
  32. } __attribute__ ((packed));
  33. struct ceph_x_service_ticket_request {
  34. __u8 struct_v;
  35. __le32 keys;
  36. } __attribute__ ((packed));
  37. struct ceph_x_challenge_blob {
  38. __le64 server_challenge;
  39. __le64 client_challenge;
  40. } __attribute__ ((packed));
  41. /* authorize handshake */
  42. /*
  43. * The authorizer consists of two pieces:
  44. * a - service id, ticket blob
  45. * b - encrypted with session key
  46. */
  47. struct ceph_x_authorize_a {
  48. __u8 struct_v;
  49. __le64 global_id;
  50. __le32 service_id;
  51. struct ceph_x_ticket_blob ticket_blob;
  52. } __attribute__ ((packed));
  53. struct ceph_x_authorize_b {
  54. __u8 struct_v;
  55. __le64 nonce;
  56. } __attribute__ ((packed));
  57. struct ceph_x_authorize_reply {
  58. __u8 struct_v;
  59. __le64 nonce_plus_one;
  60. } __attribute__ ((packed));
  61. /*
  62. * encyption bundle
  63. */
  64. #define CEPHX_ENC_MAGIC 0xff009cad8826aa55ull
  65. struct ceph_x_encrypt_header {
  66. __u8 struct_v;
  67. __le64 magic;
  68. } __attribute__ ((packed));
  69. #endif