Random bit generation in Rep4.

This commit is contained in:
Marcel Keller
2024-04-04 12:38:29 +11:00
parent 14410dbe10
commit f4b5ad2da9
7 changed files with 71 additions and 4 deletions

33
GC/Rep4Prep.cpp Normal file
View File

@@ -0,0 +1,33 @@
/*
* Rep4Prep.cpp
*
*/
#include "Rep4Prep.h"
#include "Protocols/Rep4.hpp"
#include "Protocols/Rep4Input.hpp"
#include "Protocols/ReplicatedPrep.hpp"
namespace GC
{
Rep4Prep::Rep4Prep(DataPositions& usage, int) :
BufferPrep<Rep4Secret>(usage)
{
}
void Rep4Prep::set_protocol(Rep4Secret::Protocol& protocol)
{
this->P = &protocol.P;
}
void Rep4Prep::buffer_bits()
{
assert(P);
Rep4<Rep4Secret> proto(*P);
for (int i = 0; i < OnlineOptions::singleton.batch_size; i++)
this->bits.push_back(proto.get_random() & 1);
}
} /* namespace GC */

28
GC/Rep4Prep.h Normal file
View File

@@ -0,0 +1,28 @@
/*
* Rep4Prep.h
*
*/
#ifndef GC_REP4PREP_H_
#define GC_REP4PREP_H_
#include "Rep4Secret.h"
#include "PersonalPrep.h"
#include "Protocols/ReplicatedPrep.h"
namespace GC
{
class Rep4Prep : public BufferPrep<Rep4Secret>
{
public:
Rep4Prep(DataPositions& usage, int _ = -1);
void set_protocol(Rep4Secret::Protocol& protocol);
void buffer_bits();
};
} /* namespace GC */
#endif /* GC_REP4PREP_H_ */

View File

@@ -13,13 +13,15 @@
namespace GC
{
class Rep4Prep;
class Rep4Secret : public RepSecretBase<Rep4Secret, 3>
{
typedef RepSecretBase<Rep4Secret, 3> super;
typedef Rep4Secret This;
public:
typedef DummyLivePrep<This> LivePrep;
typedef Rep4Prep LivePrep;
typedef Rep4<This> Protocol;
typedef Rep4MC<This> MC;
typedef MC MAC_Check;

View File

@@ -7,6 +7,7 @@
#define MACHINES_REP4_HPP_
#include "GC/Rep4Secret.h"
#include "GC/Rep4Prep.h"
#include "Protocols/Rep4Share2k.h"
#include "Protocols/Rep4Prep.h"
#include "Protocols/Rep4.hpp"

View File

@@ -10,6 +10,7 @@
#include "Math/gf2n.h"
#include "Tools/ezOptionParser.h"
#include "GC/Rep4Secret.h"
#include "GC/Rep4Prep.h"
#include "Processor/RingOptions.h"
#include "Processor/RingMachine.hpp"

View File

@@ -247,17 +247,18 @@ mama-party.x: $(TINIER)
ps-rep-ring-party.x: Protocols/MalRepRingOptions.o
malicious-rep-ring-party.x: Protocols/MalRepRingOptions.o
sy-rep-ring-party.x: Protocols/MalRepRingOptions.o
rep4-ring-party.x: GC/Rep4Secret.o
rep4-ring-party.x: GC/Rep4Secret.o GC/Rep4Prep.o
no-party.x: Protocols/ShareInterface.o
semi-ecdsa-party.x: $(OT) $(LIBSIMPLEOT) $(GC_SEMI)
mascot-ecdsa-party.x: $(OT) $(LIBSIMPLEOT)
rep4-ecdsa-party.x: GC/Rep4Prep.o
fake-spdz-ecdsa-party.x: $(OT) $(LIBSIMPLEOT)
emulate.x: GC/FakeSecret.o
semi-bmr-party.x: $(GC_SEMI) $(OT)
real-bmr-party.x: $(OT)
paper-example.x: $(VM) $(OT) $(FHEOFFLINE)
binary-example.x: $(VM) $(OT) GC/PostSacriBin.o $(GC_SEMI) GC/AtlasSecret.o
mixed-example.x: $(VM) $(OT) GC/PostSacriBin.o $(GC_SEMI) GC/AtlasSecret.o Machines/Tinier.o
binary-example.x: $(VM) $(OT) GC/PostSacriBin.o $(GC_SEMI) GC/AtlasSecret.o GC/Rep4Prep.o
mixed-example.x: $(VM) $(OT) GC/PostSacriBin.o $(GC_SEMI) GC/AtlasSecret.o GC/Rep4Prep.o Machines/Tinier.o
l2h-example.x: $(VM) $(OT) Machines/Tinier.o
he-example.x: $(FHEOFFLINE)
mascot-offline.x: $(VM) $(TINIER)

View File

@@ -4,6 +4,7 @@
*/
#include "Rep4.h"
#include "GC/square64.h"
#include "Processor/TruncPrTuple.h"
template<class T>