forked from WeDPR-Team/MP-SPDZ
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Multiplier.h
58 lines (47 loc) · 1.49 KB
/
Multiplier.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
* Multiplier.h
*
*/
#ifndef FHEOFFLINE_MULTIPLIER_H_
#define FHEOFFLINE_MULTIPLIER_H_
#include "FHEOffline/SimpleEncCommit.h"
#include "FHE/AddableVector.h"
#include "Tools/MemoryUsage.h"
#include "OT/BaseOT.h"
template <class FD>
using PlaintextVector = AddableVector< Plaintext_<FD> >;
template <class FD>
class PairwiseGenerator;
class PairwiseMachine;
template <class FD>
class Multiplier
{
PairwiseMachine& machine;
OffsetPlayer P;
int num_players, my_num;
const FHE_PK& other_pk;
const Ciphertext& other_enc_alpha;
map<string, Timer>& timers;
// temporary
Ciphertext C, mask;
Plaintext_<FD> product_share;
Random_Coins rc;
size_t volatile_capacity;
MemoryUsage memory_usage;
octetStream o;
public:
Multiplier(int offset, PairwiseGenerator<FD>& generator);
Multiplier(int offset, PairwiseMachine& machine, Player& P,
map<string, Timer>& timers);
void multiply_and_add(Plaintext_<FD>& res, const Ciphertext& C,
const Plaintext_<FD>& b);
void multiply_and_add(Plaintext_<FD>& res, const Ciphertext& C,
const Rq_Element& b, OT_ROLE role = BOTH);
void multiply_alpha_and_add(Plaintext_<FD>& res, const Rq_Element& b,
OT_ROLE role = BOTH);
int get_offset() { return P.get_offset(); }
size_t report_size(ReportType type);
void report_size(ReportType type, MemoryUsage& res);
size_t report_volatile() { return volatile_capacity; }
};
#endif /* FHEOFFLINE_MULTIPLIER_H_ */