On Fri, 29 May 2026 14:43:26 +0530
Gowrishankar Muthukrishnan <[email protected]> wrote:
> +
> +int
> +roc_re_ml_zeta_get(uint64_t *tbl)
> +{
> + int len = (RE_MLKEM_ZETA_LEN + RE_MLDSA_ZETA_LEN);
Unneeded paraens.
> + const char name[] = RE_ML_TBL_NAME;
> + const struct plt_memzone *mz;
> + struct re_ml_tbl *ml;
> + uint8_t *data;
> +
> + if (tbl == NULL)
> + return -EINVAL;
> +
> + mz = plt_memzone_lookup(name);
> + if (mz == NULL) {
> + /* Create memzone first time */
> + mz = plt_memzone_reserve_cache_align(name, sizeof(struct
> re_ml_tbl) + len);
> + if (mz == NULL)
> + return -ENOMEM;
> + }
> +
> + ml = (struct re_ml_tbl *)mz->addr;
mz->addr is void * so cast here is unnecessary.
> + if (plt_atomic_fetch_add_explicit(&ml->refcount, 1,
> plt_memory_order_seq_cst) != 0)
> + return 0;
> +
> + data = PLT_PTR_ADD(mz->addr, sizeof(uint64_t));
> + memcpy(data, re_ml_zeta_tbl[0].data, re_ml_zeta_tbl[0].len);
> + tbl[0] = plt_cpu_to_be_64((uintptr_t)data);
> +
> + data = PLT_PTR_ADD(data, re_ml_zeta_tbl[0].len);
> + memcpy(data, re_ml_zeta_tbl[1].data, re_ml_zeta_tbl[1].len);
> + tbl[1] = plt_cpu_to_be_64((uintptr_t)data);
> +
> + return 0;
> +}