static int put_method_in_store(OPENSSL_CTX *libctx, void *store,
                               void *method, const OSSL_PROVIDER *prov,
                               int operation_id, const char *name,
                               const char *propdef, void *data)
{
    struct method_data_st *methdata = data;
    OSSL_NAMEMAP *namemap;
    int name_id;
    uint32_t meth_id;

    /*
     * put_method_in_store() is only called with a method that was
     * successfully created by construct_method() below, which means
     * the name should already be stored in the namemap, so just use it.
     */
    if ((namemap = ossl_namemap_stored(libctx)) == NULL
        || (name_id = ossl_namemap_name2num(namemap, name)) == 0
        || (meth_id = method_id(operation_id, name_id)) == 0)
        return 0;

    if (store == NULL
        && (store = get_default_method_store(libctx)) == NULL)
        return 0;

    return ossl_method_store_add(store, prov, meth_id, propdef, method,
                                 methdata->refcnt_up_method,
                                 methdata->destruct_method);
}