verification.cpp
Go to the documentation of this file.
1 
12 #include "verification.hpp"
13 
14 using namespace proofs;
15 
16 
18  std::vector<uint8_t> prefix,
19  unsigned int nZero)
20 {
21  protocolFile = config;
22 
23  // initializing constants
24  n0 = nZero;
31  zq = new arithm::ModField(gq->getMultOrder());
32  rho = prefix;
33 
34  // initializing the random oracles
37 
38  // initialising the independant random generators
41  std::vector<uint8_t> seed = rho, s, btVector(bt->toVector());
42  seed.insert(seed.end(),btVector.begin(),btVector.end());
43  s = ROs->query(seed);
44  prg->initialize(s);
45  h = gq->getRandArray(prg,nr,n0);
46 }
47 
48 
50  verifierUtils::ByteTree * bts, std::vector<uint8_t> &s)
51 {
52  // first, we compute the seed s
53  std::vector<uint8_t> queryROs = rho, btsVector(bts->toVector());
54  queryROs.insert(queryROs.end(),
55  btsVector.begin(),btsVector.end());
56  s = ROs->query(queryROs);
57 
58  // then, we use the prg's output to compute the exponents
59  prg->initialize(s);
61  unsigned int eiByteLength = ne/8;
62  mpz_class twoToTheNe = 2;
63  mpz_pow_ui(twoToTheNe.get_mpz_t(),twoToTheNe.get_mpz_t(),ne);
64  for (unsigned int i=0; i<n0; i++)
65  {
66  mpz_class ei = 0;
67  for (unsigned int j=0; j<eiByteLength; j++)
68  ei = ei*0x100 + prg->getNextRandByte();
69  ei = ei % twoToTheNe;
70  e.addElmt(arithm::Elmt(ei,NULL));
71  }
72  return e;
73 }
74 
75 
77 {
79  btv->addChild(new verifierUtils::Leaf(s));
80  btv->addChild(tau);
81  std::vector<uint8_t> vBytes, queryROv = rho, btvVector(btv->toVector());
82  queryROv.insert(queryROv.end(), btvVector.begin(), btvVector.end());
83  vBytes = ROv->query(queryROv);
84  mpz_class v = 1, modulo = 2;
85  for (unsigned int i=0; i<nv/8; i++)
86  v = v*0x100 + vBytes[i];
87  mpz_pow_ui(
88  modulo.get_mpz_t(),
89  modulo.get_mpz_t(),
90  nv);
91  return arithm::Elmt(v % modulo,NULL);
92 }
93 
94 
96 {
97  return h;
98 }
99 
100 
102 {
103  return false;
104 }
105