* [PATCH 0/2] crypto: hisilicon - optimize the processing of qm and sec functions
@ 2023-12-09 7:01 Chenghai Huang
2023-12-09 7:01 ` [PATCH 1/2] crypto: hisilicon/qm - delete a dbg function Chenghai Huang
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Chenghai Huang @ 2023-12-09 7:01 UTC (permalink / raw)
To: herbert, davem
Cc: linux-kernel, linux-crypto, shenyang39, liulongfang, qianweili
This seires patch optimize the process of ret, and delete risky redundant
functions.
*** BLURB HERE ***
Chenghai Huang (2):
crypto: hisilicon/qm - delete a dbg function
crypto: hisilicon/sec2 - optimize the error return process
drivers/crypto/hisilicon/qm.c | 3 ---
drivers/crypto/hisilicon/sec2/sec_crypto.c | 7 +++++--
2 files changed, 5 insertions(+), 5 deletions(-)
--
2.30.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] crypto: hisilicon/qm - delete a dbg function
2023-12-09 7:01 [PATCH 0/2] crypto: hisilicon - optimize the processing of qm and sec functions Chenghai Huang
@ 2023-12-09 7:01 ` Chenghai Huang
2023-12-09 7:01 ` [PATCH 2/2] crypto: hisilicon/sec2 - optimize the error return process Chenghai Huang
2023-12-15 9:57 ` [PATCH 0/2] crypto: hisilicon - optimize the processing of qm and sec functions Herbert Xu
2 siblings, 0 replies; 4+ messages in thread
From: Chenghai Huang @ 2023-12-09 7:01 UTC (permalink / raw)
To: herbert, davem
Cc: linux-kernel, linux-crypto, shenyang39, liulongfang, qianweili
Deleted a dbg function because this function has the risk of
address leakage. In addition, this function is only used for
debugging in the early stage and is not required in the future.
Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
---
drivers/crypto/hisilicon/qm.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c
index d05ad2b16d0a..4b20b94e6371 100644
--- a/drivers/crypto/hisilicon/qm.c
+++ b/drivers/crypto/hisilicon/qm.c
@@ -597,9 +597,6 @@ int hisi_qm_mb(struct hisi_qm *qm, u8 cmd, dma_addr_t dma_addr, u16 queue,
struct qm_mailbox mailbox;
int ret;
- dev_dbg(&qm->pdev->dev, "QM mailbox request to q%u: %u-%llx\n",
- queue, cmd, (unsigned long long)dma_addr);
-
qm_mb_pre_init(&mailbox, cmd, dma_addr, queue, op);
mutex_lock(&qm->mailbox_lock);
--
2.30.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] crypto: hisilicon/sec2 - optimize the error return process
2023-12-09 7:01 [PATCH 0/2] crypto: hisilicon - optimize the processing of qm and sec functions Chenghai Huang
2023-12-09 7:01 ` [PATCH 1/2] crypto: hisilicon/qm - delete a dbg function Chenghai Huang
@ 2023-12-09 7:01 ` Chenghai Huang
2023-12-15 9:57 ` [PATCH 0/2] crypto: hisilicon - optimize the processing of qm and sec functions Herbert Xu
2 siblings, 0 replies; 4+ messages in thread
From: Chenghai Huang @ 2023-12-09 7:01 UTC (permalink / raw)
To: herbert, davem
Cc: linux-kernel, linux-crypto, shenyang39, liulongfang, qianweili
Add the printf of an error message and optimized the handling
process of ret.
Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
---
drivers/crypto/hisilicon/sec2/sec_crypto.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/crypto/hisilicon/sec2/sec_crypto.c b/drivers/crypto/hisilicon/sec2/sec_crypto.c
index c760f3a8af4d..f028dcfd0ead 100644
--- a/drivers/crypto/hisilicon/sec2/sec_crypto.c
+++ b/drivers/crypto/hisilicon/sec2/sec_crypto.c
@@ -850,6 +850,7 @@ static int sec_skcipher_setkey(struct crypto_skcipher *tfm, const u8 *key,
ret = sec_skcipher_aes_sm4_setkey(c_ctx, keylen, c_mode);
break;
default:
+ dev_err(dev, "sec c_alg err!\n");
return -EINVAL;
}
@@ -1172,7 +1173,8 @@ static int sec_aead_setkey(struct crypto_aead *tfm, const u8 *key,
return 0;
}
- if (crypto_authenc_extractkeys(&keys, key, keylen))
+ ret = crypto_authenc_extractkeys(&keys, key, keylen);
+ if (ret)
goto bad_key;
ret = sec_aead_aes_set_key(c_ctx, &keys);
@@ -1189,6 +1191,7 @@ static int sec_aead_setkey(struct crypto_aead *tfm, const u8 *key,
if ((ctx->a_ctx.mac_len & SEC_SQE_LEN_RATE_MASK) ||
(ctx->a_ctx.a_key_len & SEC_SQE_LEN_RATE_MASK)) {
+ ret = -EINVAL;
dev_err(dev, "MAC or AUTH key length error!\n");
goto bad_key;
}
@@ -1197,7 +1200,7 @@ static int sec_aead_setkey(struct crypto_aead *tfm, const u8 *key,
bad_key:
memzero_explicit(&keys, sizeof(struct crypto_authenc_keys));
- return -EINVAL;
+ return ret;
}
--
2.30.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] crypto: hisilicon - optimize the processing of qm and sec functions
2023-12-09 7:01 [PATCH 0/2] crypto: hisilicon - optimize the processing of qm and sec functions Chenghai Huang
2023-12-09 7:01 ` [PATCH 1/2] crypto: hisilicon/qm - delete a dbg function Chenghai Huang
2023-12-09 7:01 ` [PATCH 2/2] crypto: hisilicon/sec2 - optimize the error return process Chenghai Huang
@ 2023-12-15 9:57 ` Herbert Xu
2 siblings, 0 replies; 4+ messages in thread
From: Herbert Xu @ 2023-12-15 9:57 UTC (permalink / raw)
To: Chenghai Huang
Cc: davem, linux-kernel, linux-crypto, shenyang39, liulongfang, qianweili
On Sat, Dec 09, 2023 at 03:01:33PM +0800, Chenghai Huang wrote:
> This seires patch optimize the process of ret, and delete risky redundant
> functions.
>
> *** BLURB HERE ***
>
> Chenghai Huang (2):
> crypto: hisilicon/qm - delete a dbg function
> crypto: hisilicon/sec2 - optimize the error return process
>
> drivers/crypto/hisilicon/qm.c | 3 ---
> drivers/crypto/hisilicon/sec2/sec_crypto.c | 7 +++++--
> 2 files changed, 5 insertions(+), 5 deletions(-)
>
> --
> 2.30.0
All applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-12-15 9:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-09 7:01 [PATCH 0/2] crypto: hisilicon - optimize the processing of qm and sec functions Chenghai Huang
2023-12-09 7:01 ` [PATCH 1/2] crypto: hisilicon/qm - delete a dbg function Chenghai Huang
2023-12-09 7:01 ` [PATCH 2/2] crypto: hisilicon/sec2 - optimize the error return process Chenghai Huang
2023-12-15 9:57 ` [PATCH 0/2] crypto: hisilicon - optimize the processing of qm and sec functions Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®