crypto/dpaa2_sec: fix offset calculation for GCM

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: 37f96eb01b ("crypto/dpaa2_sec: support scatter gather")
Cc: stable@dpdk.org

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
This commit is contained in:
Akhil Goyal 2019-03-27 11:53:32 +00:00
parent fd4f22fbd8
commit a5e05ab643

View File

@ -236,8 +236,8 @@ build_authenc_gcm_sg_fd(dpaa2_sec_session *sess,
/* Configure Output SGE for Encap/Decap */ /* Configure Output SGE for Encap/Decap */
DPAA2_SET_FLE_ADDR(sge, DPAA2_MBUF_VADDR_TO_IOVA(mbuf)); DPAA2_SET_FLE_ADDR(sge, DPAA2_MBUF_VADDR_TO_IOVA(mbuf));
DPAA2_SET_FLE_OFFSET(sge, mbuf->data_off + sym_op->aead.data.offset - DPAA2_SET_FLE_OFFSET(sge, mbuf->data_off +
auth_only_len); RTE_ALIGN_CEIL(auth_only_len, 16) - auth_only_len);
sge->length = mbuf->data_len - sym_op->aead.data.offset + auth_only_len; sge->length = mbuf->data_len - sym_op->aead.data.offset + auth_only_len;
mbuf = mbuf->next; mbuf = mbuf->next;
@ -400,8 +400,8 @@ build_authenc_gcm_fd(dpaa2_sec_session *sess,
/* Configure Output SGE for Encap/Decap */ /* Configure Output SGE for Encap/Decap */
DPAA2_SET_FLE_ADDR(sge, DPAA2_MBUF_VADDR_TO_IOVA(dst)); DPAA2_SET_FLE_ADDR(sge, DPAA2_MBUF_VADDR_TO_IOVA(dst));
DPAA2_SET_FLE_OFFSET(sge, sym_op->aead.data.offset + DPAA2_SET_FLE_OFFSET(sge, dst->data_off +
dst->data_off - auth_only_len); RTE_ALIGN_CEIL(auth_only_len, 16) - auth_only_len);
sge->length = sym_op->aead.data.length + auth_only_len; sge->length = sym_op->aead.data.length + auth_only_len;
if (sess->dir == DIR_ENC) { if (sess->dir == DIR_ENC) {