2022-09-23 09:18:45

by Gaosheng Cui

[permalink] [raw]
Subject: [PATCH 0/3] A few cleanup patches for crypto

This series contains a few cleanup patches, to remove orphan
inline functions and simplify some code. Thanks!

Gaosheng Cui (3):
crypto: bcm - Simplify obtain the name for cipher
crypto: aead - Remove unused inline functions from aead
crypto: scatterwalk - Remove unused inline function
scatterwalk_aligned()

drivers/crypto/bcm/cipher.c | 4 ++--
include/crypto/internal/aead.h | 25 -------------------------
include/crypto/scatterwalk.h | 6 ------
3 files changed, 2 insertions(+), 33 deletions(-)

--
2.25.1


2022-09-23 09:18:45

by Gaosheng Cui

[permalink] [raw]
Subject: [PATCH 2/3] crypto: aead - Remove unused inline functions from aead

The aead_enqueue_request, aead_dequeue_request and aead_get_backlog
are no longer used since commit 04a4616e6a21 ("crypto: omap-aes-gcm
- convert to use crypto engine"), their functinoality has been
replaced by crypto engine, so remove them.

Signed-off-by: Gaosheng Cui <[email protected]>
---
include/crypto/internal/aead.h | 25 -------------------------
1 file changed, 25 deletions(-)

diff --git a/include/crypto/internal/aead.h b/include/crypto/internal/aead.h
index 27b7b0224ea6..d482017f3e20 100644
--- a/include/crypto/internal/aead.h
+++ b/include/crypto/internal/aead.h
@@ -114,31 +114,6 @@ static inline void aead_init_queue(struct aead_queue *queue,
crypto_init_queue(&queue->base, max_qlen);
}

-static inline int aead_enqueue_request(struct aead_queue *queue,
- struct aead_request *request)
-{
- return crypto_enqueue_request(&queue->base, &request->base);
-}
-
-static inline struct aead_request *aead_dequeue_request(
- struct aead_queue *queue)
-{
- struct crypto_async_request *req;
-
- req = crypto_dequeue_request(&queue->base);
-
- return req ? container_of(req, struct aead_request, base) : NULL;
-}
-
-static inline struct aead_request *aead_get_backlog(struct aead_queue *queue)
-{
- struct crypto_async_request *req;
-
- req = crypto_get_backlog(&queue->base);
-
- return req ? container_of(req, struct aead_request, base) : NULL;
-}
-
static inline unsigned int crypto_aead_alg_chunksize(struct aead_alg *alg)
{
return alg->chunksize;
--
2.25.1

2022-09-23 09:18:45

by Gaosheng Cui

[permalink] [raw]
Subject: [PATCH 3/3] crypto: scatterwalk - Remove unused inline function scatterwalk_aligned()

The scatterwalk_aligned() are no longer used since removing blkcipher
and ablkcipher support, all use of it has been removed since
commit d63007eb954e ("crypto: ablkcipher - remove deprecated
and unused ablkcipher support"), so remove it.

Signed-off-by: Gaosheng Cui <[email protected]>
---
include/crypto/scatterwalk.h | 6 ------
1 file changed, 6 deletions(-)

diff --git a/include/crypto/scatterwalk.h b/include/crypto/scatterwalk.h
index 6407b4b61350..ccdb05f68a75 100644
--- a/include/crypto/scatterwalk.h
+++ b/include/crypto/scatterwalk.h
@@ -46,12 +46,6 @@ static inline void scatterwalk_advance(struct scatter_walk *walk,
walk->offset += nbytes;
}

-static inline unsigned int scatterwalk_aligned(struct scatter_walk *walk,
- unsigned int alignmask)
-{
- return !(walk->offset & alignmask);
-}
-
static inline struct page *scatterwalk_page(struct scatter_walk *walk)
{
return sg_page(walk->sg) + (walk->offset >> PAGE_SHIFT);
--
2.25.1

2022-09-23 09:18:46

by Gaosheng Cui

[permalink] [raw]
Subject: [PATCH 1/3] crypto: bcm - Simplify obtain the name for cipher

The crypto_ahash_alg_name(tfm) can obtain the name for cipher in
include/crypto/hash.h, but now the function is not in use, so we
use it to simplify the code, and optimize the code structure.

Signed-off-by: Gaosheng Cui <[email protected]>
---
drivers/crypto/bcm/cipher.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/bcm/cipher.c b/drivers/crypto/bcm/cipher.c
index 053315e260c2..c8c799428fe0 100644
--- a/drivers/crypto/bcm/cipher.c
+++ b/drivers/crypto/bcm/cipher.c
@@ -1928,7 +1928,7 @@ static int ahash_enqueue(struct ahash_request *req)
/* SPU2 hardware does not compute hash of zero length data */
if ((rctx->is_final == 1) && (rctx->total_todo == 0) &&
(iproc_priv.spu.spu_type == SPU_TYPE_SPU2)) {
- alg_name = crypto_tfm_alg_name(crypto_ahash_tfm(tfm));
+ alg_name = crypto_ahash_alg_name(tfm);
flow_log("Doing %sfinal %s zero-len hash request in software\n",
rctx->is_final ? "" : "non-", alg_name);
err = do_shash((unsigned char *)alg_name, req->result,
@@ -2029,7 +2029,7 @@ static int ahash_init(struct ahash_request *req)
* supported by the hardware, we need to handle it in software
* by calling synchronous hash functions.
*/
- alg_name = crypto_tfm_alg_name(crypto_ahash_tfm(tfm));
+ alg_name = crypto_ahash_alg_name(tfm);
hash = crypto_alloc_shash(alg_name, 0, 0);
if (IS_ERR(hash)) {
ret = PTR_ERR(hash);
--
2.25.1