Lines Matching refs:ctx

54 	struct af_alg_ctx *ctx;  in algif_skcipher_export()  local
63 ctx = ask->private; in algif_skcipher_export()
69 ctx->state = sock_kmalloc(sk, statesize, GFP_ATOMIC); in algif_skcipher_export()
70 if (!ctx->state) in algif_skcipher_export()
73 err = crypto_skcipher_export(req, ctx->state); in algif_skcipher_export()
75 sock_kzfree_s(sk, ctx->state, statesize); in algif_skcipher_export()
76 ctx->state = NULL; in algif_skcipher_export()
103 struct af_alg_ctx *ctx = ask->private; in _skcipher_recvmsg() local
111 if (!ctx->init || (ctx->more && ctx->used < bs)) { in _skcipher_recvmsg()
124 err = af_alg_get_rsgl(sk, msg, flags, areq, ctx->used, &len); in _skcipher_recvmsg()
132 if (ctx->more || len < ctx->used) { in _skcipher_recvmsg()
157 areq->first_rsgl.sgl.sgt.sgl, len, ctx->iv); in _skcipher_recvmsg()
159 if (ctx->state) { in _skcipher_recvmsg()
161 ctx->state); in _skcipher_recvmsg()
162 sock_kzfree_s(sk, ctx->state, crypto_skcipher_statesize(tfm)); in _skcipher_recvmsg()
163 ctx->state = NULL; in _skcipher_recvmsg()
181 err = ctx->enc ? in _skcipher_recvmsg()
196 crypto_req_done, &ctx->wait); in _skcipher_recvmsg()
197 err = crypto_wait_req(ctx->enc ? in _skcipher_recvmsg()
200 &ctx->wait); in _skcipher_recvmsg()
361 struct af_alg_ctx *ctx = ask->private; in skcipher_sock_destruct() local
366 af_alg_pull_tsgl(sk, ctx->used, NULL, 0); in skcipher_sock_destruct()
367 sock_kzfree_s(sk, ctx->iv, crypto_skcipher_ivsize(tfm)); in skcipher_sock_destruct()
368 if (ctx->state) in skcipher_sock_destruct()
369 sock_kzfree_s(sk, ctx->state, crypto_skcipher_statesize(tfm)); in skcipher_sock_destruct()
370 sock_kfree_s(sk, ctx, ctx->len); in skcipher_sock_destruct()
376 struct af_alg_ctx *ctx; in skcipher_accept_parent_nokey() local
379 unsigned int len = sizeof(*ctx); in skcipher_accept_parent_nokey()
381 ctx = sock_kmalloc(sk, len, GFP_KERNEL); in skcipher_accept_parent_nokey()
382 if (!ctx) in skcipher_accept_parent_nokey()
384 memset(ctx, 0, len); in skcipher_accept_parent_nokey()
386 ctx->iv = sock_kmalloc(sk, crypto_skcipher_ivsize(tfm), in skcipher_accept_parent_nokey()
388 if (!ctx->iv) { in skcipher_accept_parent_nokey()
389 sock_kfree_s(sk, ctx, len); in skcipher_accept_parent_nokey()
392 memset(ctx->iv, 0, crypto_skcipher_ivsize(tfm)); in skcipher_accept_parent_nokey()
394 INIT_LIST_HEAD(&ctx->tsgl_list); in skcipher_accept_parent_nokey()
395 ctx->len = len; in skcipher_accept_parent_nokey()
396 crypto_init_wait(&ctx->wait); in skcipher_accept_parent_nokey()
398 ask->private = ctx; in skcipher_accept_parent_nokey()