Lines Matching +full:4 +full:th
119 struct ceph_x_ticket_handler *th; in get_ticket_handler() local
125 th = rb_entry(parent, struct ceph_x_ticket_handler, node); in get_ticket_handler()
126 if (service < th->service) in get_ticket_handler()
128 else if (service > th->service) in get_ticket_handler()
131 return th; in get_ticket_handler()
135 th = kzalloc(sizeof(*th), GFP_NOFS); in get_ticket_handler()
136 if (!th) in get_ticket_handler()
138 th->service = service; in get_ticket_handler()
139 rb_link_node(&th->node, parent, p); in get_ticket_handler()
140 rb_insert_color(&th->node, &xi->ticket_handlers); in get_ticket_handler()
141 return th; in get_ticket_handler()
145 struct ceph_x_ticket_handler *th) in remove_ticket_handler() argument
149 dout("remove_ticket_handler %p %d\n", th, th->service); in remove_ticket_handler()
150 rb_erase(&th->node, &xi->ticket_handlers); in remove_ticket_handler()
151 ceph_crypto_key_destroy(&th->session_key); in remove_ticket_handler()
152 if (th->ticket_blob) in remove_ticket_handler()
153 ceph_buffer_put(th->ticket_blob); in remove_ticket_handler()
154 kfree(th); in remove_ticket_handler()
164 struct ceph_x_ticket_handler *th; in process_one_ticket() local
186 th = get_ticket_handler(ac, type); in process_one_ticket()
187 if (IS_ERR(th)) { in process_one_ticket()
188 ret = PTR_ERR(th); in process_one_ticket()
211 new_renew_after = new_expires - (validity.tv_sec / 4); in process_one_ticket()
220 ret = ceph_x_decrypt(&th->session_key, p, end); in process_one_ticket()
244 ceph_crypto_key_destroy(&th->session_key); in process_one_ticket()
245 if (th->ticket_blob) in process_one_ticket()
246 ceph_buffer_put(th->ticket_blob); in process_one_ticket()
247 th->session_key = new_session_key; in process_one_ticket()
248 th->ticket_blob = new_ticket_blob; in process_one_ticket()
249 th->secret_id = new_secret_id; in process_one_ticket()
250 th->expires = new_expires; in process_one_ticket()
251 th->renew_after = new_renew_after; in process_one_ticket()
252 th->have_key = true; in process_one_ticket()
254 type, ceph_entity_type_name(type), th->secret_id, in process_one_ticket()
255 (int)th->ticket_blob->vec.iov_len); in process_one_ticket()
256 xi->have_keys |= th->service; in process_one_ticket()
349 struct ceph_x_ticket_handler *th, in ceph_x_build_authorizer() argument
357 (th->ticket_blob ? th->ticket_blob->vec.iov_len : 0); in ceph_x_build_authorizer()
360 ceph_entity_type_name(th->service), au); in ceph_x_build_authorizer()
363 ret = ceph_crypto_key_clone(&au->session_key, &th->session_key); in ceph_x_build_authorizer()
381 au->service = th->service; in ceph_x_build_authorizer()
382 au->secret_id = th->secret_id; in ceph_x_build_authorizer()
387 msg_a->service_id = cpu_to_le32(th->service); in ceph_x_build_authorizer()
389 msg_a->ticket_blob.secret_id = cpu_to_le64(th->secret_id); in ceph_x_build_authorizer()
392 memcpy(msg_a->ticket_blob.blob, th->ticket_blob->vec.iov_base, in ceph_x_build_authorizer()
393 th->ticket_blob->vec.iov_len); in ceph_x_build_authorizer()
395 dout(" th %p secret_id %lld %lld\n", th, th->secret_id, in ceph_x_build_authorizer()
414 static int ceph_x_encode_ticket(struct ceph_x_ticket_handler *th, in ceph_x_encode_ticket() argument
419 ceph_encode_64(p, th->secret_id); in ceph_x_encode_ticket()
420 if (th->ticket_blob) { in ceph_x_encode_ticket()
421 const char *buf = th->ticket_blob->vec.iov_base; in ceph_x_encode_ticket()
422 u32 len = th->ticket_blob->vec.iov_len; in ceph_x_encode_ticket()
435 static bool need_key(struct ceph_x_ticket_handler *th) in need_key() argument
437 if (!th->have_key) in need_key()
440 return ktime_get_real_seconds() >= th->renew_after; in need_key()
443 static bool have_key(struct ceph_x_ticket_handler *th) in have_key() argument
445 if (th->have_key) { in have_key()
446 if (ktime_get_real_seconds() >= th->expires) in have_key()
447 th->have_key = false; in have_key()
450 return th->have_key; in have_key()
462 struct ceph_x_ticket_handler *th; in ceph_x_validate_tickets() local
470 th = get_ticket_handler(ac, service); in ceph_x_validate_tickets()
471 if (IS_ERR(th)) { in ceph_x_validate_tickets()
476 if (need_key(th)) in ceph_x_validate_tickets()
478 if (!have_key(th)) in ceph_x_validate_tickets()
490 struct ceph_x_ticket_handler *th = in ceph_x_build_request() local
493 if (IS_ERR(th)) in ceph_x_build_request()
494 return PTR_ERR(th); in ceph_x_build_request()
533 ret = ceph_x_encode_ticket(th, &p, end); in ceph_x_build_request()
548 ret = ceph_x_build_authorizer(ac, th, &xi->auth_authorizer); in ceph_x_build_request()
568 struct ceph_x_ticket_handler *th; in ceph_x_handle_reply() local
601 th = get_ticket_handler(ac, CEPH_ENTITY_TYPE_AUTH); in ceph_x_handle_reply()
602 if (IS_ERR(th)) in ceph_x_handle_reply()
603 return PTR_ERR(th); in ceph_x_handle_reply()
604 ret = ceph_x_proc_ticket_reply(ac, &th->session_key, in ceph_x_handle_reply()
631 struct ceph_x_ticket_handler *th; in ceph_x_create_authorizer() local
634 th = get_ticket_handler(ac, peer_type); in ceph_x_create_authorizer()
635 if (IS_ERR(th)) in ceph_x_create_authorizer()
636 return PTR_ERR(th); in ceph_x_create_authorizer()
644 ret = ceph_x_build_authorizer(ac, th, au); in ceph_x_create_authorizer()
666 struct ceph_x_ticket_handler *th; in ceph_x_update_authorizer() local
668 th = get_ticket_handler(ac, peer_type); in ceph_x_update_authorizer()
669 if (IS_ERR(th)) in ceph_x_update_authorizer()
670 return PTR_ERR(th); in ceph_x_update_authorizer()
673 if (au->secret_id < th->secret_id) { in ceph_x_update_authorizer()
675 au->service, au->secret_id, th->secret_id); in ceph_x_update_authorizer()
676 return ceph_x_build_authorizer(ac, th, au); in ceph_x_update_authorizer()
772 struct ceph_x_ticket_handler *th = in ceph_x_destroy() local
774 remove_ticket_handler(ac, th); in ceph_x_destroy()
785 struct ceph_x_ticket_handler *th; in invalidate_ticket() local
787 th = get_ticket_handler(ac, peer_type); in invalidate_ticket()
788 if (!IS_ERR(th)) in invalidate_ticket()
789 th->have_key = false; in invalidate_ticket()
820 sigblock->len = cpu_to_le32(4*sizeof(u32)); in calc_signature()