^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_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define _FS_CEPH_AUTH_X_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #include <linux/rbtree.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #include <linux/ceph/auth.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include "crypto.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include "auth_x_protocol.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) * Handle ticket for a single service.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) struct ceph_x_ticket_handler {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) struct rb_node node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) unsigned int service;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) struct ceph_crypto_key session_key;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) bool have_key;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) u64 secret_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) struct ceph_buffer *ticket_blob;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) time64_t renew_after, expires;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #define CEPHX_AU_ENC_BUF_LEN 128 /* big enough for encrypted blob */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) struct ceph_x_authorizer {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) struct ceph_authorizer base;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) struct ceph_crypto_key session_key;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) struct ceph_buffer *buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) unsigned int service;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) u64 nonce;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) u64 secret_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) char enc_buf[CEPHX_AU_ENC_BUF_LEN] __aligned(8);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) struct ceph_x_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) struct ceph_crypto_key secret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) bool starting;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) u64 server_challenge;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) unsigned int have_keys;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) struct rb_root ticket_handlers;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) struct ceph_x_authorizer auth_authorizer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) int ceph_x_init(struct ceph_auth_client *ac);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) #endif