mc_zuc_snow3g_ctx_t zs_ctx;
mc_kasumi_ctx_t k_ctx;
} mc_ctx;
- uint8_t auth_key[1024];
+ uint8_t *auth_key;
+ uint64_t auth_key_iova;
};
/* Prime and order fields of built-in elliptic curves */
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));
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));
if ((GET_SESS_FC_TYPE(misc) == HASH_HMAC) &&
cpt_mac_len_verify(&temp_xform->auth)) {
CPT_LOG_ERR("MAC length is not supported");
+ struct cpt_ctx *ctx = SESS_PRIV(misc);
+ if (ctx->auth_key != NULL) {
+ rte_free(ctx->auth_key);
+ ctx->auth_key = NULL;
+ }
ret = -ENOTSUP;
goto priv_put;
}
sym_session_clear(int driver_id, struct rte_cryptodev_sym_session *sess)
{
void *priv = get_sym_session_private_data(sess, driver_id);
+ struct cpt_sess_misc *misc;
struct rte_mempool *pool;
+ struct cpt_ctx *ctx;
if (priv == NULL)
return;
+ misc = priv;
+ ctx = SESS_PRIV(misc);
+
+ if (ctx->auth_key != NULL)
+ rte_free(ctx->auth_key);
+
memset(priv, 0, cpt_get_session_size());
pool = rte_mempool_from_obj(priv);
if ((GET_SESS_FC_TYPE(misc) == HASH_HMAC) &&
cpt_mac_len_verify(&temp_xform->auth)) {
CPT_LOG_ERR("MAC length is not supported");
+ struct cpt_ctx *ctx = SESS_PRIV(misc);
+ if (ctx->auth_key != NULL) {
+ rte_free(ctx->auth_key);
+ ctx->auth_key = NULL;
+ }
ret = -ENOTSUP;
goto priv_put;
}
sym_session_clear(int driver_id, struct rte_cryptodev_sym_session *sess)
{
void *priv = get_sym_session_private_data(sess, driver_id);
+ struct cpt_sess_misc *misc;
struct rte_mempool *pool;
+ struct cpt_ctx *ctx;
if (priv == NULL)
return;
+ misc = priv;
+ ctx = SESS_PRIV(misc);
+
+ if (ctx->auth_key != NULL)
+ rte_free(ctx->auth_key);
+
memset(priv, 0, cpt_get_session_size());
pool = rte_mempool_from_obj(priv);