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
61
examples/applications/floram.cpp
Normal file
61
examples/applications/floram.cpp
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
#include <cstdint>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
#include "dpf.hpp"
|
||||
#include "dpf/app_flow.hpp"
|
||||
#include "dpf/app_plans.hpp"
|
||||
|
||||
// Floram, the FSS read and write (Doerner and shelat, CCS 2017). Both
|
||||
// parties see the memory. The address is secret-shared, so keygen is
|
||||
// Doerner–Shelat rather than a dealer who knows the index. The read is
|
||||
// the inner product of a unit key with that memory. The write adds a
|
||||
// payload key, built from the same address shares, into subtractive
|
||||
// copies of the array.
|
||||
//
|
||||
// c++ -std=c++17 -march=native -I include -I thirdparty \
|
||||
// examples/applications/floram.cpp
|
||||
|
||||
int main()
|
||||
{
|
||||
constexpr std::size_t n = 256;
|
||||
constexpr std::uint8_t address = 42;
|
||||
constexpr std::uint8_t a0 = 0x15;
|
||||
constexpr std::uint8_t a1 = static_cast<std::uint8_t>(address ^ a0);
|
||||
constexpr std::uint64_t message = 9;
|
||||
|
||||
std::vector<std::uint64_t> memory(n);
|
||||
memory[address] = 100;
|
||||
memory[7] = 3;
|
||||
|
||||
auto [r0, r1] = dpf::make_dpf_doerner_shelat(a0, a1, std::uint64_t{1});
|
||||
const auto word = dpf::reconstruct(
|
||||
dpf::eval_full_inner_product(dpf::paired, r0, memory),
|
||||
dpf::eval_full_inner_product(dpf::paired, r1, memory));
|
||||
if (word != memory[address])
|
||||
{
|
||||
std::cerr << "floram read\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
auto [w0, w1] = dpf::make_dpf_doerner_shelat(a0, a1, message);
|
||||
std::vector<std::uint64_t> s0 = memory;
|
||||
std::vector<std::uint64_t> s1(n);
|
||||
dpf::eval_full_add_into(s0, w0);
|
||||
dpf::eval_full_add_into(s1, w1);
|
||||
if (s0[address] - s1[address] != memory[address] + message
|
||||
|| s0[7] - s1[7] != memory[7])
|
||||
{
|
||||
std::cerr << "floram write\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
{
|
||||
if (int rc = dpf::app::run_measured("floram",
|
||||
dpf::protocol::floram_ds_plan(0), 40))
|
||||
return rc;
|
||||
}
|
||||
|
||||
std::cout << word << "\n";
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue