Skip to content

Commit

Permalink
Random bit generation in Rep4.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkskeller committed Apr 4, 2024
1 parent 14410db commit f4b5ad2
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 4 deletions.
33 changes: 33 additions & 0 deletions GC/Rep4Prep.cpp
Original file line number Diff line number Diff line change
@@ -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 changes: 28 additions & 0 deletions GC/Rep4Prep.h
Original file line number Diff line number Diff line change
@@ -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_ */
4 changes: 3 additions & 1 deletion GC/Rep4Secret.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions Machines/Rep4.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions Machines/rep4-ring-party.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions Protocols/Rep4.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

#include "Rep4.h"
#include "GC/square64.h"
#include "Processor/TruncPrTuple.h"

template<class T>
Expand Down

0 comments on commit f4b5ad2

Please sign in to comment.