auth_x_protocol.h 1.9 KB

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