* [PATCH 1/5] crypto: simd - Remove unused crypto_simd module
2026-12-03 8:03 [PATCH 0/5] crypto: Remove crypto_simd and clean up cryptd Eric Biggers
@ 2026-12-03 8:03 ` Eric Biggers
2026-12-03 8:03 ` [PATCH 2/5] crypto: cryptd - Remove unused AEAD functions Eric Biggers
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Eric Biggers @ 2026-12-03 8:03 UTC (permalink / raw)
To: Herbert Xu, linux-crypto; +Cc: Danny Tsen, Eric Biggers
CRYPTO_SIMD is no longer selected by anything, so remove the unused
code.
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
---
crypto/Kconfig | 5 -
crypto/Makefile | 2 -
crypto/simd.c | 264 ---------------------------------
include/crypto/internal/simd.h | 9 --
4 files changed, 280 deletions(-)
delete mode 100644 crypto/simd.c
diff --git a/crypto/Kconfig b/crypto/Kconfig
index 6682ac091b387..d9f8fd521a2f1 100644
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
@@ -247,11 +247,6 @@ config CRYPTO_BENCHMARK
algorithms in the kernel. It should not be enabled in production
kernels.
-config CRYPTO_SIMD
- tristate
- select CRYPTO_AEAD
- select CRYPTO_CRYPTD
-
config CRYPTO_ENGINE
tristate
select CRYPTO_AEAD
diff --git a/crypto/Makefile b/crypto/Makefile
index 42a4a0d5a466b..872d2dac11986 100644
--- a/crypto/Makefile
+++ b/crypto/Makefile
@@ -191,8 +191,6 @@ obj-$(CONFIG_CRYPTO_ECRDSA) += ecrdsa_generic.o
#
obj-$(CONFIG_ASYNC_CORE) += async_tx/
obj-$(CONFIG_ASYMMETRIC_KEY_TYPE) += asymmetric_keys/
-crypto_simd-y := simd.o
-obj-$(CONFIG_CRYPTO_SIMD) += crypto_simd.o
#
# Key derivation function
diff --git a/crypto/simd.c b/crypto/simd.c
deleted file mode 100644
index 4e29f797709b0..0000000000000
--- a/crypto/simd.c
+++ /dev/null
@@ -1,264 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Shared crypto simd helpers
- *
- * Copyright (c) 2012 Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
- * Copyright (c) 2016 Herbert Xu <herbert@gondor.apana.org.au>
- * Copyright (c) 2019 Google LLC
- *
- * Based on aesni-intel_glue.c by:
- * Copyright (C) 2008, Intel Corp.
- * Author: Huang Ying <ying.huang@intel.com>
- */
-
-/*
- * Shared crypto SIMD helpers. These functions dynamically create and register
- * an AEAD algorithm that wraps another, internal algorithm. The wrapper
- * ensures that the internal algorithm is only executed in a context where SIMD
- * instructions are usable, i.e. where may_use_simd() returns true. If SIMD is
- * already usable, the wrapper directly calls the internal algorithm. Otherwise
- * it defers execution to a workqueue via cryptd.
- *
- * This is an alternative to the internal algorithm implementing a fallback for
- * the !may_use_simd() case itself.
- *
- * Note that the wrapper algorithm is asynchronous, i.e. it has the
- * CRYPTO_ALG_ASYNC flag set. Therefore it won't be found by users who
- * explicitly allocate a synchronous algorithm.
- */
-
-#include <crypto/cryptd.h>
-#include <crypto/internal/aead.h>
-#include <crypto/internal/simd.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/preempt.h>
-#include <asm/simd.h>
-
-struct simd_aead_alg {
- const char *ialg_name;
- struct aead_alg alg;
-};
-
-struct simd_aead_ctx {
- struct cryptd_aead *cryptd_tfm;
-};
-
-static int simd_aead_setkey(struct crypto_aead *tfm, const u8 *key,
- unsigned int key_len)
-{
- struct simd_aead_ctx *ctx = crypto_aead_ctx(tfm);
- struct crypto_aead *child = &ctx->cryptd_tfm->base;
-
- crypto_aead_clear_flags(child, CRYPTO_TFM_REQ_MASK);
- crypto_aead_set_flags(child, crypto_aead_get_flags(tfm) &
- CRYPTO_TFM_REQ_MASK);
- return crypto_aead_setkey(child, key, key_len);
-}
-
-static int simd_aead_setauthsize(struct crypto_aead *tfm, unsigned int authsize)
-{
- struct simd_aead_ctx *ctx = crypto_aead_ctx(tfm);
- struct crypto_aead *child = &ctx->cryptd_tfm->base;
-
- return crypto_aead_setauthsize(child, authsize);
-}
-
-static int simd_aead_encrypt(struct aead_request *req)
-{
- struct crypto_aead *tfm = crypto_aead_reqtfm(req);
- struct simd_aead_ctx *ctx = crypto_aead_ctx(tfm);
- struct aead_request *subreq;
- struct crypto_aead *child;
-
- subreq = aead_request_ctx(req);
- *subreq = *req;
-
- if (!crypto_simd_usable() ||
- (in_atomic() && cryptd_aead_queued(ctx->cryptd_tfm)))
- child = &ctx->cryptd_tfm->base;
- else
- child = cryptd_aead_child(ctx->cryptd_tfm);
-
- aead_request_set_tfm(subreq, child);
-
- return crypto_aead_encrypt(subreq);
-}
-
-static int simd_aead_decrypt(struct aead_request *req)
-{
- struct crypto_aead *tfm = crypto_aead_reqtfm(req);
- struct simd_aead_ctx *ctx = crypto_aead_ctx(tfm);
- struct aead_request *subreq;
- struct crypto_aead *child;
-
- subreq = aead_request_ctx(req);
- *subreq = *req;
-
- if (!crypto_simd_usable() ||
- (in_atomic() && cryptd_aead_queued(ctx->cryptd_tfm)))
- child = &ctx->cryptd_tfm->base;
- else
- child = cryptd_aead_child(ctx->cryptd_tfm);
-
- aead_request_set_tfm(subreq, child);
-
- return crypto_aead_decrypt(subreq);
-}
-
-static void simd_aead_exit(struct crypto_aead *tfm)
-{
- struct simd_aead_ctx *ctx = crypto_aead_ctx(tfm);
-
- cryptd_free_aead(ctx->cryptd_tfm);
-}
-
-static int simd_aead_init(struct crypto_aead *tfm)
-{
- struct simd_aead_ctx *ctx = crypto_aead_ctx(tfm);
- struct cryptd_aead *cryptd_tfm;
- struct simd_aead_alg *salg;
- struct aead_alg *alg;
- unsigned reqsize;
-
- alg = crypto_aead_alg(tfm);
- salg = container_of(alg, struct simd_aead_alg, alg);
-
- cryptd_tfm = cryptd_alloc_aead(salg->ialg_name, CRYPTO_ALG_INTERNAL,
- CRYPTO_ALG_INTERNAL);
- if (IS_ERR(cryptd_tfm))
- return PTR_ERR(cryptd_tfm);
-
- ctx->cryptd_tfm = cryptd_tfm;
-
- reqsize = max(crypto_aead_reqsize(cryptd_aead_child(cryptd_tfm)),
- crypto_aead_reqsize(&cryptd_tfm->base));
- reqsize += sizeof(struct aead_request);
-
- crypto_aead_set_reqsize(tfm, reqsize);
-
- return 0;
-}
-
-static struct simd_aead_alg *simd_aead_create_compat(struct aead_alg *ialg,
- const char *algname,
- const char *drvname,
- const char *basename)
-{
- struct simd_aead_alg *salg;
- struct aead_alg *alg;
- int err;
-
- salg = kzalloc_obj(*salg);
- if (!salg) {
- salg = ERR_PTR(-ENOMEM);
- goto out;
- }
-
- salg->ialg_name = basename;
- alg = &salg->alg;
-
- err = -ENAMETOOLONG;
- if (snprintf(alg->base.cra_name, CRYPTO_MAX_ALG_NAME, "%s", algname) >=
- CRYPTO_MAX_ALG_NAME)
- goto out_free_salg;
-
- if (snprintf(alg->base.cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s",
- drvname) >= CRYPTO_MAX_ALG_NAME)
- goto out_free_salg;
-
- alg->base.cra_flags = CRYPTO_ALG_ASYNC |
- (ialg->base.cra_flags & CRYPTO_ALG_INHERITED_FLAGS);
- alg->base.cra_priority = ialg->base.cra_priority;
- alg->base.cra_blocksize = ialg->base.cra_blocksize;
- alg->base.cra_alignmask = ialg->base.cra_alignmask;
- alg->base.cra_module = ialg->base.cra_module;
- alg->base.cra_ctxsize = sizeof(struct simd_aead_ctx);
-
- alg->ivsize = ialg->ivsize;
- alg->maxauthsize = ialg->maxauthsize;
- alg->chunksize = ialg->chunksize;
-
- alg->init = simd_aead_init;
- alg->exit = simd_aead_exit;
-
- alg->setkey = simd_aead_setkey;
- alg->setauthsize = simd_aead_setauthsize;
- alg->encrypt = simd_aead_encrypt;
- alg->decrypt = simd_aead_decrypt;
-
- err = crypto_register_aead(alg);
- if (err)
- goto out_free_salg;
-
-out:
- return salg;
-
-out_free_salg:
- kfree(salg);
- salg = ERR_PTR(err);
- goto out;
-}
-
-static void simd_aead_free(struct simd_aead_alg *salg)
-{
- crypto_unregister_aead(&salg->alg);
- kfree(salg);
-}
-
-int simd_register_aeads_compat(struct aead_alg *algs, int count,
- struct simd_aead_alg **simd_algs)
-{
- int err;
- int i;
- const char *algname;
- const char *drvname;
- const char *basename;
- struct simd_aead_alg *simd;
-
- for (i = 0; i < count; i++) {
- if (WARN_ON(strncmp(algs[i].base.cra_name, "__", 2) ||
- strncmp(algs[i].base.cra_driver_name, "__", 2)))
- return -EINVAL;
- }
-
- err = crypto_register_aeads(algs, count);
- if (err)
- return err;
-
- for (i = 0; i < count; i++) {
- algname = algs[i].base.cra_name + 2;
- drvname = algs[i].base.cra_driver_name + 2;
- basename = algs[i].base.cra_driver_name;
- simd = simd_aead_create_compat(algs + i, algname, drvname, basename);
- err = PTR_ERR(simd);
- if (IS_ERR(simd))
- goto err_unregister;
- simd_algs[i] = simd;
- }
- return 0;
-
-err_unregister:
- simd_unregister_aeads(algs, count, simd_algs);
- return err;
-}
-EXPORT_SYMBOL_GPL(simd_register_aeads_compat);
-
-void simd_unregister_aeads(struct aead_alg *algs, int count,
- struct simd_aead_alg **simd_algs)
-{
- int i;
-
- crypto_unregister_aeads(algs, count);
-
- for (i = 0; i < count; i++) {
- if (simd_algs[i]) {
- simd_aead_free(simd_algs[i]);
- simd_algs[i] = NULL;
- }
- }
-}
-EXPORT_SYMBOL_GPL(simd_unregister_aeads);
-
-MODULE_DESCRIPTION("Shared crypto SIMD helpers");
-MODULE_LICENSE("GPL");
diff --git a/include/crypto/internal/simd.h b/include/crypto/internal/simd.h
index f5e5d7b639519..d9e6289adc867 100644
--- a/include/crypto/internal/simd.h
+++ b/include/crypto/internal/simd.h
@@ -10,15 +10,6 @@
#include <linux/percpu.h>
#include <linux/types.h>
-struct simd_aead_alg;
-struct aead_alg;
-
-int simd_register_aeads_compat(struct aead_alg *algs, int count,
- struct simd_aead_alg **simd_algs);
-
-void simd_unregister_aeads(struct aead_alg *algs, int count,
- struct simd_aead_alg **simd_algs);
-
/*
* crypto_simd_usable() - is it allowed at this time to use SIMD instructions or
* access the SIMD register file?
--
2.56.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 2/5] crypto: cryptd - Remove unused AEAD functions
2026-12-03 8:03 [PATCH 0/5] crypto: Remove crypto_simd and clean up cryptd Eric Biggers
2026-12-03 8:03 ` [PATCH 1/5] crypto: simd - Remove unused crypto_simd module Eric Biggers
@ 2026-12-03 8:03 ` Eric Biggers
2026-12-03 8:03 ` [PATCH 3/5] crypto: cryptd - Remove pointless reference count Eric Biggers
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Eric Biggers @ 2026-12-03 8:03 UTC (permalink / raw)
To: Herbert Xu, linux-crypto; +Cc: Danny Tsen, Eric Biggers
Remove functions that were used only by the now-removed crypto_simd
module.
This eliminates the need for <crypto/cryptd.h>, so delete that too.
(Delete the includes of it from the marvell drivers, which weren't
necessary anyway.)
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
---
crypto/cryptd.c | 51 -------------------
.../crypto/marvell/octeontx/otx_cptvf_algs.c | 1 -
.../marvell/octeontx2/otx2_cptvf_algs.c | 1 -
include/crypto/cryptd.h | 39 --------------
4 files changed, 92 deletions(-)
delete mode 100644 include/crypto/cryptd.h
diff --git a/crypto/cryptd.c b/crypto/cryptd.c
index d8dbf07ab4269..9c6a7c14f0e43 100644
--- a/crypto/cryptd.c
+++ b/crypto/cryptd.c
@@ -15,7 +15,6 @@
#include <crypto/internal/hash.h>
#include <crypto/internal/aead.h>
#include <crypto/internal/skcipher.h>
-#include <crypto/cryptd.h>
#include <linux/refcount.h>
#include <linux/err.h>
#include <linux/init.h>
@@ -937,56 +936,6 @@ static struct crypto_template cryptd_tmpl = {
.module = THIS_MODULE,
};
-struct cryptd_aead *cryptd_alloc_aead(const char *alg_name,
- u32 type, u32 mask)
-{
- char cryptd_alg_name[CRYPTO_MAX_ALG_NAME];
- struct cryptd_aead_ctx *ctx;
- struct crypto_aead *tfm;
-
- if (snprintf(cryptd_alg_name, CRYPTO_MAX_ALG_NAME,
- "cryptd(%s)", alg_name) >= CRYPTO_MAX_ALG_NAME)
- return ERR_PTR(-EINVAL);
- tfm = crypto_alloc_aead(cryptd_alg_name, type, mask);
- if (IS_ERR(tfm))
- return ERR_CAST(tfm);
- if (tfm->base.__crt_alg->cra_module != THIS_MODULE) {
- crypto_free_aead(tfm);
- return ERR_PTR(-EINVAL);
- }
-
- ctx = crypto_aead_ctx(tfm);
- refcount_set(&ctx->refcnt, 1);
-
- return __cryptd_aead_cast(tfm);
-}
-EXPORT_SYMBOL_GPL(cryptd_alloc_aead);
-
-struct crypto_aead *cryptd_aead_child(struct cryptd_aead *tfm)
-{
- struct cryptd_aead_ctx *ctx;
- ctx = crypto_aead_ctx(&tfm->base);
- return ctx->child;
-}
-EXPORT_SYMBOL_GPL(cryptd_aead_child);
-
-bool cryptd_aead_queued(struct cryptd_aead *tfm)
-{
- struct cryptd_aead_ctx *ctx = crypto_aead_ctx(&tfm->base);
-
- return refcount_read(&ctx->refcnt) - 1;
-}
-EXPORT_SYMBOL_GPL(cryptd_aead_queued);
-
-void cryptd_free_aead(struct cryptd_aead *tfm)
-{
- struct cryptd_aead_ctx *ctx = crypto_aead_ctx(&tfm->base);
-
- if (refcount_dec_and_test(&ctx->refcnt))
- crypto_free_aead(&tfm->base);
-}
-EXPORT_SYMBOL_GPL(cryptd_free_aead);
-
static int __init cryptd_init(void)
{
int err;
diff --git a/drivers/crypto/marvell/octeontx/otx_cptvf_algs.c b/drivers/crypto/marvell/octeontx/otx_cptvf_algs.c
index 2f088afc536df..3a8e0b5b058d0 100644
--- a/drivers/crypto/marvell/octeontx/otx_cptvf_algs.c
+++ b/drivers/crypto/marvell/octeontx/otx_cptvf_algs.c
@@ -10,7 +10,6 @@
#include <crypto/aes.h>
#include <crypto/authenc.h>
-#include <crypto/cryptd.h>
#include <crypto/des.h>
#include <crypto/internal/aead.h>
#include <crypto/sha1.h>
diff --git a/drivers/crypto/marvell/octeontx2/otx2_cptvf_algs.c b/drivers/crypto/marvell/octeontx2/otx2_cptvf_algs.c
index 8d74e0274fdf8..13aebe0dbe73c 100644
--- a/drivers/crypto/marvell/octeontx2/otx2_cptvf_algs.c
+++ b/drivers/crypto/marvell/octeontx2/otx2_cptvf_algs.c
@@ -3,7 +3,6 @@
#include <crypto/aes.h>
#include <crypto/authenc.h>
-#include <crypto/cryptd.h>
#include <crypto/des.h>
#include <crypto/internal/aead.h>
#include <crypto/sha1.h>
diff --git a/include/crypto/cryptd.h b/include/crypto/cryptd.h
deleted file mode 100644
index 29c5878a3609c..0000000000000
--- a/include/crypto/cryptd.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Software async crypto daemon
- *
- * Added AEAD support to cryptd.
- * Authors: Tadeusz Struk (tadeusz.struk@intel.com)
- * Adrian Hoban <adrian.hoban@intel.com>
- * Gabriele Paoloni <gabriele.paoloni@intel.com>
- * Aidan O'Mahony (aidan.o.mahony@intel.com)
- * Copyright (c) 2010, Intel Corporation.
- */
-
-#ifndef _CRYPTO_CRYPT_H
-#define _CRYPTO_CRYPT_H
-
-#include <linux/types.h>
-
-#include <crypto/aead.h>
-
-struct cryptd_aead {
- struct crypto_aead base;
-};
-
-static inline struct cryptd_aead *__cryptd_aead_cast(
- struct crypto_aead *tfm)
-{
- return (struct cryptd_aead *)tfm;
-}
-
-struct cryptd_aead *cryptd_alloc_aead(const char *alg_name,
- u32 type, u32 mask);
-
-struct crypto_aead *cryptd_aead_child(struct cryptd_aead *tfm);
-/* Must be called without moving CPUs. */
-bool cryptd_aead_queued(struct cryptd_aead *tfm);
-
-void cryptd_free_aead(struct cryptd_aead *tfm);
-
-#endif
--
2.56.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 3/5] crypto: cryptd - Remove pointless reference count
2026-12-03 8:03 [PATCH 0/5] crypto: Remove crypto_simd and clean up cryptd Eric Biggers
2026-12-03 8:03 ` [PATCH 1/5] crypto: simd - Remove unused crypto_simd module Eric Biggers
2026-12-03 8:03 ` [PATCH 2/5] crypto: cryptd - Remove unused AEAD functions Eric Biggers
@ 2026-12-03 8:03 ` Eric Biggers
2026-12-03 8:03 ` [PATCH 4/5] crypto: cryptd - Remove unused CRYPTO_ALG_INTERNAL support Eric Biggers
2026-12-03 8:03 ` [PATCH 5/5] crypto: cryptd - Remove pointless per-instance queue pointer Eric Biggers
4 siblings, 0 replies; 6+ messages in thread
From: Eric Biggers @ 2026-12-03 8:03 UTC (permalink / raw)
To: Herbert Xu, linux-crypto; +Cc: Danny Tsen, Eric Biggers
The per-tfm refcnt in cryptd was originally added to allow crypto_simd
(originally ablk_helper) to check whether a cryptd tfm had any requests
queued so that synchronous softirq execution wouldn't reorder ahead of
queued requests. To support this, cryptd_alloc_*() initialized refcnt
to 1, cryptd_enqueue_request() incremented it, request completion
decremented it, and cryptd_free_*() dropped the initial reference so the
tfm would be freed once all queued requests completed.
However, with the last remaining cryptd_{alloc,queued,free}_*() helpers
now removed, refcnt is never initialized to a non-zero value, and all of
the refcnt handling is dead code. Remove it.
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
---
crypto/cryptd.c | 43 +++++--------------------------------------
1 file changed, 5 insertions(+), 38 deletions(-)
diff --git a/crypto/cryptd.c b/crypto/cryptd.c
index 9c6a7c14f0e43..29dde50f93603 100644
--- a/crypto/cryptd.c
+++ b/crypto/cryptd.c
@@ -15,7 +15,6 @@
#include <crypto/internal/hash.h>
#include <crypto/internal/aead.h>
#include <crypto/internal/skcipher.h>
-#include <linux/refcount.h>
#include <linux/err.h>
#include <linux/init.h>
#include <linux/kernel.h>
@@ -67,7 +66,6 @@ struct aead_instance_ctx {
};
struct cryptd_skcipher_ctx {
- refcount_t refcnt;
struct crypto_skcipher *child;
};
@@ -76,7 +74,6 @@ struct cryptd_skcipher_request_ctx {
};
struct cryptd_hash_ctx {
- refcount_t refcnt;
struct crypto_shash *child;
};
@@ -87,7 +84,6 @@ struct cryptd_hash_request_ctx {
};
struct cryptd_aead_ctx {
- refcount_t refcnt;
struct crypto_aead *child;
};
@@ -133,26 +129,15 @@ static int cryptd_enqueue_request(struct cryptd_queue *queue,
{
int err;
struct cryptd_cpu_queue *cpu_queue;
- refcount_t *refcnt;
local_bh_disable();
local_lock_nested_bh(&queue->cpu_queue->bh_lock);
cpu_queue = this_cpu_ptr(queue->cpu_queue);
err = crypto_enqueue_request(&cpu_queue->queue, request);
- refcnt = crypto_tfm_ctx(request->tfm);
+ if (err != -ENOSPC)
+ queue_work_on(smp_processor_id(), cryptd_wq, &cpu_queue->work);
- if (err == -ENOSPC)
- goto out;
-
- queue_work_on(smp_processor_id(), cryptd_wq, &cpu_queue->work);
-
- if (!refcount_read(refcnt))
- goto out;
-
- refcount_inc(refcnt);
-
-out:
local_unlock_nested_bh(&queue->cpu_queue->bh_lock);
local_bh_enable();
@@ -272,10 +257,7 @@ static void cryptd_skcipher_complete(struct skcipher_request *req, int err,
crypto_completion_t complete)
{
struct cryptd_skcipher_request_ctx *rctx = skcipher_request_ctx(req);
- struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
- struct cryptd_skcipher_ctx *ctx = crypto_skcipher_ctx(tfm);
struct skcipher_request *subreq = &rctx->req;
- int refcnt = refcount_read(&ctx->refcnt);
local_bh_disable();
skcipher_request_complete(req, err);
@@ -286,8 +268,7 @@ static void cryptd_skcipher_complete(struct skcipher_request *req, int err,
subreq->base.data = req->base.data;
req->base.complete = complete;
req->base.data = req;
- } else if (refcnt && refcount_dec_and_test(&ctx->refcnt))
- crypto_free_skcipher(tfm);
+ }
}
static void cryptd_skcipher_encrypt(void *data, int err)
@@ -503,10 +484,6 @@ static struct shash_desc *cryptd_hash_prepare(struct ahash_request *req,
static void cryptd_hash_complete(struct ahash_request *req, int err,
crypto_completion_t complete)
{
- struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
- struct cryptd_hash_ctx *ctx = crypto_ahash_ctx(tfm);
- int refcnt = refcount_read(&ctx->refcnt);
-
local_bh_disable();
ahash_request_complete(req, err);
local_bh_enable();
@@ -514,8 +491,7 @@ static void cryptd_hash_complete(struct ahash_request *req, int err,
if (err == -EINPROGRESS) {
req->base.complete = complete;
req->base.data = req;
- } else if (refcnt && refcount_dec_and_test(&ctx->refcnt))
- crypto_free_ahash(tfm);
+ }
}
static void cryptd_hash_init(void *data, int err)
@@ -731,17 +707,12 @@ static void cryptd_aead_crypt(struct aead_request *req,
{
struct cryptd_aead_request_ctx *rctx;
struct aead_request *subreq;
- struct cryptd_aead_ctx *ctx;
- struct crypto_aead *tfm;
- int refcnt;
rctx = aead_request_ctx(req);
subreq = &rctx->req;
req->base.complete = subreq->base.complete;
req->base.data = subreq->base.data;
- tfm = crypto_aead_reqtfm(req);
-
if (unlikely(err == -EINPROGRESS))
goto out;
@@ -755,9 +726,6 @@ static void cryptd_aead_crypt(struct aead_request *req,
err = crypt(subreq);
out:
- ctx = crypto_aead_ctx(tfm);
- refcnt = refcount_read(&ctx->refcnt);
-
local_bh_disable();
aead_request_complete(req, err);
local_bh_enable();
@@ -767,8 +735,7 @@ static void cryptd_aead_crypt(struct aead_request *req,
subreq->base.data = req->base.data;
req->base.complete = compl;
req->base.data = req;
- } else if (refcnt && refcount_dec_and_test(&ctx->refcnt))
- crypto_free_aead(tfm);
+ }
}
static void cryptd_aead_encrypt(void *data, int err)
--
2.56.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 4/5] crypto: cryptd - Remove unused CRYPTO_ALG_INTERNAL support
2026-12-03 8:03 [PATCH 0/5] crypto: Remove crypto_simd and clean up cryptd Eric Biggers
` (2 preceding siblings ...)
2026-12-03 8:03 ` [PATCH 3/5] crypto: cryptd - Remove pointless reference count Eric Biggers
@ 2026-12-03 8:03 ` Eric Biggers
2026-12-03 8:03 ` [PATCH 5/5] crypto: cryptd - Remove pointless per-instance queue pointer Eric Biggers
4 siblings, 0 replies; 6+ messages in thread
From: Eric Biggers @ 2026-12-03 8:03 UTC (permalink / raw)
To: Herbert Xu, linux-crypto; +Cc: Danny Tsen, Eric Biggers
cryptd's support for wrapping CRYPTO_ALG_INTERNAL algorithms existed
only for crypto_simd, which registered CRYPTO_ALG_INTERNAL algorithms
and wrapped them via cryptd_alloc_*().
However, with crypto_simd and the cryptd_alloc_*() helpers now removed,
nothing uses cryptd to wrap CRYPTO_ALG_INTERNAL algorithms anymore.
Therefore, remove the CRYPTO_ALG_INTERNAL handling.
This makes cryptd behave like all the other crypto templates and reject
CRYPTO_ALG_INTERNAL algorithms.
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
---
crypto/cryptd.c | 44 +++++++++++---------------------------------
1 file changed, 11 insertions(+), 33 deletions(-)
diff --git a/crypto/cryptd.c b/crypto/cryptd.c
index 29dde50f93603..7e871715117aa 100644
--- a/crypto/cryptd.c
+++ b/crypto/cryptd.c
@@ -181,20 +181,10 @@ static inline struct cryptd_queue *cryptd_get_queue(struct crypto_tfm *tfm)
return ictx->queue;
}
-static void cryptd_type_and_mask(struct crypto_attr_type *algt,
- u32 *type, u32 *mask)
+static u32 cryptd_mask(struct crypto_attr_type *algt)
{
- /*
- * cryptd is allowed to wrap internal algorithms, but in that case the
- * resulting cryptd instance will be marked as internal as well.
- */
- *type = algt->type & CRYPTO_ALG_INTERNAL;
- *mask = algt->mask & CRYPTO_ALG_INTERNAL;
-
/* No point in cryptd wrapping an algorithm that's already async. */
- *mask |= CRYPTO_ALG_ASYNC;
-
- *mask |= crypto_algt_inherited_mask(algt);
+ return crypto_algt_inherited_mask(algt) | CRYPTO_ALG_ASYNC;
}
static int cryptd_init_instance(struct crypto_instance *inst,
@@ -364,12 +354,9 @@ static int cryptd_create_skcipher(struct crypto_template *tmpl,
struct skcipherd_instance_ctx *ctx;
struct skcipher_instance *inst;
struct skcipher_alg_common *alg;
- u32 type;
- u32 mask;
+ u32 mask = cryptd_mask(algt);
int err;
- cryptd_type_and_mask(algt, &type, &mask);
-
inst = kzalloc(sizeof(*inst) + sizeof(*ctx), GFP_KERNEL);
if (!inst)
return -ENOMEM;
@@ -378,7 +365,7 @@ static int cryptd_create_skcipher(struct crypto_template *tmpl,
ctx->queue = queue;
err = crypto_grab_skcipher(&ctx->spawn, skcipher_crypto_instance(inst),
- crypto_attr_alg_name(tb[1]), type, mask);
+ crypto_attr_alg_name(tb[1]), 0, mask);
if (err)
goto err_free_inst;
@@ -387,8 +374,7 @@ static int cryptd_create_skcipher(struct crypto_template *tmpl,
if (err)
goto err_free_inst;
- inst->alg.base.cra_flags |= CRYPTO_ALG_ASYNC |
- (alg->base.cra_flags & CRYPTO_ALG_INTERNAL);
+ inst->alg.base.cra_flags |= CRYPTO_ALG_ASYNC;
inst->alg.ivsize = alg->ivsize;
inst->alg.chunksize = alg->chunksize;
inst->alg.min_keysize = alg->min_keysize;
@@ -629,12 +615,9 @@ static int cryptd_create_hash(struct crypto_template *tmpl, struct rtattr **tb,
struct hashd_instance_ctx *ctx;
struct ahash_instance *inst;
struct shash_alg *alg;
- u32 type;
- u32 mask;
+ u32 mask = cryptd_mask(algt);
int err;
- cryptd_type_and_mask(algt, &type, &mask);
-
inst = kzalloc(sizeof(*inst) + sizeof(*ctx), GFP_KERNEL);
if (!inst)
return -ENOMEM;
@@ -643,7 +626,7 @@ static int cryptd_create_hash(struct crypto_template *tmpl, struct rtattr **tb,
ctx->queue = queue;
err = crypto_grab_shash(&ctx->spawn, ahash_crypto_instance(inst),
- crypto_attr_alg_name(tb[1]), type, mask);
+ crypto_attr_alg_name(tb[1]), 0, mask);
if (err)
goto err_free_inst;
alg = crypto_spawn_shash_alg(&ctx->spawn);
@@ -653,8 +636,7 @@ static int cryptd_create_hash(struct crypto_template *tmpl, struct rtattr **tb,
goto err_free_inst;
inst->alg.halg.base.cra_flags |= CRYPTO_ALG_ASYNC |
- (alg->base.cra_flags & (CRYPTO_ALG_INTERNAL|
- CRYPTO_ALG_OPTIONAL_KEY));
+ (alg->base.cra_flags & CRYPTO_ALG_OPTIONAL_KEY);
inst->alg.halg.digestsize = alg->digestsize;
inst->alg.halg.statesize = alg->statesize;
inst->alg.halg.base.cra_ctxsize = sizeof(struct cryptd_hash_ctx);
@@ -828,12 +810,9 @@ static int cryptd_create_aead(struct crypto_template *tmpl,
struct aead_instance_ctx *ctx;
struct aead_instance *inst;
struct aead_alg *alg;
- u32 type;
- u32 mask;
+ u32 mask = cryptd_mask(algt);
int err;
- cryptd_type_and_mask(algt, &type, &mask);
-
inst = kzalloc(sizeof(*inst) + sizeof(*ctx), GFP_KERNEL);
if (!inst)
return -ENOMEM;
@@ -842,7 +821,7 @@ static int cryptd_create_aead(struct crypto_template *tmpl,
ctx->queue = queue;
err = crypto_grab_aead(&ctx->aead_spawn, aead_crypto_instance(inst),
- crypto_attr_alg_name(tb[1]), type, mask);
+ crypto_attr_alg_name(tb[1]), 0, mask);
if (err)
goto err_free_inst;
@@ -851,8 +830,7 @@ static int cryptd_create_aead(struct crypto_template *tmpl,
if (err)
goto err_free_inst;
- inst->alg.base.cra_flags |= CRYPTO_ALG_ASYNC |
- (alg->base.cra_flags & CRYPTO_ALG_INTERNAL);
+ inst->alg.base.cra_flags |= CRYPTO_ALG_ASYNC;
inst->alg.base.cra_ctxsize = sizeof(struct cryptd_aead_ctx);
inst->alg.ivsize = crypto_aead_alg_ivsize(alg);
--
2.56.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 5/5] crypto: cryptd - Remove pointless per-instance queue pointer
2026-12-03 8:03 [PATCH 0/5] crypto: Remove crypto_simd and clean up cryptd Eric Biggers
` (3 preceding siblings ...)
2026-12-03 8:03 ` [PATCH 4/5] crypto: cryptd - Remove unused CRYPTO_ALG_INTERNAL support Eric Biggers
@ 2026-12-03 8:03 ` Eric Biggers
4 siblings, 0 replies; 6+ messages in thread
From: Eric Biggers @ 2026-12-03 8:03 UTC (permalink / raw)
To: Herbert Xu, linux-crypto; +Cc: Danny Tsen, Eric Biggers
cryptd only has a single global per-CPU queue.
There's no need to wrap it in struct cryptd_queue, pass it into every
cryptd_create_*() function, store a pointer to it in every instance
context, and type-pun the instance context via struct
cryptd_instance_ctx in cryptd_get_queue() just to retrieve the same
global queue back out. It's already available as a static variable.
Just use the global per-CPU queue directly instead.
That makes the *_instance_ctx wrapper structs no longer necessary. So
remove those too and just use the spawn structs directly, like various
other templates already do.
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
---
crypto/cryptd.c | 156 ++++++++++++++++--------------------------------
1 file changed, 50 insertions(+), 106 deletions(-)
diff --git a/crypto/cryptd.c b/crypto/cryptd.c
index 7e871715117aa..3649a7750c65b 100644
--- a/crypto/cryptd.c
+++ b/crypto/cryptd.c
@@ -37,33 +37,11 @@ struct cryptd_cpu_queue {
struct work_struct work;
};
-struct cryptd_queue {
- /*
- * Protected by disabling BH to allow enqueueing from softinterrupt and
- * dequeuing from kworker (cryptd_queue_worker()).
- */
- struct cryptd_cpu_queue __percpu *cpu_queue;
-};
-
-struct cryptd_instance_ctx {
- struct crypto_spawn spawn;
- struct cryptd_queue *queue;
-};
-
-struct skcipherd_instance_ctx {
- struct crypto_skcipher_spawn spawn;
- struct cryptd_queue *queue;
-};
-
-struct hashd_instance_ctx {
- struct crypto_shash_spawn spawn;
- struct cryptd_queue *queue;
-};
-
-struct aead_instance_ctx {
- struct crypto_aead_spawn aead_spawn;
- struct cryptd_queue *queue;
-};
+/*
+ * Protected by disabling BH to allow enqueueing from softinterrupt and
+ * dequeuing from kworker (cryptd_queue_worker()).
+ */
+static struct cryptd_cpu_queue __percpu *cryptd_queues;
struct cryptd_skcipher_ctx {
struct crypto_skcipher *child;
@@ -93,17 +71,16 @@ struct cryptd_aead_request_ctx {
static void cryptd_queue_worker(struct work_struct *work);
-static int cryptd_init_queue(struct cryptd_queue *queue,
- unsigned int max_cpu_qlen)
+static int cryptd_init_queue(unsigned int max_cpu_qlen)
{
int cpu;
struct cryptd_cpu_queue *cpu_queue;
- queue->cpu_queue = alloc_percpu(struct cryptd_cpu_queue);
- if (!queue->cpu_queue)
+ cryptd_queues = alloc_percpu(struct cryptd_cpu_queue);
+ if (!cryptd_queues)
return -ENOMEM;
for_each_possible_cpu(cpu) {
- cpu_queue = per_cpu_ptr(queue->cpu_queue, cpu);
+ cpu_queue = per_cpu_ptr(cryptd_queues, cpu);
crypto_init_queue(&cpu_queue->queue, max_cpu_qlen);
INIT_WORK(&cpu_queue->work, cryptd_queue_worker);
local_lock_init(&cpu_queue->bh_lock);
@@ -112,33 +89,32 @@ static int cryptd_init_queue(struct cryptd_queue *queue,
return 0;
}
-static void cryptd_fini_queue(struct cryptd_queue *queue)
+static void cryptd_fini_queue(void)
{
int cpu;
struct cryptd_cpu_queue *cpu_queue;
for_each_possible_cpu(cpu) {
- cpu_queue = per_cpu_ptr(queue->cpu_queue, cpu);
+ cpu_queue = per_cpu_ptr(cryptd_queues, cpu);
BUG_ON(cpu_queue->queue.qlen);
}
- free_percpu(queue->cpu_queue);
+ free_percpu(cryptd_queues);
}
-static int cryptd_enqueue_request(struct cryptd_queue *queue,
- struct crypto_async_request *request)
+static int cryptd_enqueue_request(struct crypto_async_request *request)
{
int err;
struct cryptd_cpu_queue *cpu_queue;
local_bh_disable();
- local_lock_nested_bh(&queue->cpu_queue->bh_lock);
- cpu_queue = this_cpu_ptr(queue->cpu_queue);
+ local_lock_nested_bh(&cryptd_queues->bh_lock);
+ cpu_queue = this_cpu_ptr(cryptd_queues);
err = crypto_enqueue_request(&cpu_queue->queue, request);
if (err != -ENOSPC)
queue_work_on(smp_processor_id(), cryptd_wq, &cpu_queue->work);
- local_unlock_nested_bh(&queue->cpu_queue->bh_lock);
+ local_unlock_nested_bh(&cryptd_queues->bh_lock);
local_bh_enable();
return err;
@@ -174,13 +150,6 @@ static void cryptd_queue_worker(struct work_struct *work)
queue_work(cryptd_wq, &cpu_queue->work);
}
-static inline struct cryptd_queue *cryptd_get_queue(struct crypto_tfm *tfm)
-{
- struct crypto_instance *inst = crypto_tfm_alg_instance(tfm);
- struct cryptd_instance_ctx *ictx = crypto_instance_ctx(inst);
- return ictx->queue;
-}
-
static u32 cryptd_mask(struct crypto_attr_type *algt)
{
/* No point in cryptd wrapping an algorithm that's already async. */
@@ -289,17 +258,14 @@ static int cryptd_skcipher_enqueue(struct skcipher_request *req,
crypto_completion_t compl)
{
struct cryptd_skcipher_request_ctx *rctx = skcipher_request_ctx(req);
- struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
struct skcipher_request *subreq = &rctx->req;
- struct cryptd_queue *queue;
- queue = cryptd_get_queue(crypto_skcipher_tfm(tfm));
subreq->base.complete = req->base.complete;
subreq->base.data = req->base.data;
req->base.complete = compl;
req->base.data = req;
- return cryptd_enqueue_request(queue, &req->base);
+ return cryptd_enqueue_request(&req->base);
}
static int cryptd_skcipher_encrypt_enqueue(struct skcipher_request *req)
@@ -315,8 +281,7 @@ static int cryptd_skcipher_decrypt_enqueue(struct skcipher_request *req)
static int cryptd_skcipher_init_tfm(struct crypto_skcipher *tfm)
{
struct skcipher_instance *inst = skcipher_alg_instance(tfm);
- struct skcipherd_instance_ctx *ictx = skcipher_instance_ctx(inst);
- struct crypto_skcipher_spawn *spawn = &ictx->spawn;
+ struct crypto_skcipher_spawn *spawn = skcipher_instance_ctx(inst);
struct cryptd_skcipher_ctx *ctx = crypto_skcipher_ctx(tfm);
struct crypto_skcipher *cipher;
@@ -340,36 +305,32 @@ static void cryptd_skcipher_exit_tfm(struct crypto_skcipher *tfm)
static void cryptd_skcipher_free(struct skcipher_instance *inst)
{
- struct skcipherd_instance_ctx *ctx = skcipher_instance_ctx(inst);
-
- crypto_drop_skcipher(&ctx->spawn);
+ crypto_drop_skcipher(skcipher_instance_ctx(inst));
kfree(inst);
}
static int cryptd_create_skcipher(struct crypto_template *tmpl,
struct rtattr **tb,
- struct crypto_attr_type *algt,
- struct cryptd_queue *queue)
+ struct crypto_attr_type *algt)
{
- struct skcipherd_instance_ctx *ctx;
+ struct crypto_skcipher_spawn *spawn;
struct skcipher_instance *inst;
struct skcipher_alg_common *alg;
u32 mask = cryptd_mask(algt);
int err;
- inst = kzalloc(sizeof(*inst) + sizeof(*ctx), GFP_KERNEL);
+ inst = kzalloc(sizeof(*inst) + sizeof(*spawn), GFP_KERNEL);
if (!inst)
return -ENOMEM;
- ctx = skcipher_instance_ctx(inst);
- ctx->queue = queue;
+ spawn = skcipher_instance_ctx(inst);
- err = crypto_grab_skcipher(&ctx->spawn, skcipher_crypto_instance(inst),
+ err = crypto_grab_skcipher(spawn, skcipher_crypto_instance(inst),
crypto_attr_alg_name(tb[1]), 0, mask);
if (err)
goto err_free_inst;
- alg = crypto_spawn_skcipher_alg_common(&ctx->spawn);
+ alg = crypto_spawn_skcipher_alg_common(spawn);
err = cryptd_init_instance(skcipher_crypto_instance(inst), &alg->base);
if (err)
goto err_free_inst;
@@ -402,8 +363,7 @@ static int cryptd_create_skcipher(struct crypto_template *tmpl,
static int cryptd_hash_init_tfm(struct crypto_ahash *tfm)
{
struct ahash_instance *inst = ahash_alg_instance(tfm);
- struct hashd_instance_ctx *ictx = ahash_instance_ctx(inst);
- struct crypto_shash_spawn *spawn = &ictx->spawn;
+ struct crypto_shash_spawn *spawn = ahash_instance_ctx(inst);
struct cryptd_hash_ctx *ctx = crypto_ahash_ctx(tfm);
struct crypto_shash *hash;
@@ -441,16 +401,13 @@ static int cryptd_hash_enqueue(struct ahash_request *req,
crypto_completion_t compl)
{
struct cryptd_hash_request_ctx *rctx = ahash_request_ctx(req);
- struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
- struct cryptd_queue *queue =
- cryptd_get_queue(crypto_ahash_tfm(tfm));
rctx->complete = req->base.complete;
rctx->data = req->base.data;
req->base.complete = compl;
req->base.data = req;
- return cryptd_enqueue_request(queue, &req->base);
+ return cryptd_enqueue_request(&req->base);
}
static struct shash_desc *cryptd_hash_prepare(struct ahash_request *req,
@@ -602,34 +559,30 @@ static int cryptd_hash_import(struct ahash_request *req, const void *in)
static void cryptd_hash_free(struct ahash_instance *inst)
{
- struct hashd_instance_ctx *ctx = ahash_instance_ctx(inst);
-
- crypto_drop_shash(&ctx->spawn);
+ crypto_drop_shash(ahash_instance_ctx(inst));
kfree(inst);
}
static int cryptd_create_hash(struct crypto_template *tmpl, struct rtattr **tb,
- struct crypto_attr_type *algt,
- struct cryptd_queue *queue)
+ struct crypto_attr_type *algt)
{
- struct hashd_instance_ctx *ctx;
+ struct crypto_shash_spawn *spawn;
struct ahash_instance *inst;
struct shash_alg *alg;
u32 mask = cryptd_mask(algt);
int err;
- inst = kzalloc(sizeof(*inst) + sizeof(*ctx), GFP_KERNEL);
+ inst = kzalloc(sizeof(*inst) + sizeof(*spawn), GFP_KERNEL);
if (!inst)
return -ENOMEM;
- ctx = ahash_instance_ctx(inst);
- ctx->queue = queue;
+ spawn = ahash_instance_ctx(inst);
- err = crypto_grab_shash(&ctx->spawn, ahash_crypto_instance(inst),
+ err = crypto_grab_shash(spawn, ahash_crypto_instance(inst),
crypto_attr_alg_name(tb[1]), 0, mask);
if (err)
goto err_free_inst;
- alg = crypto_spawn_shash_alg(&ctx->spawn);
+ alg = crypto_spawn_shash_alg(spawn);
err = cryptd_init_instance(ahash_crypto_instance(inst), &alg->base);
if (err)
@@ -748,15 +701,13 @@ static int cryptd_aead_enqueue(struct aead_request *req,
crypto_completion_t compl)
{
struct cryptd_aead_request_ctx *rctx = aead_request_ctx(req);
- struct crypto_aead *tfm = crypto_aead_reqtfm(req);
- struct cryptd_queue *queue = cryptd_get_queue(crypto_aead_tfm(tfm));
struct aead_request *subreq = &rctx->req;
subreq->base.complete = req->base.complete;
subreq->base.data = req->base.data;
req->base.complete = compl;
req->base.data = req;
- return cryptd_enqueue_request(queue, &req->base);
+ return cryptd_enqueue_request(&req->base);
}
static int cryptd_aead_encrypt_enqueue(struct aead_request *req)
@@ -772,8 +723,7 @@ static int cryptd_aead_decrypt_enqueue(struct aead_request *req)
static int cryptd_aead_init_tfm(struct crypto_aead *tfm)
{
struct aead_instance *inst = aead_alg_instance(tfm);
- struct aead_instance_ctx *ictx = aead_instance_ctx(inst);
- struct crypto_aead_spawn *spawn = &ictx->aead_spawn;
+ struct crypto_aead_spawn *spawn = aead_instance_ctx(inst);
struct cryptd_aead_ctx *ctx = crypto_aead_ctx(tfm);
struct crypto_aead *cipher;
@@ -796,36 +746,32 @@ static void cryptd_aead_exit_tfm(struct crypto_aead *tfm)
static void cryptd_aead_free(struct aead_instance *inst)
{
- struct aead_instance_ctx *ctx = aead_instance_ctx(inst);
-
- crypto_drop_aead(&ctx->aead_spawn);
+ crypto_drop_aead(aead_instance_ctx(inst));
kfree(inst);
}
static int cryptd_create_aead(struct crypto_template *tmpl,
- struct rtattr **tb,
- struct crypto_attr_type *algt,
- struct cryptd_queue *queue)
+ struct rtattr **tb,
+ struct crypto_attr_type *algt)
{
- struct aead_instance_ctx *ctx;
+ struct crypto_aead_spawn *spawn;
struct aead_instance *inst;
struct aead_alg *alg;
u32 mask = cryptd_mask(algt);
int err;
- inst = kzalloc(sizeof(*inst) + sizeof(*ctx), GFP_KERNEL);
+ inst = kzalloc(sizeof(*inst) + sizeof(*spawn), GFP_KERNEL);
if (!inst)
return -ENOMEM;
- ctx = aead_instance_ctx(inst);
- ctx->queue = queue;
+ spawn = aead_instance_ctx(inst);
- err = crypto_grab_aead(&ctx->aead_spawn, aead_crypto_instance(inst),
+ err = crypto_grab_aead(spawn, aead_crypto_instance(inst),
crypto_attr_alg_name(tb[1]), 0, mask);
if (err)
goto err_free_inst;
- alg = crypto_spawn_aead_alg(&ctx->aead_spawn);
+ alg = crypto_spawn_aead_alg(spawn);
err = cryptd_init_instance(aead_crypto_instance(inst), &alg->base);
if (err)
goto err_free_inst;
@@ -853,8 +799,6 @@ static int cryptd_create_aead(struct crypto_template *tmpl,
return err;
}
-static struct cryptd_queue queue;
-
static int cryptd_create(struct crypto_template *tmpl, struct rtattr **tb)
{
struct crypto_attr_type *algt;
@@ -865,11 +809,11 @@ static int cryptd_create(struct crypto_template *tmpl, struct rtattr **tb)
switch (algt->type & algt->mask & CRYPTO_ALG_TYPE_MASK) {
case CRYPTO_ALG_TYPE_LSKCIPHER:
- return cryptd_create_skcipher(tmpl, tb, algt, &queue);
+ return cryptd_create_skcipher(tmpl, tb, algt);
case CRYPTO_ALG_TYPE_HASH:
- return cryptd_create_hash(tmpl, tb, algt, &queue);
+ return cryptd_create_hash(tmpl, tb, algt);
case CRYPTO_ALG_TYPE_AEAD:
- return cryptd_create_aead(tmpl, tb, algt, &queue);
+ return cryptd_create_aead(tmpl, tb, algt);
}
return -EINVAL;
@@ -891,7 +835,7 @@ static int __init cryptd_init(void)
if (!cryptd_wq)
return -ENOMEM;
- err = cryptd_init_queue(&queue, cryptd_max_cpu_qlen);
+ err = cryptd_init_queue(cryptd_max_cpu_qlen);
if (err)
goto err_destroy_wq;
@@ -902,7 +846,7 @@ static int __init cryptd_init(void)
return 0;
err_fini_queue:
- cryptd_fini_queue(&queue);
+ cryptd_fini_queue();
err_destroy_wq:
destroy_workqueue(cryptd_wq);
return err;
@@ -911,7 +855,7 @@ static int __init cryptd_init(void)
static void __exit cryptd_exit(void)
{
destroy_workqueue(cryptd_wq);
- cryptd_fini_queue(&queue);
+ cryptd_fini_queue();
crypto_unregister_template(&cryptd_tmpl);
}
--
2.56.1
^ permalink raw reply related [flat|nested] 6+ messages in thread