auth_x_protocol.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. /* ticket blob */
  33. } __attribute__ ((packed));
  34. struct ceph_x_service_ticket_request {
  35. __u8 struct_v;
  36. __le32 keys;
  37. } __attribute__ ((packed));
  38. struct ceph_x_challenge_blob {
  39. __le64 server_challenge;
  40. __le64 client_challenge;
  41. } __attribute__ ((packed));
  42. /* authorize handshake */
  43. /*
  44. * The authorizer consists of two pieces:
  45. * a - service id, ticket blob
  46. * b - encrypted with session key
  47. */
  48. struct ceph_x_authorize_a {
  49. __u8 struct_v;
  50. __le64 global_id;
  51. __le32 service_id;
  52. struct ceph_x_ticket_blob ticket_blob;
  53. } __attribute__ ((packed));
  54. struct ceph_x_authorize_b {
  55. __u8 struct_v;
  56. __le64 nonce;
  57. } __attribute__ ((packed));
  58. struct ceph_x_authorize_reply {
  59. __u8 struct_v;
  60. __le64 nonce_plus_one;
  61. } __attribute__ ((packed));
  62. /*
  63. * encyption bundle
  64. */
  65. #define CEPHX_ENC_MAGIC 0xff009cad8826aa55ull
  66. struct ceph_x_encrypt_header {
  67. __u8 struct_v;
  68. __le64 magic;
  69. } __attribute__ ((packed));
  70. #endif