Percy++
A C++ implementation of Private Information Retrieval (PIR) protocols
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
spirserver.h
1 // Percy++ Copyright 2007,2012,2013,2014
2 // Ian Goldberg <iang@cs.uwaterloo.ca>,
3 // Casey Devet <cjdevet@uwaterloo.ca>
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of version 2 of the GNU General Public License as
7 // published by the Free Software Foundation.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // There is a copy of the GNU General Public License in the COPYING file
15 // packaged with this plugin; if you cannot find it, write to the Free
16 // Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 // 02110-1301 USA
18 
19 #ifndef __SPIRSERVER_H__
20 #define __SPIRSERVER_H__
21 
22 #include <vector>
23 #include <NTL/ZZ_pX.h>
24 #include <NTL/vec_vec_ZZ_p.h>
25 #include "../PolyCommit/PolyCommitCommon.h"
26 #include "pspir_crypt.h"
27 
28 #include "percyparams.h"
29 
30 // This class is used to do the *server-side* work for the SPIR protocol.
32 public:
33  SPIRServerQuery ();
34  ~SPIRServerQuery ();
35 
36  SPIRServerQuery (const SPIRServerQuery &other);
37  SPIRServerQuery& operator= (SPIRServerQuery other);
38 
39  // Read the required input from the client
40  bool read_spir_input (PercyServerParams * params, std::istream &is);
41 
42  // Verify the query
43  bool query_verification (PercyServerParams * params, vec_ZZ_p &inputvector);
44 
45  // Initialize the randomization
46  bool init_randomization (PercyServerParams * params, unsigned char * prng_seed);
47 
48  // Add randomization to the reponse
49  bool randomize_response (vec_ZZ_p &response);
50 
51 private:
52  // Progress
53  enum Progress {
54  PROGRESS_NONE,
55  PROGRESS_READ_INPUT,
56  PROGRESS_VERIFICATION,
57  PROGRESS_INIT_RANDOM
58  };
59  Progress progress;
60 
61  vec_G1 commitvec;
62  G1 witness, witness_prime;
63  uint64_t a_r;
64  bool z;
65  G1 C_a_prime;
66  GT D, D_prime;
67  G1 eta_1, eta_2, eta_3;
68  GT eta_4, eta_5, eta_6;
69  ZZ_p v_0, v_1, v_2, v_3;
70  vec_G1 muvec;
71  vec_GT nuvec;
72  vec_ZZ_p chivec;
73  dbsize_t cvec_size;
74  uint64_t *cvec;
75  vec_ZZ_p ephemeral_block;
76  ZZ_p finalshare;
77 };
78 
79 #endif
Definition: spirserver.h:31
Server parameters.
Definition: percyparams.h:251
Defines the basic structure of protocol parameters (PercyParams), client parameters (PercyClientParam...