if (key_len) {
se_ctx->hmac = 1;
- memset(se_ctx->auth_key, 0, sizeof(se_ctx->auth_key));
+
+ se_ctx->auth_key = plt_zmalloc(key_len, 8);
+ if (se_ctx->auth_key == NULL)
+ return -1;
+
memcpy(se_ctx->auth_key, key, key_len);
se_ctx->auth_key_len = key_len;
memset(fctx->hmac.ipad, 0, sizeof(fctx->hmac.ipad));
struct roc_se_zuc_snow3g_ctx zs_ctx;
struct roc_se_kasumi_ctx k_ctx;
} se_ctx;
- uint8_t auth_key[1024];
+ uint8_t *auth_key;
};
int __roc_api roc_se_auth_key_set(struct roc_se_ctx *se_ctx,
if ((sess_priv->roc_se_ctx.fc_type == ROC_SE_HASH_HMAC) &&
cpt_mac_len_verify(&xform->auth)) {
plt_dp_err("MAC length is not supported");
+ if (sess_priv->roc_se_ctx.auth_key != NULL) {
+ plt_free(sess_priv->roc_se_ctx.auth_key);
+ sess_priv->roc_se_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 cnxk_se_sess *sess_priv;
struct rte_mempool *pool;
if (priv == NULL)
return;
+ sess_priv = priv;
+
+ if (sess_priv->roc_se_ctx.auth_key != NULL)
+ plt_free(sess_priv->roc_se_ctx.auth_key);
+
memset(priv, 0, cnxk_cpt_sym_session_get_size(NULL));
pool = rte_mempool_from_obj(priv);
i = 0;
if (ctx->hmac) {
- uint64_t k_vaddr = (uint64_t)params->ctx_buf.vaddr +
- offsetof(struct roc_se_ctx, auth_key);
+ uint64_t k_vaddr = (uint64_t)ctx->auth_key;
/* Key */
i = fill_sg_comp(gather_comp, i, k_vaddr,
RTE_ALIGN_CEIL(key_len, 8));