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