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
87
test/tests/beaver_party_test.cpp
Normal file
87
test/tests/beaver_party_test.cpp
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
#include <gtest/gtest.h>
|
||||
|
||||
#include <cctype>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "cases.hpp"
|
||||
#include "registry.hpp"
|
||||
#include "spawn.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
class PartyFlowTest : public ::testing::TestWithParam<std::string>
|
||||
{
|
||||
};
|
||||
|
||||
TEST_P(PartyFlowTest, Trio)
|
||||
{
|
||||
dpf::party::register_all_flows();
|
||||
const auto & name = GetParam();
|
||||
const auto * f = dpf::party::find_flow(name);
|
||||
ASSERT_NE(f, nullptr) << name;
|
||||
// IKNP replaces the dealer. Spawning p2 makes that role call a keygen
|
||||
// that refuses `role::p2` (`iknp point/comparison keygen has no dealer`).
|
||||
const bool pair = dpf::party::flow_is_pair(*f);
|
||||
auto r = pair ? dpf::party::spawn_pair_flow(name)
|
||||
: dpf::party::spawn_trio_flow(name);
|
||||
EXPECT_EQ(r.rc[0], 0) << "p0 failed for " << name;
|
||||
EXPECT_EQ(r.rc[1], 0) << "p1 failed for " << name;
|
||||
if (!pair)
|
||||
EXPECT_EQ(r.rc[2], 0) << "p2 failed for " << name;
|
||||
else
|
||||
EXPECT_EQ(r.rc[2], 0) << "pair spawn must not report a dealer";
|
||||
}
|
||||
|
||||
std::vector<std::string> all_flow_names()
|
||||
{
|
||||
dpf::party::register_all_flows();
|
||||
std::vector<std::string> names;
|
||||
for (const auto * f : dpf::party::select_flows({}))
|
||||
names.emplace_back(f->name);
|
||||
return names;
|
||||
}
|
||||
|
||||
TEST(PartyFlow, PairFlowsAreTheIknpOnes)
|
||||
{
|
||||
dpf::party::register_all_flows();
|
||||
int pairs = 0;
|
||||
int trios = 0;
|
||||
for (const auto * f : dpf::party::select_flows({}))
|
||||
{
|
||||
ASSERT_NE(f, nullptr);
|
||||
ASSERT_NE(f->name, nullptr);
|
||||
const std::string name = f->name;
|
||||
const bool iknp = name.rfind("iknp_", 0) == 0
|
||||
|| dpf::party::flow_has_tag(*f, "iknp");
|
||||
EXPECT_EQ(dpf::party::flow_is_pair(*f), iknp) << name;
|
||||
if (iknp)
|
||||
{
|
||||
++pairs;
|
||||
EXPECT_EQ(name.rfind("iknp_", 0), 0u) << name;
|
||||
}
|
||||
else
|
||||
{
|
||||
++trios;
|
||||
}
|
||||
}
|
||||
EXPECT_GE(pairs, 5);
|
||||
EXPECT_GT(trios, pairs);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
AllFlows,
|
||||
PartyFlowTest,
|
||||
::testing::ValuesIn(all_flow_names()),
|
||||
[](const auto & info) {
|
||||
std::string n = info.param;
|
||||
for (char & c : n)
|
||||
{
|
||||
if (!(std::isalnum(static_cast<unsigned char>(c)) || c == '_'))
|
||||
c = '_';
|
||||
}
|
||||
return n;
|
||||
});
|
||||
|
||||
} // namespace
|
||||
Loading…
Add table
Add a link
Reference in a new issue