Checkpoint the party/runtime stack before share-program and malicious-mode work.
Ship the TLS mesh, composer, Beaver/Yao/leaf MPC, prep/online paths, apps, and docs so the tree is pushable before elevating share_expr, security_mode, and prep resume. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
695f8e84f7
commit
0d22946a0e
1835 changed files with 170291 additions and 2849 deletions
91
include/dpf/mesh_apps.hpp
Normal file
91
include/dpf/mesh_apps.hpp
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
/// @file dpf/mesh_apps.hpp
|
||||
/// @brief Micro-plan builders for PIRsona and hushmap on the edge mesh.
|
||||
#ifndef LIBDPF_INCLUDE_DPF_MESH_APPS_HPP__
|
||||
#define LIBDPF_INCLUDE_DPF_MESH_APPS_HPP__
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "dpf/compose.hpp"
|
||||
#include "dpf/pad_graphs.hpp"
|
||||
#include "dpf/protocol.hpp"
|
||||
|
||||
namespace dpf
|
||||
{
|
||||
namespace protocol
|
||||
{
|
||||
|
||||
/// @brief PIRsona: BitMore-shaped star fetch (L bit keys → 2^L servers).
|
||||
/// @details Returns upload+answer rounds for `n_servers = 1u << L`.
|
||||
inline std::vector<schedule_round> pirsona_bitmore_fetch(std::size_t L,
|
||||
std::size_t seed_bytes, std::size_t answer_bytes,
|
||||
const std::shared_ptr<std::vector<std::vector<std::uint8_t>>> & seeds,
|
||||
const std::shared_ptr<std::vector<std::vector<std::uint8_t>>> & answers)
|
||||
{
|
||||
const std::size_t n = std::size_t{1} << L;
|
||||
return star_upload_answer_graph(n, seed_bytes * L, answer_bytes, seeds,
|
||||
answers);
|
||||
}
|
||||
|
||||
/// @brief PIRsona one gradient-descent update: Du-Atallah mul graph (stub body).
|
||||
inline std::vector<schedule_round> pirsona_gd_update_graph(
|
||||
const std::shared_ptr<std::vector<std::uint8_t>> & tape)
|
||||
{
|
||||
return du_atallah_mul_graph(tape, /*slot_bytes=*/32);
|
||||
}
|
||||
|
||||
/// @brief Hushmap KHM ADD online skeleton: Beaver open + masked open rounds.
|
||||
/// @details Matches the barrier count of MPC_PROTOCOL-v3 Phase 1 (2 peer opens)
|
||||
/// after a dealer tape of `n_layers` triples has been spliced.
|
||||
inline std::vector<schedule_round> hushmap_add_online_graph(
|
||||
std::size_t n_layers, std::size_t open_bytes = 8)
|
||||
{
|
||||
(void)n_layers;
|
||||
std::vector<schedule_round> rounds(2);
|
||||
for (std::size_t r = 0; r < 2; ++r)
|
||||
{
|
||||
rounds[r].slot_bytes = open_bytes;
|
||||
rounds[r].edge = edge_peer;
|
||||
rounds[r].channel = edge_channel::peer;
|
||||
rounds[r].recv = receive_rule::domain_open;
|
||||
rounds[r].sink_round = static_cast<std::uint16_t>(r);
|
||||
rounds[r].produce = [open_bytes, r](std::size_t, const std::uint8_t *,
|
||||
std::size_t, std::uint8_t * out) {
|
||||
if (out != nullptr)
|
||||
std::memset(out, static_cast<int>(0x10 + r), open_bytes);
|
||||
};
|
||||
}
|
||||
return rounds;
|
||||
}
|
||||
|
||||
/// @brief Full hushmap ADD schedule: dealer tape then online opens.
|
||||
inline std::vector<schedule_round> hushmap_add_schedule(std::size_t n_layers,
|
||||
const std::shared_ptr<std::vector<std::uint8_t>> & tape,
|
||||
std::size_t triple_bytes = 24, std::size_t open_bytes = 8)
|
||||
{
|
||||
auto pads = dealer_tape_graph(n_layers, triple_bytes, tape);
|
||||
auto online = hushmap_add_online_graph(n_layers, open_bytes);
|
||||
// Online peer sink_rounds start at 0 on a peer-only sink after dealer
|
||||
// edges are separate — keep sink_round as assigned.
|
||||
return splice_rounds(std::move(pads), std::move(online));
|
||||
}
|
||||
|
||||
/// @brief Composer plan for a 2-server keyword-PIR-shaped client_servers flow.
|
||||
/// @details Prefer `n_server_pir_plan` / `keyword_pir_compose_plan` in
|
||||
/// [app_plans.hpp](@ref dpf/app_plans.hpp) for depth-derived sizes.
|
||||
inline plan keyword_pir_plan(std::size_t party, std::size_t query_bytes,
|
||||
std::size_t answer_bytes)
|
||||
{
|
||||
composer c(party);
|
||||
auto q = c.client_servers(2, query_bytes, answer_bytes);
|
||||
(void)q;
|
||||
return c.default_plan();
|
||||
}
|
||||
|
||||
} // namespace protocol
|
||||
} // namespace dpf
|
||||
|
||||
#endif // LIBDPF_INCLUDE_DPF_MESH_APPS_HPP__
|
||||
Loading…
Add table
Add a link
Reference in a new issue