From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id C18331B3B5 for ; Wed, 11 Jul 2018 20:04:31 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jul 2018 11:04:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,338,1526367600"; d="scan'208";a="244451265" Received: from irsmsx153.ger.corp.intel.com ([163.33.192.75]) by fmsmga005.fm.intel.com with ESMTP; 11 Jul 2018 11:04:16 -0700 Received: from irsmsx101.ger.corp.intel.com ([169.254.1.185]) by IRSMSX153.ger.corp.intel.com ([169.254.9.210]) with mapi id 14.03.0319.002; Wed, 11 Jul 2018 19:04:15 +0100 From: "Trahe, Fiona" To: Dmitry Eremin-Solenikov , "dev@dpdk.org" CC: "Trahe, Fiona" Thread-Topic: [dpdk-dev] [PATCH] qat: fix checks for 3gpp algorithms vs bit mode Thread-Index: AQHUGRIv5wxV+iXlpkKrZX0b0yhfiaSKULKA Date: Wed, 11 Jul 2018 18:04:15 +0000 Message-ID: <348A99DA5F5B7549AA880327E580B435895D816A@IRSMSX101.ger.corp.intel.com> References: <20180711122432.14658-1-dmitry.ereminsolenikov@linaro.org> In-Reply-To: <20180711122432.14658-1-dmitry.ereminsolenikov@linaro.org> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNjE0YmQ5MDItZDUyMS00NDlkLThlZGMtYjY2N2RlYTI4N2MyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoibVwvT0FSandNbTl2dytjVGZTVGRBTGQ4TVlMNlZkcDMwbUlka0V5bUE0ZEF4NW5FQ0xybDgwUlFCbXpPb081Z0MifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.200.100 dlp-reaction: no-action x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] qat: fix checks for 3gpp algorithms vs bit mode X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jul 2018 18:04:32 -0000 Hi Dmitri, Thanks for debugging this.=20 However the below fix can truncate the data - I'll send an alternative fix = shortly. Fiona > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Dmitry Eremin-Soleni= kov > Sent: Wednesday, July 11, 2018 1:25 PM > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH] qat: fix checks for 3gpp algorithms vs bit mo= de >=20 > 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. >=20 > Signed-off-by: Dmitry Eremin-Solenikov > --- > drivers/crypto/qat/qat_sym.c | 22 +++++++++++----------- > 1 file changed, 11 insertions(+), 11 deletions(-) >=20 > diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c > index 17d63eb1ee35..0ede2c23d54f 100644 > --- a/drivers/crypto/qat/qat_sym.c > +++ b/drivers/crypto/qat/qat_sym.c > @@ -224,18 +224,16 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg= , > ctx->qat_cipher_alg =3D=3D > ICP_QAT_HW_CIPHER_ALGO_ZUC_3G_128_EEA3) { >=20 > - if (unlikely( > - (cipher_param->cipher_length % BYTE_LENGTH !=3D 0) > - || (cipher_param->cipher_offset > - % BYTE_LENGTH !=3D 0))) { > + cipher_len =3D op->sym->cipher.data.length >> 3; > + cipher_ofs =3D op->sym->cipher.data.offset >> 3; > + > + if (unlikely((cipher_len % BYTE_LENGTH !=3D 0) > + || (cipher_ofs % BYTE_LENGTH !=3D 0))) { > QAT_DP_LOG(ERR, > "SNOW3G/KASUMI/ZUC in QAT PMD only supports byte aligned values"); > op->status =3D RTE_CRYPTO_OP_STATUS_INVALID_ARGS; > return -EINVAL; > } > - cipher_len =3D op->sym->cipher.data.length >> 3; > - cipher_ofs =3D op->sym->cipher.data.offset >> 3; > - > } else if (ctx->bpi_ctx) { > /* DOCSIS - only send complete blocks to device > * Process any partial block using CFB mode. > @@ -260,15 +258,17 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg= , > ctx->qat_hash_alg =3D=3D ICP_QAT_HW_AUTH_ALGO_KASUMI_F9 || > ctx->qat_hash_alg =3D=3D > ICP_QAT_HW_AUTH_ALGO_ZUC_3G_128_EIA3) { > - if (unlikely((auth_param->auth_off % BYTE_LENGTH !=3D 0) > - || (auth_param->auth_len % BYTE_LENGTH !=3D 0))) { > + > + auth_ofs =3D op->sym->auth.data.offset >> 3; > + auth_len =3D op->sym->auth.data.length >> 3; > + > + if (unlikely((auth_off % BYTE_LENGTH !=3D 0) > + || (auth_len % BYTE_LENGTH !=3D 0))) { > QAT_DP_LOG(ERR, > "For SNOW3G/KASUMI/ZUC, QAT PMD only supports byte aligned values"); > op->status =3D RTE_CRYPTO_OP_STATUS_INVALID_ARGS; > return -EINVAL; > } > - auth_ofs =3D op->sym->auth.data.offset >> 3; > - auth_len =3D op->sym->auth.data.length >> 3; >=20 > auth_param->u1.aad_adr =3D > rte_crypto_op_ctophys_offset(op, > -- > 2.18.0