DPDK patches and discussions
 help / color / mirror / Atom feed
From: Fiona Trahe <fiona.trahe@intel.com>
To: dev@dpdk.org, dmitry.ereminsolenikov@linaro.org
Cc: pablo.de.lara.guarch@intel.com, fiona.trahe@intel.com
Subject: [dpdk-dev] [PATCH v2] crypto/qat: fix checks for 3gpp algo bit params
Date: Wed, 11 Jul 2018 19:02:43 +0100	[thread overview]
Message-ID: <1531332163-28453-1-git-send-email-fiona.trahe@intel.com> (raw)
In-Reply-To: <20180711122432.14658-1-dmitry.ereminsolenikov@linaro.org>

QAT driver checks byte alignment for KASUMI/SNOW 3G/ZUC algorithms using
cipher/auth_param, which are not initialized at this moment yet. Use
operation params instead.

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
---
Change in v2 :
- fixed implementation to avoid data truncation

This fix should be backported to stable.
In 18.08 the code location has changed.
In earlier releases it was 
in qat_write_hw_desc_entry() in qat/qat_crypto.c



 drivers/crypto/qat/qat_sym.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c
index aa6eeb0..4ed7d95 100644
--- a/drivers/crypto/qat/qat_sym.c
+++ b/drivers/crypto/qat/qat_sym.c
@@ -225,9 +225,8 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg,
 				ICP_QAT_HW_CIPHER_ALGO_ZUC_3G_128_EEA3) {
 
 			if (unlikely(
-				(cipher_param->cipher_length % BYTE_LENGTH != 0)
-				 || (cipher_param->cipher_offset
-							% BYTE_LENGTH != 0))) {
+			    (op->sym->cipher.data.length % BYTE_LENGTH != 0) ||
+			    (op->sym->cipher.data.offset % BYTE_LENGTH != 0))) {
 				QAT_DP_LOG(ERR,
 		  "SNOW3G/KASUMI/ZUC in QAT PMD only supports byte aligned values");
 				op->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
@@ -260,8 +259,9 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg,
 			ctx->qat_hash_alg == ICP_QAT_HW_AUTH_ALGO_KASUMI_F9 ||
 			ctx->qat_hash_alg ==
 				ICP_QAT_HW_AUTH_ALGO_ZUC_3G_128_EIA3) {
-			if (unlikely((auth_param->auth_off % BYTE_LENGTH != 0)
-				|| (auth_param->auth_len % BYTE_LENGTH != 0))) {
+			if (unlikely(
+			    (op->sym->auth.data.offset % BYTE_LENGTH != 0) ||
+			    (op->sym->auth.data.length % BYTE_LENGTH != 0))) {
 				QAT_DP_LOG(ERR,
 		"For SNOW3G/KASUMI/ZUC, QAT PMD only supports byte aligned values");
 				op->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
-- 
2.7.4

  reply	other threads:[~2018-07-11 18:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-11 12:24 [dpdk-dev] [PATCH] qat: fix checks for 3gpp algorithms vs bit mode Dmitry Eremin-Solenikov
2018-07-11 18:02 ` Fiona Trahe [this message]
2018-07-12  8:19   ` [dpdk-dev] [PATCH v2] crypto/qat: fix checks for 3gpp algo bit params Dmitry Eremin-Solenikov
2018-07-13 14:15   ` De Lara Guarch, Pablo
2018-07-13 14:31     ` De Lara Guarch, Pablo
2018-07-11 18:04 ` [dpdk-dev] [PATCH] qat: fix checks for 3gpp algorithms vs bit mode Trahe, Fiona
2018-07-13 13:02   ` De Lara Guarch, Pablo

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=1531332163-28453-1-git-send-email-fiona.trahe@intel.com \
    --to=fiona.trahe@intel.com \
    --cc=dev@dpdk.org \
    --cc=dmitry.ereminsolenikov@linaro.org \
    --cc=pablo.de.lara.guarch@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).