Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/osu-crypto/libOTe
Browse files Browse the repository at this point in the history
  • Loading branch information
ladnir committed Jan 23, 2024
2 parents 9b07475 + 7107a4e commit f86a58d
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 19 deletions.
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

0 comments on commit f86a58d

Please sign in to comment.