DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v2] crypto/qat: fix computation of cd ptr in zuc and snow
@ 2020-04-29 14:51 Arek Kusztal
  2020-04-29 16:30 ` Trahe, Fiona
  0 siblings, 1 reply; 3+ messages in thread
From: Arek Kusztal @ 2020-04-29 14:51 UTC (permalink / raw)
  To: dev; +Cc: fiona.trahe, Arek Kusztal, stable

Offset of cd pointer is too big by state1size + state2size, so few extra
unnecessary bytes will be copied into cd. Snow offset was improved as well.

Fixes: d9b7d5bbc845 ("crypto/qat: add ZUC EEA3/EIA3 capability")
Cc: stable@dpdk.org

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
---
v2:
- added improvement to Snow3G

 drivers/crypto/qat/qat_sym_session.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/crypto/qat/qat_sym_session.c b/drivers/crypto/qat/qat_sym_session.c
index 3727d56..58bdbd3 100644
--- a/drivers/crypto/qat/qat_sym_session.c
+++ b/drivers/crypto/qat/qat_sym_session.c
@@ -1664,7 +1664,7 @@ int qat_sym_session_aead_create_cd_auth(struct qat_sym_session *cdesc,
 		(struct icp_qat_fw_la_auth_req_params *)
 		((char *)&req_tmpl->serv_specif_rqpars +
 		ICP_QAT_FW_HASH_REQUEST_PARAMETERS_OFFSET);
-	uint16_t state1_size = 0, state2_size = 0;
+	uint16_t state1_size = 0, state2_size = 0, cd_extra_size = 0;
 	uint16_t hash_offset, cd_size;
 	uint32_t *aad_len = NULL;
 	uint32_t wordIndex  = 0;
@@ -1886,7 +1886,7 @@ int qat_sym_session_aead_create_cd_auth(struct qat_sym_session *cdesc,
 		memcpy(cipherconfig->key, authkey, authkeylen);
 		memset(cipherconfig->key + authkeylen,
 				0, ICP_QAT_HW_SNOW_3G_UEA2_IV_SZ);
-		cdesc->cd_cur_ptr += sizeof(struct icp_qat_hw_cipher_config) +
+		cd_extra_size += sizeof(struct icp_qat_hw_cipher_config) +
 				authkeylen + ICP_QAT_HW_SNOW_3G_UEA2_IV_SZ;
 		auth_param->hash_state_sz = ICP_QAT_HW_SNOW_3G_UEA2_IV_SZ >> 3;
 		break;
@@ -1902,8 +1902,7 @@ int qat_sym_session_aead_create_cd_auth(struct qat_sym_session *cdesc,
 			+ ICP_QAT_HW_ZUC_3G_EEA3_IV_SZ);
 
 		memcpy(cdesc->cd_cur_ptr + state1_size, authkey, authkeylen);
-		cdesc->cd_cur_ptr += state1_size + state2_size
-			+ ICP_QAT_HW_ZUC_3G_EEA3_IV_SZ;
+		cd_extra_size += ICP_QAT_HW_ZUC_3G_EEA3_IV_SZ;
 		auth_param->hash_state_sz = ICP_QAT_HW_ZUC_3G_EEA3_IV_SZ >> 3;
 		cdesc->min_qat_dev_gen = QAT_GEN2;
 
@@ -1989,7 +1988,7 @@ int qat_sym_session_aead_create_cd_auth(struct qat_sym_session *cdesc,
 			 RTE_ALIGN_CEIL(hash_cd_ctrl->inner_state1_sz, 8))
 					>> 3);
 
-	cdesc->cd_cur_ptr += state1_size + state2_size;
+	cdesc->cd_cur_ptr += state1_size + state2_size + cd_extra_size;
 	cd_size = cdesc->cd_cur_ptr-(uint8_t *)&cdesc->cd;
 
 	cd_pars->u.s.content_desc_addr = cdesc->cd_paddr;
-- 
2.1.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH v2] crypto/qat: fix computation of cd ptr in zuc and snow
  2020-04-29 14:51 [dpdk-dev] [PATCH v2] crypto/qat: fix computation of cd ptr in zuc and snow Arek Kusztal
@ 2020-04-29 16:30 ` Trahe, Fiona
  2020-05-09 21:54   ` Akhil Goyal
  0 siblings, 1 reply; 3+ messages in thread
From: Trahe, Fiona @ 2020-04-29 16:30 UTC (permalink / raw)
  To: Kusztal, ArkadiuszX, dev; +Cc: stable



> -----Original Message-----
> From: Kusztal, ArkadiuszX <arkadiuszx.kusztal@intel.com>
> Sent: Wednesday, April 29, 2020 3:52 PM
> To: dev@dpdk.org
> Cc: Trahe, Fiona <fiona.trahe@intel.com>; Kusztal, ArkadiuszX <arkadiuszx.kusztal@intel.com>;
> stable@dpdk.org
> Subject: [PATCH v2] crypto/qat: fix computation of cd ptr in zuc and snow
> 
> Offset of cd pointer is too big by state1size + state2size, so few extra
> unnecessary bytes will be copied into cd. Snow offset was improved as well.
> 
> Fixes: d9b7d5bbc845 ("crypto/qat: add ZUC EEA3/EIA3 capability")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH v2] crypto/qat: fix computation of cd ptr in zuc and snow
  2020-04-29 16:30 ` Trahe, Fiona
@ 2020-05-09 21:54   ` Akhil Goyal
  0 siblings, 0 replies; 3+ messages in thread
From: Akhil Goyal @ 2020-05-09 21:54 UTC (permalink / raw)
  To: Trahe, Fiona, Kusztal, ArkadiuszX, dev; +Cc: stable

> > Offset of cd pointer is too big by state1size + state2size, so few extra
> > unnecessary bytes will be copied into cd. Snow offset was improved as well.
> >
> > Fixes: d9b7d5bbc845 ("crypto/qat: add ZUC EEA3/EIA3 capability")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
> Acked-by: Fiona Trahe <fiona.trahe@intel.com>

Applied to dpdk-next-crypto

Thanks.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-09 21:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-29 14:51 [dpdk-dev] [PATCH v2] crypto/qat: fix computation of cd ptr in zuc and snow Arek Kusztal
2020-04-29 16:30 ` Trahe, Fiona
2020-05-09 21:54   ` Akhil Goyal

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).