19 #ifndef __ITPARAMS_H__
20 #define __ITPARAMS_H__
26 #include <PolyCommitCommon.h>
37 ZZ modulus, nservers_t
tau = 0,
char * pcparams_file = NULL,
41 ZZ_pParams (dbsize_t num_blocks, dbsize_t block_size, dbsize_t word_size,
42 unsigned long modulus_bits, nservers_t
tau = 0,
46 ZZ_pParams (dbsize_t num_blocks, dbsize_t block_size, dbsize_t word_size,
51 unsigned long modulus_bytes()
const {
52 return NumBytes(modulus);
54 unsigned long modulussq_bytes()
const {
55 return NumBytes(modulus*modulus);
57 void mod_modulus()
const {
60 void mod_modulussq()
const {
63 const ZZ &get_modulus()
const {
66 const ZZ_p &get_g()
const {
70 return hybrid_protection;
75 bool modulus_match(ZZ testmod)
const {
76 return modulus == testmod;
78 char * get_pcparams_filename()
const {
79 return pcparams_filename;
82 PolyCommitParams * get_pcparamsp()
const {
91 ZZ_p encrypt(ZZ plaintext)
const {
94 return power(g, plaintext) * power(r, modulus);
98 ZZ_p decrypt(ZZ_p ciphertext)
const {
100 ZZ Lval = rep(power(ciphertext, lambda) - 1) / modulus;
102 ZZ_p ret = to_ZZ_p(Lval) * mu;
105 ZZ get_p1()
const {
return p1; }
106 ZZ get_p2()
const {
return p2; }
109 virtual dbsize_t
request_size (nqueries_t num_queries = 1)
const;
110 virtual dbsize_t
response_size (nqueries_t num_queries = 1)
const;
114 std::vector<Dimension> worker_dims)
const;
118 virtual void write (std::ostream &os)
const;
124 void create_ZZ_pContexts();
125 bool hybrid_protection;
127 ZZ_pContext modctx, modsqctx;
131 char * pcparams_filename;
133 PolyCommitParams * pcparamsp;
136 void init_hybrid(ZZ p, ZZ q);
146 GF2EParams (dbsize_t num_blocks, dbsize_t block_size,
147 dbsize_t word_size = 8, nservers_t
tau = 0,
153 virtual dbsize_t
request_size (nqueries_t num_queries = 1)
const;
154 virtual dbsize_t
response_size (nqueries_t num_queries = 1)
const;
158 std::vector<Dimension> worker_dims)
const;
164 ChorParams (dbsize_t num_blocks, dbsize_t block_size,
170 virtual dbsize_t
request_size (nqueries_t num_queries = 1)
const;
171 virtual dbsize_t
response_size (nqueries_t num_queries = 1)
const;
175 std::vector<Dimension> worker_dims)
const;
nservers_t tau() const
Get the level of tau-independence.
Definition: percyparams.h:117
dbsize_t word_size() const
Get the word size used to split blocks.
Definition: percyparams.h:110
virtual dbsize_t request_size(nqueries_t num_queries=1) const
Get the size of a client to server request.
virtual std::vector< const PercyParams * > create_worker_params(std::vector< Dimension > worker_dims) const
Create protocol parameters for threads/workers.
virtual std::vector< const PercyParams * > create_worker_params(std::vector< Dimension > worker_dims) const
Create protocol parameters for threads/workers.
This header contains typedefs for seamless switching between 32- and 64-bit builds of Percy++...
virtual dbsize_t response_size(nqueries_t num_queries=1) const
Get the size of a server to client response.
virtual dbsize_t response_size(nqueries_t num_queries=1) const
Get the size of a server to client response.
dbsize_t _block_size
Size of database blocks in bytes.
Definition: percyparams.h:170
dbsize_t words_per_block() const
Get the number of words per database block.
Definition: percyparams.h:112
virtual dbsize_t response_size(nqueries_t num_queries=1) const
Get the size of a server to client response.
virtual void write(std::ostream &os) const
Write the parameters to a stream to check compatibility.
dbsize_t virtual_block_size() const
Get the number of actual blocks in a virtual block when being used as one iteration of a recursive pr...
Definition: percyparams.h:123
dbsize_t num_blocks() const
Get the number of blocks in the database.
Definition: percyparams.h:102
An abstract base class for a protocol's parameters.
Definition: percyparams.h:80
Definition: itparams.h:162
virtual dbsize_t request_size(nqueries_t num_queries=1) const
Get the size of a client to server request.
Definition: itparams.h:33
virtual bool check_compatible(std::istream &is) const
Read the parameters from a stream (as written by write()) and check that they are compatible with the...
virtual dbsize_t request_size(nqueries_t num_queries=1) const
Get the size of a client to server request.
virtual std::vector< const PercyParams * > create_worker_params(std::vector< Dimension > worker_dims) const
Create protocol parameters for threads/workers.
virtual dbsize_t server_block_size() const
Get the size of each block in the database that the datastore will actually use.
Definition: itparams.h:86
nservers_t _tau
Level of tau-independence.
Definition: percyparams.h:178
dbsize_t block_size() const
Get the size of each block in the database in bytes.
Definition: percyparams.h:104
Defines the basic structure of protocol parameters (PercyParams), client parameters (PercyClientParam...
Definition: itparams.h:144