if (cpt_ctx->fc_type == FC_GEN) {
/*
* We need to always say IV is from DPTR as user can
- * sometimes iverride IV per operation.
+ * sometimes override IV per operation.
*/
fctx->enc.iv_source = CPT_FROM_DPTR;
i = 0;
if (ctx->hmac) {
- uint64_t k_dma = params->ctx_buf.dma_addr +
- offsetof(struct cpt_ctx, auth_key);
+ uint64_t k_dma = ctx->auth_key_iova;
/* Key */
i = fill_sg_comp(gather_comp, i, k_dma,
RTE_ALIGN_CEIL(key_len, 8));
/* consider iv len */
encr_offset += iv_len;
- inputlen = iv_len + (RTE_ALIGN(encr_data_len, 8) / 8);
+ inputlen = encr_offset + (RTE_ALIGN(encr_data_len, 8) / 8);
outputlen = inputlen;
/* save space for offset ctrl & iv */
if (key_len) {
cpt_ctx->hmac = 1;
- memset(cpt_ctx->auth_key, 0, sizeof(cpt_ctx->auth_key));
+
+ cpt_ctx->auth_key = rte_zmalloc(NULL, key_len, 8);
+ if (cpt_ctx->auth_key == NULL)
+ return -1;
+
+ cpt_ctx->auth_key_iova = rte_mem_virt2iova(cpt_ctx->auth_key);
memcpy(cpt_ctx->auth_key, key, key_len);
cpt_ctx->auth_key_len = key_len;
memset(fctx->hmac.ipad, 0, sizeof(fctx->hmac.ipad));
tailroom = rte_pktmbuf_tailroom(pkt);
if (likely((headroom >= 24) &&
(tailroom >= 8))) {
- /* In 83XX this is prerequivisit for Direct mode */
+ /* In 83XX this is prerequisite for Direct mode */
*flags |= SINGLE_BUF_HEADTAILROOM;
}
param->bufs[0].vaddr = seg_data;