static void cryptd_blkcipher_exit_tfm(struct crypto_tfm *tfm) { struct cryptd_blkcipher_ctx *ctx = crypto_tfm_ctx(tfm); struct cryptd_state *state = cryptd_get_state(tfm); int active; mutex_lock(&state->mutex); active = ablkcipher_tfm_in_queue(__crypto_ablkcipher_cast(tfm)); mutex_unlock(&state->mutex); BUG_ON(active); crypto_free_blkcipher(ctx->child); }
static int cryptd_blkcipher_enqueue(struct ablkcipher_request *req, crypto_completion_t complete) { struct cryptd_blkcipher_request_ctx *rctx = ablkcipher_request_ctx(req); struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(req); struct cryptd_state *state = cryptd_get_state(crypto_ablkcipher_tfm(tfm)); int err; rctx->complete = req->base.complete; req->base.complete = complete; spin_lock_bh(&state->lock); err = ablkcipher_enqueue_request(&state->queue, req); spin_unlock_bh(&state->lock); wake_up_process(state->task); return err; }