* [PATCH v2 4/8] crypto/qat: fix size calculation for memset
[not found] ` <20241114015405.77060-1-stephen@networkplumber.org>
@ 2024-11-14 1:52 ` Stephen Hemminger
0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2024-11-14 1:52 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, stable, Kai Ji, Ciara Power, Fan Zhang
The memset was always doing 0 bytes since size computed later.
Link: https://pvs-studio.com/en/blog/posts/cpp/1179/
Fixes: 3a80d7fb2ecd ("crypto/qat: support SHA3 plain hash")
Cc: stable@dpdk.org
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 4b4e9ccbab..8915307c1d 100644
--- a/drivers/crypto/qat/qat_sym_session.c
+++ b/drivers/crypto/qat/qat_sym_session.c
@@ -2347,7 +2347,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,
@@ -2620,27 +2620,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
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH v3 04/11] crypto/qat: fix size calculation for memset
[not found] ` <20241114023738.141821-1-stephen@networkplumber.org>
@ 2024-11-14 2:35 ` Stephen Hemminger
0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2024-11-14 2:35 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, stable, Kai Ji, Ciara Power, Fan Zhang
The memset was always doing 0 bytes since size computed later.
Link: https://pvs-studio.com/en/blog/posts/cpp/1179/
Fixes: 3a80d7fb2ecd ("crypto/qat: support SHA3 plain hash")
Cc: stable@dpdk.org
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 2fce8fcb16..6f3eacaf43 100644
--- a/drivers/crypto/qat/qat_sym_session.c
+++ b/drivers/crypto/qat/qat_sym_session.c
@@ -2347,7 +2347,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,
@@ -2620,27 +2620,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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-11-14 2:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20241114011129.451243-1-stephen@networkplumber.org>
[not found] ` <20241114015405.77060-1-stephen@networkplumber.org>
2024-11-14 1:52 ` [PATCH v2 4/8] crypto/qat: fix size calculation for memset Stephen Hemminger
[not found] ` <20241114023738.141821-1-stephen@networkplumber.org>
2024-11-14 2:35 ` [PATCH v3 04/11] " Stephen Hemminger
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).