Lines Matching refs:ctx
48 struct hash_ctx *ctx = ask->private; in hash_sendmsg() local
56 if (!ctx->more) { in hash_sendmsg()
57 err = af_alg_wait_for_completion(crypto_ahash_init(&ctx->req), in hash_sendmsg()
58 &ctx->completion); in hash_sendmsg()
63 ctx->more = 0; in hash_sendmsg()
71 len = af_alg_make_sg(&ctx->sgl, &msg->msg_iter, len); in hash_sendmsg()
77 ahash_request_set_crypt(&ctx->req, ctx->sgl.sg, NULL, len); in hash_sendmsg()
79 err = af_alg_wait_for_completion(crypto_ahash_update(&ctx->req), in hash_sendmsg()
80 &ctx->completion); in hash_sendmsg()
81 af_alg_free_sg(&ctx->sgl); in hash_sendmsg()
91 ctx->more = msg->msg_flags & MSG_MORE; in hash_sendmsg()
92 if (!ctx->more) { in hash_sendmsg()
93 ahash_request_set_crypt(&ctx->req, NULL, ctx->result, 0); in hash_sendmsg()
94 err = af_alg_wait_for_completion(crypto_ahash_final(&ctx->req), in hash_sendmsg()
95 &ctx->completion); in hash_sendmsg()
109 struct hash_ctx *ctx = ask->private; in hash_sendpage() local
116 sg_init_table(ctx->sgl.sg, 1); in hash_sendpage()
117 sg_set_page(ctx->sgl.sg, page, size, offset); in hash_sendpage()
119 ahash_request_set_crypt(&ctx->req, ctx->sgl.sg, ctx->result, size); in hash_sendpage()
122 if (ctx->more) in hash_sendpage()
123 err = crypto_ahash_finup(&ctx->req); in hash_sendpage()
125 err = crypto_ahash_digest(&ctx->req); in hash_sendpage()
127 if (!ctx->more) { in hash_sendpage()
128 err = crypto_ahash_init(&ctx->req); in hash_sendpage()
129 err = af_alg_wait_for_completion(err, &ctx->completion); in hash_sendpage()
134 err = crypto_ahash_update(&ctx->req); in hash_sendpage()
137 err = af_alg_wait_for_completion(err, &ctx->completion); in hash_sendpage()
141 ctx->more = flags & MSG_MORE; in hash_sendpage()
154 struct hash_ctx *ctx = ask->private; in hash_recvmsg() local
155 unsigned ds = crypto_ahash_digestsize(crypto_ahash_reqtfm(&ctx->req)); in hash_recvmsg()
164 if (ctx->more) { in hash_recvmsg()
165 ctx->more = 0; in hash_recvmsg()
166 ahash_request_set_crypt(&ctx->req, NULL, ctx->result, 0); in hash_recvmsg()
167 err = af_alg_wait_for_completion(crypto_ahash_final(&ctx->req), in hash_recvmsg()
168 &ctx->completion); in hash_recvmsg()
173 err = memcpy_to_msg(msg, ctx->result, len); in hash_recvmsg()
185 struct hash_ctx *ctx = ask->private; in hash_accept() local
186 struct ahash_request *req = &ctx->req; in hash_accept()
195 more = ctx->more; in hash_accept()
395 struct hash_ctx *ctx = ask->private; in hash_sock_destruct() local
397 sock_kzfree_s(sk, ctx->result, in hash_sock_destruct()
398 crypto_ahash_digestsize(crypto_ahash_reqtfm(&ctx->req))); in hash_sock_destruct()
399 sock_kfree_s(sk, ctx, ctx->len); in hash_sock_destruct()
405 struct hash_ctx *ctx; in hash_accept_parent_nokey() local
409 unsigned len = sizeof(*ctx) + crypto_ahash_reqsize(hash); in hash_accept_parent_nokey()
412 ctx = sock_kmalloc(sk, len, GFP_KERNEL); in hash_accept_parent_nokey()
413 if (!ctx) in hash_accept_parent_nokey()
416 ctx->result = sock_kmalloc(sk, ds, GFP_KERNEL); in hash_accept_parent_nokey()
417 if (!ctx->result) { in hash_accept_parent_nokey()
418 sock_kfree_s(sk, ctx, len); in hash_accept_parent_nokey()
422 memset(ctx->result, 0, ds); in hash_accept_parent_nokey()
424 ctx->len = len; in hash_accept_parent_nokey()
425 ctx->more = 0; in hash_accept_parent_nokey()
426 af_alg_init_completion(&ctx->completion); in hash_accept_parent_nokey()
428 ask->private = ctx; in hash_accept_parent_nokey()
430 ahash_request_set_tfm(&ctx->req, hash); in hash_accept_parent_nokey()
431 ahash_request_set_callback(&ctx->req, CRYPTO_TFM_REQ_MAY_BACKLOG, in hash_accept_parent_nokey()
432 af_alg_complete, &ctx->completion); in hash_accept_parent_nokey()