Skip to content

Commit

Permalink
crypto/qat: fix offset for out-of-place scatter-gather
Browse files Browse the repository at this point in the history
[ upstream commit 935da45 ]

This commit fixes problem with to small offset when both offsets
(auth, cipher) are non zero in digest encrypt case,
when using out-of-place and sgl.

Fixes: 40002f6 ("crypto/qat: extend support for digest-encrypted auth-cipher")

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
Acked-by: Declan Doherty <declan.doherty@intel.com>
  • Loading branch information
arekk67 authored and steevenlee committed May 8, 2021
1 parent ce88f40 commit acbb986
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/crypto/qat/qat_sym.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg,
uint8_t do_sgl = 0;
uint8_t in_place = 1;
int alignment_adjustment = 0;
int oop_shift = 0;
struct rte_crypto_op *op = (struct rte_crypto_op *)in_op;
struct qat_sym_op_cookie *cookie =
(struct qat_sym_op_cookie *)op_cookie;
Expand Down Expand Up @@ -472,6 +473,7 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg,
rte_pktmbuf_iova_offset(op->sym->m_src, min_ofs);
dst_buf_start =
rte_pktmbuf_iova_offset(op->sym->m_dst, min_ofs);
oop_shift = min_ofs;

} else {
/* In-place operation
Expand Down Expand Up @@ -532,7 +534,7 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg,
/* First find the end of the data */
if (do_sgl) {
uint32_t remaining_off = auth_param->auth_off +
auth_param->auth_len + alignment_adjustment;
auth_param->auth_len + alignment_adjustment + oop_shift;
struct rte_mbuf *sgl_buf =
(in_place ?
op->sym->m_src : op->sym->m_dst);
Expand Down

0 comments on commit acbb986

Please sign in to comment.