From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
Kai Ji <kai.ji@intel.com>, Ciara Power <ciara.power@intel.com>,
Fan Zhang <fanzhang.oss@gmail.com>
Subject: [RFC 1/5] crypto/qat: fix memset of SHA3 state
Date: Wed, 13 Nov 2024 10:56:00 -0800 [thread overview]
Message-ID: <20241113185720.28706-2-stephen@networkplumber.org> (raw)
In-Reply-To: <20241113185720.28706-1-stephen@networkplumber.org>
The memset was always doing 0 bytes since size computed later.
PVS studio bug 24-27
Fixes: 3a80d7fb2ecd ("crypto/qat: support SHA3 plain hash")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/crypto/qat/qat_sym_session.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/crypto/qat/qat_sym_session.c b/drivers/crypto/qat/qat_sym_session.c
index 50d687fd37..8ccd1babc0 100644
--- a/drivers/crypto/qat/qat_sym_session.c
+++ b/drivers/crypto/qat/qat_sym_session.c
@@ -2346,7 +2346,7 @@ int qat_sym_cd_cipher_set(struct qat_sym_session *cdesc,
return 0;
}
-int qat_sym_cd_auth_set(struct qat_sym_session *cdesc,
+static int qat_sym_cd_auth_set(struct qat_sym_session *cdesc,
const uint8_t *authkey,
uint32_t authkeylen,
uint32_t aad_length,
@@ -2619,27 +2619,27 @@ int qat_sym_cd_auth_set(struct qat_sym_session *cdesc,
break;
case ICP_QAT_HW_AUTH_ALGO_SHA3_224:
/* Plain SHA3-224 */
- memset(cdesc->cd_cur_ptr, 0, state1_size);
state1_size = qat_hash_get_state1_size(
cdesc->qat_hash_alg);
+ memset(cdesc->cd_cur_ptr, 0, state1_size);
break;
case ICP_QAT_HW_AUTH_ALGO_SHA3_256:
/* Plain SHA3-256 */
- memset(cdesc->cd_cur_ptr, 0, state1_size);
state1_size = qat_hash_get_state1_size(
cdesc->qat_hash_alg);
+ memset(cdesc->cd_cur_ptr, 0, state1_size);
break;
case ICP_QAT_HW_AUTH_ALGO_SHA3_384:
/* Plain SHA3-384 */
- memset(cdesc->cd_cur_ptr, 0, state1_size);
state1_size = qat_hash_get_state1_size(
cdesc->qat_hash_alg);
+ memset(cdesc->cd_cur_ptr, 0, state1_size);
break;
case ICP_QAT_HW_AUTH_ALGO_SHA3_512:
/* Plain SHA3-512 */
- memset(cdesc->cd_cur_ptr, 0, state1_size);
state1_size = qat_hash_get_state1_size(
cdesc->qat_hash_alg);
+ memset(cdesc->cd_cur_ptr, 0, state1_size);
break;
case ICP_QAT_HW_AUTH_ALGO_AES_XCBC_MAC:
state1_size = ICP_QAT_HW_AES_XCBC_MAC_STATE1_SZ;
--
2.45.2
next prev parent reply other threads:[~2024-11-13 18:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-13 18:55 [RFC 0/5] Fix memset usage Stephen Hemminger
2024-11-13 18:56 ` Stephen Hemminger [this message]
2024-11-13 18:56 ` [RFC 2/5] crypto/qat: use secure memset Stephen Hemminger
2024-11-13 18:56 ` [RFC 3/5] bus/uacce: remove memset before free Stephen Hemminger
2024-11-14 0:55 ` fengchengwen
2024-11-13 18:56 ` [RFC 4/5] compress/octeontx: remove memset before rte_free Stephen Hemminger
2024-11-13 18:56 ` [RFC 5/5] test: remove unneeded memset Stephen Hemminger
2024-11-14 8:56 ` [RFC 0/5] Fix memset usage Bruce Richardson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241113185720.28706-2-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=ciara.power@intel.com \
--cc=dev@dpdk.org \
--cc=fanzhang.oss@gmail.com \
--cc=kai.ji@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).