From: Brian Dooley <brian.dooley@intel.com>
To: Kai Ji <kai.ji@intel.com>
Cc: dev@dpdk.org, stable@dpdk.org, gakhil@marvell.com,
arkadiuszx.kusztal@intel.com,
Brian Dooley <brian.dooley@intel.com>,
declan.doherty@intel.com
Subject: [PATCH v1] crypto/qat: fix null hash algorithm digest size
Date: Thu, 27 Oct 2022 10:50:14 +0000 [thread overview]
Message-ID: <20221027105014.371696-1-brian.dooley@intel.com> (raw)
Add check for null hash algorithm digest size. Digest size should be 4B
or request will be rejected.
Fixes: 1703e94ac5ce ("qat: add driver for QuickAssist devices")
Cc: declan.doherty@intel.com
Cc: stable@dpdk.org
Signed-off-by: Brian Dooley <brian.dooley@intel.com>
---
drivers/crypto/qat/qat_sym_session.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/drivers/crypto/qat/qat_sym_session.c b/drivers/crypto/qat/qat_sym_session.c
index d96122b208..ff4b537706 100644
--- a/drivers/crypto/qat/qat_sym_session.c
+++ b/drivers/crypto/qat/qat_sym_session.c
@@ -2040,7 +2040,12 @@ int qat_sym_cd_auth_set(struct qat_sym_session *cdesc,
hash_offset = cdesc->cd_cur_ptr-((uint8_t *)&cdesc->cd);
hash = (struct icp_qat_hw_auth_setup *)cdesc->cd_cur_ptr;
hash->auth_config.reserved = 0;
- hash->auth_config.config =
+ if (cdesc->qat_hash_alg == ICP_QAT_HW_AUTH_ALGO_NULL)
+ hash->auth_config.config =
+ ICP_QAT_HW_AUTH_CONFIG_BUILD(cdesc->auth_mode,
+ cdesc->qat_hash_alg, 4);
+ else
+ hash->auth_config.config =
ICP_QAT_HW_AUTH_CONFIG_BUILD(cdesc->auth_mode,
cdesc->qat_hash_alg, digestsize);
@@ -2408,10 +2413,16 @@ int qat_sym_cd_auth_set(struct qat_sym_session *cdesc,
/* Auth CD config setup */
hash_cd_ctrl->hash_cfg_offset = hash_offset >> 3;
hash_cd_ctrl->hash_flags = ICP_QAT_FW_AUTH_HDR_FLAG_NO_NESTED;
- hash_cd_ctrl->inner_res_sz = digestsize;
- hash_cd_ctrl->final_sz = digestsize;
hash_cd_ctrl->inner_state1_sz = state1_size;
- auth_param->auth_res_sz = digestsize;
+ if (cdesc->qat_hash_alg == ICP_QAT_HW_AUTH_ALGO_NULL) {
+ hash_cd_ctrl->inner_res_sz = 4;
+ hash_cd_ctrl->final_sz = 4;
+ auth_param->auth_res_sz = 4;
+ } else {
+ hash_cd_ctrl->inner_res_sz = digestsize;
+ hash_cd_ctrl->final_sz = digestsize;
+ auth_param->auth_res_sz = digestsize;
+ }
hash_cd_ctrl->inner_state2_sz = state2_size;
hash_cd_ctrl->inner_state2_offset = hash_cd_ctrl->hash_cfg_offset +
--
2.25.1
next reply other threads:[~2022-10-27 10:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-27 10:50 Brian Dooley [this message]
2022-10-27 13:10 ` Power, Ciara
2022-10-27 14:12 ` Akhil Goyal
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=20221027105014.371696-1-brian.dooley@intel.com \
--to=brian.dooley@intel.com \
--cc=arkadiuszx.kusztal@intel.com \
--cc=declan.doherty@intel.com \
--cc=dev@dpdk.org \
--cc=gakhil@marvell.com \
--cc=kai.ji@intel.com \
--cc=stable@dpdk.org \
/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).