From: Akhil Goyal Subject: [PATCH 2/6] crypto/dpaa2_sec: fix offset calculation for gcm Date: Wed, 27 Mar 2019 11:53:32 +0000 Message-ID: <20190327114407.13697-3-akhil.goyal@nxp.com> References: <20190327114407.13697-1-akhil.goyal@nxp.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Cc: Hemant Agrawal , Akhil Goyal , "stable@dpdk.org" To: "dev@dpdk.org" Return-path: In-Reply-To: <20190327114407.13697-1-akhil.goyal@nxp.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" In case of gcm, output buffer should have aad space before the actual buffer which needs to be written. CAAM will not write into the aad anything, it will skip auth_only_len (aad) and write the buffer afterwards. Fixes: 37f96eb01bce ("crypto/dpaa2_sec: support scatter gather") Cc: stable@dpdk.org Signed-off-by: Akhil Goyal --- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/d= paa2_sec/dpaa2_sec_dpseci.c index d955ffc45..7e762d4b8 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c @@ -236,8 +236,8 @@ build_authenc_gcm_sg_fd(dpaa2_sec_session *sess, =20 /* Configure Output SGE for Encap/Decap */ DPAA2_SET_FLE_ADDR(sge, DPAA2_MBUF_VADDR_TO_IOVA(mbuf)); - DPAA2_SET_FLE_OFFSET(sge, mbuf->data_off + sym_op->aead.data.offset - - auth_only_len); + DPAA2_SET_FLE_OFFSET(sge, mbuf->data_off + + RTE_ALIGN_CEIL(auth_only_len, 16) - auth_only_len); sge->length =3D mbuf->data_len - sym_op->aead.data.offset + auth_only_len= ; =20 mbuf =3D mbuf->next; @@ -400,8 +400,8 @@ build_authenc_gcm_fd(dpaa2_sec_session *sess, =20 /* Configure Output SGE for Encap/Decap */ DPAA2_SET_FLE_ADDR(sge, DPAA2_MBUF_VADDR_TO_IOVA(dst)); - DPAA2_SET_FLE_OFFSET(sge, sym_op->aead.data.offset + - dst->data_off - auth_only_len); + DPAA2_SET_FLE_OFFSET(sge, dst->data_off + + RTE_ALIGN_CEIL(auth_only_len, 16) - auth_only_len); sge->length =3D sym_op->aead.data.length + auth_only_len; =20 if (sess->dir =3D=3D DIR_ENC) { --=20 2.17.1