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;