Lines Matching refs:ac

20 static void ceph_x_validate_tickets(struct ceph_auth_client *ac, int *pneed);
22 static int ceph_x_is_authenticated(struct ceph_auth_client *ac) in ceph_x_is_authenticated() argument
24 struct ceph_x_info *xi = ac->private; in ceph_x_is_authenticated()
28 ceph_x_validate_tickets(ac, &need); in ceph_x_is_authenticated()
29 missing = ac->want_keys & ~xi->have_keys; in ceph_x_is_authenticated()
32 ac->want_keys, xi->have_keys, missing, !missing); in ceph_x_is_authenticated()
36 static int ceph_x_should_authenticate(struct ceph_auth_client *ac) in ceph_x_should_authenticate() argument
38 struct ceph_x_info *xi = ac->private; in ceph_x_should_authenticate()
41 ceph_x_validate_tickets(ac, &need); in ceph_x_should_authenticate()
43 ac->want_keys, xi->have_keys, need, !!need); in ceph_x_should_authenticate()
120 get_ticket_handler(struct ceph_auth_client *ac, int service) in get_ticket_handler() argument
123 struct ceph_x_info *xi = ac->private; in get_ticket_handler()
147 static void remove_ticket_handler(struct ceph_auth_client *ac, in remove_ticket_handler() argument
150 struct ceph_x_info *xi = ac->private; in remove_ticket_handler()
160 static int process_one_ticket(struct ceph_auth_client *ac, in process_one_ticket() argument
164 struct ceph_x_info *xi = ac->private; in process_one_ticket()
189 th = get_ticket_handler(ac, type); in process_one_ticket()
270 static int ceph_x_proc_ticket_reply(struct ceph_auth_client *ac, in ceph_x_proc_ticket_reply() argument
286 ret = process_one_ticket(ac, secret, p, end); in ceph_x_proc_ticket_reply()
351 static int ceph_x_build_authorizer(struct ceph_auth_client *ac, in ceph_x_build_authorizer() argument
390 msg_a->global_id = cpu_to_le64(ac->global_id); in ceph_x_build_authorizer()
458 static void ceph_x_validate_tickets(struct ceph_auth_client *ac, int *pneed) in ceph_x_validate_tickets() argument
460 int want = ac->want_keys; in ceph_x_validate_tickets()
461 struct ceph_x_info *xi = ac->private; in ceph_x_validate_tickets()
464 *pneed = ac->want_keys & ~(xi->have_keys); in ceph_x_validate_tickets()
469 if (!(ac->want_keys & service)) in ceph_x_validate_tickets()
475 th = get_ticket_handler(ac, service); in ceph_x_validate_tickets()
488 static int ceph_x_build_request(struct ceph_auth_client *ac, in ceph_x_build_request() argument
491 struct ceph_x_info *xi = ac->private; in ceph_x_build_request()
497 get_ticket_handler(ac, CEPH_ENTITY_TYPE_AUTH); in ceph_x_build_request()
502 ceph_x_validate_tickets(ac, &need); in ceph_x_build_request()
503 dout("%s want 0x%x have 0x%x need 0x%x\n", __func__, ac->want_keys, in ceph_x_build_request()
543 need = ac->want_keys & ~CEPH_ENTITY_TYPE_AUTH; in ceph_x_build_request()
551 ret = ceph_x_build_authorizer(ac, th, &xi->auth_authorizer); in ceph_x_build_request()
600 static int handle_auth_session_key(struct ceph_auth_client *ac, u64 global_id, in handle_auth_session_key() argument
605 struct ceph_x_info *xi = ac->private; in handle_auth_session_key()
612 ret = ceph_x_proc_ticket_reply(ac, &xi->secret, p, end); in handle_auth_session_key()
616 ceph_auth_set_global_id(ac, global_id); in handle_auth_session_key()
623 th = get_ticket_handler(ac, CEPH_ENTITY_TYPE_AUTH); in handle_auth_session_key()
653 ret = ceph_x_proc_ticket_reply(ac, &th->session_key, in handle_auth_session_key()
665 static int ceph_x_handle_reply(struct ceph_auth_client *ac, u64 global_id, in ceph_x_handle_reply() argument
670 struct ceph_x_info *xi = ac->private; in ceph_x_handle_reply()
699 ret = handle_auth_session_key(ac, global_id, &p, end, in ceph_x_handle_reply()
705 th = get_ticket_handler(ac, CEPH_ENTITY_TYPE_AUTH); in ceph_x_handle_reply()
710 ret = ceph_x_proc_ticket_reply(ac, &th->session_key, &p, end); in ceph_x_handle_reply()
718 if (ac->want_keys == xi->have_keys) in ceph_x_handle_reply()
735 struct ceph_auth_client *ac, int peer_type, in ceph_x_create_authorizer() argument
742 th = get_ticket_handler(ac, peer_type); in ceph_x_create_authorizer()
752 ret = ceph_x_build_authorizer(ac, th, au); in ceph_x_create_authorizer()
763 auth->sign_message = ac->ops->sign_message; in ceph_x_create_authorizer()
764 auth->check_message_signature = ac->ops->check_message_signature; in ceph_x_create_authorizer()
770 struct ceph_auth_client *ac, int peer_type, in ceph_x_update_authorizer() argument
776 th = get_ticket_handler(ac, peer_type); in ceph_x_update_authorizer()
784 return ceph_x_build_authorizer(ac, th, au); in ceph_x_update_authorizer()
817 static int ceph_x_add_authorizer_challenge(struct ceph_auth_client *ac, in ceph_x_add_authorizer_challenge() argument
875 static int ceph_x_verify_authorizer_reply(struct ceph_auth_client *ac, in ceph_x_verify_authorizer_reply() argument
904 static void ceph_x_reset(struct ceph_auth_client *ac) in ceph_x_reset() argument
906 struct ceph_x_info *xi = ac->private; in ceph_x_reset()
913 static void ceph_x_destroy(struct ceph_auth_client *ac) in ceph_x_destroy() argument
915 struct ceph_x_info *xi = ac->private; in ceph_x_destroy()
918 dout("ceph_x_destroy %p\n", ac); in ceph_x_destroy()
924 remove_ticket_handler(ac, th); in ceph_x_destroy()
929 kfree(ac->private); in ceph_x_destroy()
930 ac->private = NULL; in ceph_x_destroy()
933 static void invalidate_ticket(struct ceph_auth_client *ac, int peer_type) in invalidate_ticket() argument
937 th = get_ticket_handler(ac, peer_type); in invalidate_ticket()
949 static void ceph_x_invalidate_authorizer(struct ceph_auth_client *ac, in ceph_x_invalidate_authorizer() argument
958 invalidate_ticket(ac, peer_type); in ceph_x_invalidate_authorizer()
959 invalidate_ticket(ac, CEPH_ENTITY_TYPE_AUTH); in ceph_x_invalidate_authorizer()
1087 int ceph_x_init(struct ceph_auth_client *ac) in ceph_x_init() argument
1092 dout("ceph_x_init %p\n", ac); in ceph_x_init()
1099 if (!ac->key) { in ceph_x_init()
1104 ret = ceph_crypto_key_clone(&xi->secret, ac->key); in ceph_x_init()
1113 ac->protocol = CEPH_AUTH_CEPHX; in ceph_x_init()
1114 ac->private = xi; in ceph_x_init()
1115 ac->ops = &ceph_x_ops; in ceph_x_init()