Lines Matching refs:au
283 static void ceph_x_authorizer_cleanup(struct ceph_x_authorizer *au) in ceph_x_authorizer_cleanup() argument
285 ceph_crypto_key_destroy(&au->session_key); in ceph_x_authorizer_cleanup()
286 if (au->buf) { in ceph_x_authorizer_cleanup()
287 ceph_buffer_put(au->buf); in ceph_x_authorizer_cleanup()
288 au->buf = NULL; in ceph_x_authorizer_cleanup()
294 struct ceph_x_authorizer *au) in ceph_x_build_authorizer() argument
305 ceph_entity_type_name(th->service), au); in ceph_x_build_authorizer()
307 ceph_crypto_key_destroy(&au->session_key); in ceph_x_build_authorizer()
308 ret = ceph_crypto_key_clone(&au->session_key, &th->session_key); in ceph_x_build_authorizer()
315 if (au->buf && au->buf->alloc_len < maxlen) { in ceph_x_build_authorizer()
316 ceph_buffer_put(au->buf); in ceph_x_build_authorizer()
317 au->buf = NULL; in ceph_x_build_authorizer()
319 if (!au->buf) { in ceph_x_build_authorizer()
320 au->buf = ceph_buffer_new(maxlen, GFP_NOFS); in ceph_x_build_authorizer()
321 if (!au->buf) { in ceph_x_build_authorizer()
326 au->service = th->service; in ceph_x_build_authorizer()
327 au->secret_id = th->secret_id; in ceph_x_build_authorizer()
329 msg_a = au->buf->vec.iov_base; in ceph_x_build_authorizer()
345 end = au->buf->vec.iov_base + au->buf->vec.iov_len; in ceph_x_build_authorizer()
347 get_random_bytes(&au->nonce, sizeof(au->nonce)); in ceph_x_build_authorizer()
349 msg_b.nonce = cpu_to_le64(au->nonce); in ceph_x_build_authorizer()
350 ret = ceph_x_encrypt(&au->session_key, &msg_b, sizeof(msg_b), in ceph_x_build_authorizer()
355 au->buf->vec.iov_len = p - au->buf->vec.iov_base; in ceph_x_build_authorizer()
356 dout(" built authorizer nonce %llx len %d\n", au->nonce, in ceph_x_build_authorizer()
357 (int)au->buf->vec.iov_len); in ceph_x_build_authorizer()
358 BUG_ON(au->buf->vec.iov_len > maxlen); in ceph_x_build_authorizer()
362 ceph_x_authorizer_cleanup(au); in ceph_x_build_authorizer()
557 struct ceph_x_authorizer *au; in ceph_x_create_authorizer() local
565 au = kzalloc(sizeof(*au), GFP_NOFS); in ceph_x_create_authorizer()
566 if (!au) in ceph_x_create_authorizer()
569 ret = ceph_x_build_authorizer(ac, th, au); in ceph_x_create_authorizer()
571 kfree(au); in ceph_x_create_authorizer()
575 auth->authorizer = (struct ceph_authorizer *) au; in ceph_x_create_authorizer()
576 auth->authorizer_buf = au->buf->vec.iov_base; in ceph_x_create_authorizer()
577 auth->authorizer_buf_len = au->buf->vec.iov_len; in ceph_x_create_authorizer()
578 auth->authorizer_reply_buf = au->reply_buf; in ceph_x_create_authorizer()
579 auth->authorizer_reply_buf_len = sizeof (au->reply_buf); in ceph_x_create_authorizer()
590 struct ceph_x_authorizer *au; in ceph_x_update_authorizer() local
597 au = (struct ceph_x_authorizer *)auth->authorizer; in ceph_x_update_authorizer()
598 if (au->secret_id < th->secret_id) { in ceph_x_update_authorizer()
600 au->service, au->secret_id, th->secret_id); in ceph_x_update_authorizer()
601 return ceph_x_build_authorizer(ac, th, au); in ceph_x_update_authorizer()
609 struct ceph_x_authorizer *au = (void *)a; in ceph_x_verify_authorizer_reply() local
613 void *p = au->reply_buf; in ceph_x_verify_authorizer_reply()
614 void *end = p + sizeof(au->reply_buf); in ceph_x_verify_authorizer_reply()
616 ret = ceph_x_decrypt(&au->session_key, &p, end, &preply, sizeof(reply)); in ceph_x_verify_authorizer_reply()
622 if (au->nonce + 1 != le64_to_cpu(reply.nonce_plus_one)) in ceph_x_verify_authorizer_reply()
627 au->nonce, le64_to_cpu(reply.nonce_plus_one), ret); in ceph_x_verify_authorizer_reply()
634 struct ceph_x_authorizer *au = (void *)a; in ceph_x_destroy_authorizer() local
636 ceph_x_authorizer_cleanup(au); in ceph_x_destroy_authorizer()
637 kfree(au); in ceph_x_destroy_authorizer()
680 static int calcu_signature(struct ceph_x_authorizer *au, in calcu_signature() argument
689 ret = ceph_x_encrypt(&au->session_key, &tmp, sizeof(tmp), in calcu_signature()