> diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
> b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
> index 50ee140ccd..308775882c 100644
> --- a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
> +++ b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c
> @@ -453,3 +453,61 @@ void
>  ipsec_mb_sym_session_clear(struct rte_cryptodev *dev __rte_unused,
>               struct rte_cryptodev_sym_session *sess __rte_unused)  {}
> +
> +/** Configure pmd specific multi-buffer asym session from a crypto
> +xform chain */ int ipsec_mb_asym_session_configure(
> +     struct rte_cryptodev *dev, struct rte_crypto_asym_xform *xform,
> +     struct rte_cryptodev_asym_session *sess) {
> +     struct ipsec_mb_dev_private *internals = dev->data->dev_private;
> +     struct ipsec_mb_internals *pmd_data =
> +             &ipsec_mb_pmds[internals->pmd_type];
> +     struct ipsec_mb_qp *qp = dev->data->queue_pairs[0];
> +     IMB_MGR *mb_mgr;
> +     int ret = 0;
> +
> +     if (qp != NULL)
> +             mb_mgr = qp->mb_mgr;
> +     else
> +             mb_mgr = alloc_init_mb_mgr();
> +
> +     if (!mb_mgr)
> +             return -ENOMEM;
> +
> +     if (unlikely(sess == NULL)) {
> +             IPSEC_MB_LOG(ERR, "invalid session struct");
> +             if (qp == NULL)
> +                     free_mb_mgr(mb_mgr);
> +             return -EINVAL;
> +     }
> +
> +     ret = (*pmd_data->asym_session_configure)(mb_mgr,
> +                     CRYPTODEV_GET_ASYM_SESS_PRIV(sess), xform);
> +     if (ret != 0) {
> +             IPSEC_MB_LOG(ERR, "failed configure asym session
> parameters");
> +
> +             /* Return session to mempool */
> +             if (qp == NULL)
> +                     free_mb_mgr(mb_mgr);
> +             return ret;
> +     }
> +
> +     if (qp == NULL)
> +             free_mb_mgr(mb_mgr);
> +
> +     pmd_data->asym_session_created = true;
> +     return 0;
> +}
The IMB_ML_KEM/DSA contexts maintain a pointer to the mb_mgr passed when they 
are initialized.
Could the mb_mgr passed to asym_session_configure(mb_mgr,...) be free'd in this 
function and the ML-KEM/DSA contexts be used later?
If so, then that won't work as all ipsec-mb ML-KEM/DSA APIs will use the 
original mb_mgr internally after its had been free'd.
See: 
https://github.com/intel/intel-ipsec-mb/blob/5d1f646e5011183725329694edfcf8b645f9c1e6/lib/x86_64/ml_dsa/imb_ml_dsa_api.c#L16

Reply via email to