Lines Matching refs:ctx
126 static void sec_alg_skcipher_init_template(struct sec_alg_tfm_ctx *ctx,
138 req->cipher_key_addr_lo = lower_32_bits(ctx->pkey);
139 req->cipher_key_addr_hi = upper_32_bits(ctx->pkey);
148 struct sec_alg_tfm_ctx *ctx = crypto_tfm_ctx(tfm);
150 ctx->cipher_alg = alg;
151 memcpy(ctx->key, key, keylen);
152 sec_alg_skcipher_init_template(ctx, &ctx->req_template,
153 ctx->cipher_alg);
231 struct sec_alg_tfm_ctx *ctx = crypto_skcipher_ctx(tfm);
232 struct device *dev = ctx->queue->dev_info->dev;
234 mutex_lock(&ctx->lock);
235 if (ctx->key) {
237 memset(ctx->key, 0, SEC_MAX_CIPHER_KEY);
240 ctx->key = dma_alloc_coherent(dev, SEC_MAX_CIPHER_KEY,
241 &ctx->pkey, GFP_KERNEL);
242 if (!ctx->key) {
243 mutex_unlock(&ctx->lock);
247 mutex_unlock(&ctx->lock);
430 struct sec_alg_tfm_ctx *ctx = sec_req->tfm_ctx;
432 struct device *dev = ctx->queue->dev_info->dev;
452 spin_lock_bh(&ctx->queue->queuelock);
454 switch (ctx->cipher_alg) {
484 if (ctx->queue->havesoftqueue &&
485 !kfifo_is_empty(&ctx->queue->softqueue) &&
486 sec_queue_empty(ctx->queue)) {
487 ret = kfifo_get(&ctx->queue->softqueue, &nextrequest);
494 sec_queue_send(ctx->queue, &nextrequest->req,
496 } else if (!list_empty(&ctx->backlog)) {
498 backlog_req = list_first_entry(&ctx->backlog,
501 if (sec_queue_can_enqueue(ctx->queue,
503 (ctx->queue->havesoftqueue &&
504 kfifo_avail(&ctx->queue->softqueue) >
506 sec_send_request(backlog_req, ctx->queue);
512 spin_unlock_bh(&ctx->queue->queuelock);
517 sec_alg_free_el(sec_req_el, ctx->queue->dev_info);
712 struct sec_alg_tfm_ctx *ctx = crypto_tfm_ctx(tfm);
713 struct sec_queue *queue = ctx->queue;
752 sec_req->tfm_ctx = ctx;
773 el = sec_alg_alloc_and_fill_el(&ctx->req_template,
813 !list_empty(&ctx->backlog)) {
816 list_add_tail(&sec_req->backlog_head, &ctx->backlog);
874 struct sec_alg_tfm_ctx *ctx = crypto_skcipher_ctx(tfm);
876 mutex_init(&ctx->lock);
877 INIT_LIST_HEAD(&ctx->backlog);
880 ctx->queue = sec_queue_alloc_start_safe();
881 if (IS_ERR(ctx->queue))
882 return PTR_ERR(ctx->queue);
884 spin_lock_init(&ctx->queue->queuelock);
885 ctx->queue->havesoftqueue = false;
892 struct sec_alg_tfm_ctx *ctx = crypto_skcipher_ctx(tfm);
893 struct device *dev = ctx->queue->dev_info->dev;
895 if (ctx->key) {
896 memzero_explicit(ctx->key, SEC_MAX_CIPHER_KEY);
897 dma_free_coherent(dev, SEC_MAX_CIPHER_KEY, ctx->key,
898 ctx->pkey);
900 sec_queue_stop_release(ctx->queue);
905 struct sec_alg_tfm_ctx *ctx = crypto_skcipher_ctx(tfm);
912 INIT_KFIFO(ctx->queue->softqueue);
913 ret = kfifo_alloc(&ctx->queue->softqueue, 512, GFP_KERNEL);
918 ctx->queue->havesoftqueue = true;
925 struct sec_alg_tfm_ctx *ctx = crypto_skcipher_ctx(tfm);
927 kfifo_free(&ctx->queue->softqueue);