Files
MP-SPDZ/Protocols/ShamirInput.h
2019-06-07 15:26:28 +10:00

62 lines
1.2 KiB
C++

/*
* ShamirInput.h
*
*/
#ifndef PROTOCOLS_SHAMIRINPUT_H_
#define PROTOCOLS_SHAMIRINPUT_H_
#include "Processor/Input.h"
#include "Shamir.h"
#include "ReplicatedInput.h"
template<class T>
class IndividualInput : public PrepLessInput<T>
{
protected:
Player& P;
vector<octetStream> os;
public:
IndividualInput(SubProcessor<T>* proc, Player& P) :
PrepLessInput<T>(proc), P(P)
{
}
IndividualInput(SubProcessor<T>& proc) :
PrepLessInput<T>(&proc), P(proc.P)
{
}
void reset(int player);
void add_other(int player);
void send_mine();
void finalize_other(int player, T& target, octetStream& o);
};
template<class T>
class ShamirInput : public IndividualInput<T>
{
friend class Shamir<typename T::clear>;
vector<vector<typename T::clear>> vandermonde;
SeededPRNG secure_prng;
vector<T> randomness;
public:
ShamirInput(SubProcessor<T>& proc, ShamirMC<T>& MC) :
IndividualInput<T>(proc)
{
(void) MC;
}
ShamirInput(SubProcessor<T>* proc, Player& P) :
IndividualInput<T>(proc, P)
{
}
void add_mine(const typename T::clear& input);
};
#endif /* PROTOCOLS_SHAMIRINPUT_H_ */