Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the -f parameter in the SoftSpokenOT example #130

Merged
merged 1 commit into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 12 additions & 19 deletions frontend/ExampleTwoChooseOne.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,34 +32,29 @@ namespace osuCrypto
#ifdef ENABLE_SOFTSPOKEN_OT
// soft spoken takes an extra parameter as input what determines
// the computation/communication trade-off.
template<typename T>
template <typename T>
using is_SoftSpoken = typename std::conditional<
//std::is_same<T, SoftSpokenShOtSender>::value ||
//std::is_same<T, SoftSpokenShOtReceiver>::value ||
//std::is_same<T, SoftSpokenShOtSender>::value ||
//std::is_same<T, SoftSpokenShOtReceiver>::value ||
//std::is_same<T, SoftSpokenMalOtSender>::value ||
//std::is_same<T, SoftSpokenMalOtReceiver>::value ||
//std::is_same<T, SoftSpokenMalOtSender>::value ||
//std::is_same<T, SoftSpokenMalOtReceiver>::value
false
,
std::true_type, std::false_type>::type;
std::is_same<T, SoftSpokenShOtSender<>>::value ||
std::is_same<T, SoftSpokenShOtReceiver<>>::value ||
std::is_same<T, SoftSpokenMalOtSender>::value ||
std::is_same<T, SoftSpokenMalOtReceiver>::value,
std::true_type,
std::false_type>::type;
#else
template<typename T>
template <typename T>
using is_SoftSpoken = std::false_type;
#endif

template<typename T>
typename std::enable_if<is_SoftSpoken<T>::value, T>::type
construct(CLP& cmd)
construct(const CLP& cmd)
{
return T(cmd.getOr("f", 2));
}

template<typename T>
typename std::enable_if<!is_SoftSpoken<T>::value, T>::type
construct(CLP& cmd)
construct(const CLP& cmd)
{
return T{};
}
Expand All @@ -79,10 +74,8 @@ namespace osuCrypto

PRNG prng(sysRandomSeed());


OtExtSender sender;
OtExtRecver receiver;

OtExtSender sender = construct<OtExtSender>(cmd);
OtExtRecver receiver = construct<OtExtRecver>(cmd);

#ifdef LIBOTE_HAS_BASE_OT
// Now compute the base OTs, we need to set them on the first pair of extenders.
Expand Down
13 changes: 13 additions & 0 deletions libOTe/TwoChooseOne/SoftSpokenOT/SoftSpokenMalOtExt.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ namespace osuCrypto
SoftSpokenMalOtSender() {
init();
}

SoftSpokenMalOtSender(u64 fieldBits)
{
init(fieldBits);
}

SoftSpokenMalOtSender(SoftSpokenMalOtSender&& o) = default;
SoftSpokenMalOtSender& operator=(SoftSpokenMalOtSender&& o) = default;

Expand Down Expand Up @@ -285,6 +291,13 @@ namespace osuCrypto
{
init();
}

SoftSpokenMalOtReceiver(u64 fieldBits)
{
init(fieldBits);
}


SoftSpokenMalOtReceiver(SoftSpokenMalOtReceiver&& o)
:mBase(std::move(o.mBase))
,mExtraV(std::move(o.mExtraV))
Expand Down
11 changes: 11 additions & 0 deletions libOTe/TwoChooseOne/SoftSpokenOT/SoftSpokenShOtExt.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ namespace osuCrypto
init();
}

SoftSpokenShOtSender(u64 fieldBits)
{
init(fieldBits);
}

SoftSpokenShOtSender(SoftSpokenShOtSender&& o)
: mSubVole(std::move(o.mSubVole))
, mBlockIdx(std::exchange(o.mBlockIdx, 0))
Expand Down Expand Up @@ -281,6 +286,12 @@ namespace osuCrypto
{
init();
}

SoftSpokenShOtReceiver(u64 fieldBits)
{
init(fieldBits);
}

SoftSpokenShOtReceiver(const SoftSpokenShOtReceiver&) = delete;
SoftSpokenShOtReceiver(SoftSpokenShOtReceiver&& o)
: mSubVole(std::move(o.mSubVole))
Expand Down
Loading