Lines Matching refs:ctx
51 struct chainiv_ctx *ctx = crypto_ablkcipher_ctx(geniv); in chainiv_givencrypt() local
64 spin_lock_bh(&ctx->lock); in chainiv_givencrypt()
68 memcpy(req->giv, ctx->iv, ivsize); in chainiv_givencrypt()
69 memcpy(subreq->info, ctx->iv, ivsize); in chainiv_givencrypt()
75 memcpy(ctx->iv, subreq->info, ivsize); in chainiv_givencrypt()
78 spin_unlock_bh(&ctx->lock); in chainiv_givencrypt()
102 struct chainiv_ctx *ctx = crypto_tfm_ctx(tfm); in chainiv_init() local
105 spin_lock_init(&ctx->lock); in chainiv_init()
110 iv = ctx->iv; in chainiv_init()
116 static int async_chainiv_schedule_work(struct async_chainiv_ctx *ctx) in async_chainiv_schedule_work() argument
119 int err = ctx->err; in async_chainiv_schedule_work()
121 if (!ctx->queue.qlen) { in async_chainiv_schedule_work()
123 clear_bit(CHAINIV_STATE_INUSE, &ctx->state); in async_chainiv_schedule_work()
125 if (!ctx->queue.qlen || in async_chainiv_schedule_work()
126 test_and_set_bit(CHAINIV_STATE_INUSE, &ctx->state)) in async_chainiv_schedule_work()
130 queued = queue_work(kcrypto_wq, &ctx->postponed); in async_chainiv_schedule_work()
140 struct async_chainiv_ctx *ctx = crypto_ablkcipher_ctx(geniv); in async_chainiv_postpone_request() local
143 spin_lock_bh(&ctx->lock); in async_chainiv_postpone_request()
144 err = skcipher_enqueue_givcrypt(&ctx->queue, req); in async_chainiv_postpone_request()
145 spin_unlock_bh(&ctx->lock); in async_chainiv_postpone_request()
147 if (test_and_set_bit(CHAINIV_STATE_INUSE, &ctx->state)) in async_chainiv_postpone_request()
150 ctx->err = err; in async_chainiv_postpone_request()
151 return async_chainiv_schedule_work(ctx); in async_chainiv_postpone_request()
157 struct async_chainiv_ctx *ctx = crypto_ablkcipher_ctx(geniv); in async_chainiv_givencrypt_tail() local
161 memcpy(req->giv, ctx->iv, ivsize); in async_chainiv_givencrypt_tail()
162 memcpy(subreq->info, ctx->iv, ivsize); in async_chainiv_givencrypt_tail()
164 ctx->err = crypto_ablkcipher_encrypt(subreq); in async_chainiv_givencrypt_tail()
165 if (ctx->err) in async_chainiv_givencrypt_tail()
168 memcpy(ctx->iv, subreq->info, ivsize); in async_chainiv_givencrypt_tail()
171 return async_chainiv_schedule_work(ctx); in async_chainiv_givencrypt_tail()
177 struct async_chainiv_ctx *ctx = crypto_ablkcipher_ctx(geniv); in async_chainiv_givencrypt() local
187 if (test_and_set_bit(CHAINIV_STATE_INUSE, &ctx->state)) in async_chainiv_givencrypt()
190 if (ctx->queue.qlen) { in async_chainiv_givencrypt()
191 clear_bit(CHAINIV_STATE_INUSE, &ctx->state); in async_chainiv_givencrypt()
203 struct async_chainiv_ctx *ctx = container_of(work, in async_chainiv_do_postponed() local
211 spin_lock_bh(&ctx->lock); in async_chainiv_do_postponed()
212 req = skcipher_dequeue_givcrypt(&ctx->queue); in async_chainiv_do_postponed()
213 spin_unlock_bh(&ctx->lock); in async_chainiv_do_postponed()
216 async_chainiv_schedule_work(ctx); in async_chainiv_do_postponed()
233 struct async_chainiv_ctx *ctx = crypto_tfm_ctx(tfm); in async_chainiv_init() local
236 spin_lock_init(&ctx->lock); in async_chainiv_init()
238 crypto_init_queue(&ctx->queue, 100); in async_chainiv_init()
239 INIT_WORK(&ctx->postponed, async_chainiv_do_postponed); in async_chainiv_init()
245 iv = ctx->iv; in async_chainiv_init()
253 struct async_chainiv_ctx *ctx = crypto_tfm_ctx(tfm); in async_chainiv_exit() local
255 BUG_ON(test_bit(CHAINIV_STATE_INUSE, &ctx->state) || ctx->queue.qlen); in async_chainiv_exit()