DPDK patches and discussions
 help / color / mirror / Atom feed
From: Arek Kusztal <arkadiuszx.kusztal@intel.com>
To: akhil.goyal@nxp.com
Cc: dev@dpdk.org, fiona.trahe@intel.com,
	Arek Kusztal <arkadiuszx.kusztal@intel.com>,
	stable@dpdk.org
Subject: [dpdk-dev] [PATCH 1/3] crypto/qat: handle error msg of block size properly
Date: Wed, 12 Dec 2018 20:59:02 +0100	[thread overview]
Message-ID: <20181212195904.8160-2-arkadiuszx.kusztal@intel.com> (raw)
In-Reply-To: <20181212195904.8160-1-arkadiuszx.kusztal@intel.com>

Error code of qat_hash_get_block_size needs to be handle properly.

Fixes: 10b49880e3c5 ("crypto/qat: make the session struct variable in size")
Cc: stable@dpdk.org

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
---
 drivers/crypto/qat/qat_sym_session.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/crypto/qat/qat_sym_session.c b/drivers/crypto/qat/qat_sym_session.c
index 8196e23..272177f 100644
--- a/drivers/crypto/qat/qat_sym_session.c
+++ b/drivers/crypto/qat/qat_sym_session.c
@@ -1143,8 +1143,8 @@ static int qat_sym_do_precomputes(enum icp_qat_hw_auth_algo hash_alg,
 	}
 
 	block_size = qat_hash_get_block_size(hash_alg);
-	if (block_size <= 0)
-		return -EFAULT;
+	if (block_size < 0)
+		return block_size;
 	/* init ipad and opad from key and xor with fixed values */
 	memset(ipad, 0, block_size);
 	memset(opad, 0, block_size);
@@ -1490,9 +1490,13 @@ int qat_sym_session_aead_create_cd_auth(struct qat_sym_session *cdesc,
 		|| cdesc->qat_hash_alg == ICP_QAT_HW_AUTH_ALGO_AES_XCBC_MAC
 			)
 		hash->auth_counter.counter = 0;
-	else
-		hash->auth_counter.counter = rte_bswap32(
-				qat_hash_get_block_size(cdesc->qat_hash_alg));
+	else {
+		int block_size = qat_hash_get_block_size(cdesc->qat_hash_alg);
+
+		if (block_size < 0)
+			return block_size;
+		hash->auth_counter.counter = rte_bswap32(block_size);
+	}
 
 	cdesc->cd_cur_ptr += sizeof(struct icp_qat_hw_auth_setup);
 
-- 
2.1.0

  reply	other threads:[~2018-12-12 19:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-12 19:59 [dpdk-dev] [PATCH 0/3] Fix handling of block size in qat for hash Arek Kusztal
2018-12-12 19:59 ` Arek Kusztal [this message]
2018-12-17 12:12   ` [dpdk-dev] [PATCH 1/3] crypto/qat: handle error msg of block size properly Kovacevic, Marko
2018-12-12 19:59 ` [dpdk-dev] [PATCH 2/3] crypto/qat: fix message for CCM when setting unused counter Arek Kusztal
2018-12-14 14:23   ` Akhil Goyal
2018-12-14 14:39     ` Kusztal, ArkadiuszX
2018-12-17 12:16   ` Kovacevic, Marko
2018-12-12 19:59 ` [dpdk-dev] [PATCH 3/3] crypto/qat: fix message for NULL algo " Arek Kusztal
2018-12-13 23:01 ` [dpdk-dev] [PATCH 0/3] Fix handling of block size in qat for hash Trahe, Fiona
2018-12-17 12:15 ` Kovacevic, Marko
2018-12-18 10:29 ` 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=20181212195904.8160-2-arkadiuszx.kusztal@intel.com \
    --to=arkadiuszx.kusztal@intel.com \
    --cc=akhil.goyal@nxp.com \
    --cc=dev@dpdk.org \
    --cc=fiona.trahe@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).