Lines Matching refs:ac
18 static void ceph_x_validate_tickets(struct ceph_auth_client *ac, int *pneed);
20 static int ceph_x_is_authenticated(struct ceph_auth_client *ac) in ceph_x_is_authenticated() argument
22 struct ceph_x_info *xi = ac->private; in ceph_x_is_authenticated()
25 ceph_x_validate_tickets(ac, &need); in ceph_x_is_authenticated()
27 ac->want_keys, need, xi->have_keys); in ceph_x_is_authenticated()
28 return (ac->want_keys & xi->have_keys) == ac->want_keys; in ceph_x_is_authenticated()
31 static int ceph_x_should_authenticate(struct ceph_auth_client *ac) in ceph_x_should_authenticate() argument
33 struct ceph_x_info *xi = ac->private; in ceph_x_should_authenticate()
36 ceph_x_validate_tickets(ac, &need); in ceph_x_should_authenticate()
38 ac->want_keys, need, xi->have_keys); in ceph_x_should_authenticate()
100 get_ticket_handler(struct ceph_auth_client *ac, int service) in get_ticket_handler() argument
103 struct ceph_x_info *xi = ac->private; in get_ticket_handler()
127 static void remove_ticket_handler(struct ceph_auth_client *ac, in remove_ticket_handler() argument
130 struct ceph_x_info *xi = ac->private; in remove_ticket_handler()
140 static int process_one_ticket(struct ceph_auth_client *ac, in process_one_ticket() argument
144 struct ceph_x_info *xi = ac->private; in process_one_ticket()
169 th = get_ticket_handler(ac, type); in process_one_ticket()
246 static int ceph_x_proc_ticket_reply(struct ceph_auth_client *ac, in ceph_x_proc_ticket_reply() argument
263 ret = process_one_ticket(ac, secret, &p, end); in ceph_x_proc_ticket_reply()
283 static int ceph_x_build_authorizer(struct ceph_auth_client *ac, in ceph_x_build_authorizer() argument
322 msg_a->global_id = cpu_to_le64(ac->global_id); in ceph_x_build_authorizer()
397 static void ceph_x_validate_tickets(struct ceph_auth_client *ac, int *pneed) in ceph_x_validate_tickets() argument
399 int want = ac->want_keys; in ceph_x_validate_tickets()
400 struct ceph_x_info *xi = ac->private; in ceph_x_validate_tickets()
403 *pneed = ac->want_keys & ~(xi->have_keys); in ceph_x_validate_tickets()
408 if (!(ac->want_keys & service)) in ceph_x_validate_tickets()
414 th = get_ticket_handler(ac, service); in ceph_x_validate_tickets()
427 static int ceph_x_build_request(struct ceph_auth_client *ac, in ceph_x_build_request() argument
430 struct ceph_x_info *xi = ac->private; in ceph_x_build_request()
435 get_ticket_handler(ac, CEPH_ENTITY_TYPE_AUTH); in ceph_x_build_request()
440 ceph_x_validate_tickets(ac, &need); in ceph_x_build_request()
443 ac->want_keys, xi->have_keys, need); in ceph_x_build_request()
492 ret = ceph_x_build_authorizer(ac, th, &xi->auth_authorizer); in ceph_x_build_request()
507 static int ceph_x_handle_reply(struct ceph_auth_client *ac, int result, in ceph_x_handle_reply() argument
510 struct ceph_x_info *xi = ac->private; in ceph_x_handle_reply()
540 ret = ceph_x_proc_ticket_reply(ac, &xi->secret, in ceph_x_handle_reply()
545 th = get_ticket_handler(ac, CEPH_ENTITY_TYPE_AUTH); in ceph_x_handle_reply()
548 ret = ceph_x_proc_ticket_reply(ac, &th->session_key, in ceph_x_handle_reply()
557 if (ac->want_keys == xi->have_keys) in ceph_x_handle_reply()
571 struct ceph_auth_client *ac, int peer_type, in ceph_x_create_authorizer() argument
578 th = get_ticket_handler(ac, peer_type); in ceph_x_create_authorizer()
588 ret = ceph_x_build_authorizer(ac, th, au); in ceph_x_create_authorizer()
599 auth->sign_message = ac->ops->sign_message; in ceph_x_create_authorizer()
600 auth->check_message_signature = ac->ops->check_message_signature; in ceph_x_create_authorizer()
606 struct ceph_auth_client *ac, int peer_type, in ceph_x_update_authorizer() argument
612 th = get_ticket_handler(ac, peer_type); in ceph_x_update_authorizer()
620 return ceph_x_build_authorizer(ac, th, au); in ceph_x_update_authorizer()
625 static int ceph_x_verify_authorizer_reply(struct ceph_auth_client *ac, in ceph_x_verify_authorizer_reply() argument
648 static void ceph_x_reset(struct ceph_auth_client *ac) in ceph_x_reset() argument
650 struct ceph_x_info *xi = ac->private; in ceph_x_reset()
657 static void ceph_x_destroy(struct ceph_auth_client *ac) in ceph_x_destroy() argument
659 struct ceph_x_info *xi = ac->private; in ceph_x_destroy()
662 dout("ceph_x_destroy %p\n", ac); in ceph_x_destroy()
668 remove_ticket_handler(ac, th); in ceph_x_destroy()
673 kfree(ac->private); in ceph_x_destroy()
674 ac->private = NULL; in ceph_x_destroy()
677 static void invalidate_ticket(struct ceph_auth_client *ac, int peer_type) in invalidate_ticket() argument
681 th = get_ticket_handler(ac, peer_type); in invalidate_ticket()
686 static void ceph_x_invalidate_authorizer(struct ceph_auth_client *ac, in ceph_x_invalidate_authorizer() argument
695 invalidate_ticket(ac, peer_type); in ceph_x_invalidate_authorizer()
696 invalidate_ticket(ac, CEPH_ENTITY_TYPE_AUTH); in ceph_x_invalidate_authorizer()
786 int ceph_x_init(struct ceph_auth_client *ac) in ceph_x_init() argument
791 dout("ceph_x_init %p\n", ac); in ceph_x_init()
798 if (!ac->key) { in ceph_x_init()
803 ret = ceph_crypto_key_clone(&xi->secret, ac->key); in ceph_x_init()
812 ac->protocol = CEPH_AUTH_CEPHX; in ceph_x_init()
813 ac->private = xi; in ceph_x_init()
814 ac->ops = &ceph_x_ops; in ceph_x_init()