PIRReplyGeneratorTrivial.hpp 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /* Copyright (C) 2014 Carlos Aguilar Melchor, Joris Barrier, Marc-Olivier Killijian
  2. * This file is part of XPIR.
  3. *
  4. * XPIR is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * XPIR 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. * You should have received a copy of the GNU General Public License
  15. * along with XPIR. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #ifndef DEF_PIRREPLYGENERATORTRIVIAL
  18. #define DEF_PIRREPLYGENERATORTRIVIAL
  19. #include "pir/replyGenerator/GenericPIRReplyGenerator.hpp"
  20. #include "crypto/HomomorphicCrypto.hpp"
  21. #include "crypto/NoCryptography.hpp"
  22. class PIRReplyGeneratorTrivial : public GenericPIRReplyGenerator
  23. {
  24. private:
  25. // boost::mutex size_mutex;
  26. // bool lwe;
  27. // uint64_t currentMaxNbPolys;
  28. // lwe_query **queriesBuf;
  29. uint64_t totalNbChunks;
  30. NoCryptography * cryptoMethod;
  31. char* input_data;
  32. bool firstTimeImport;
  33. // LatticesBasedCryptosystem* cryptoMethod;
  34. // void generateReply( lwe_query *queries,
  35. // lwe_in_data* data,
  36. // unsigned int lvl,
  37. // lwe_cipher* result);
  38. // char** exportResult(lwe_cipher** inter_reply, unsigned int absp_nbr, unsigned int max_chunk, unsigned int rec_lvl);
  39. // lwe_cipher** importDatabase(char** database, unsigned int x_size, unsigned int y_size, unsigned int absp_nbr);
  40. // void importFakeData(uint64_t file_kb_size);
  41. // void pushFakeQuery();
  42. void generateReply();
  43. void freeResult();
  44. // void freeInputData();
  45. // void freeFakeInputData();
  46. public:
  47. // PIRReplyGeneratorNFL_internal();
  48. PIRReplyGeneratorTrivial();
  49. PIRReplyGeneratorTrivial(PIRParameters& param, DBHandler *db);
  50. ~PIRReplyGeneratorTrivial();
  51. void importData();
  52. void initQueriesBuffer();
  53. imported_database_t generateReplyGeneric(bool keep_imported_data = false);
  54. void generateReplyGenericFromData(const imported_database_t database);
  55. double generateReplySimulation(const PIRParameters& pir_params, uint64_t plaintext_nbr);
  56. unsigned long computeReplySizeInChunks(unsigned long int);
  57. void pushQuery(char* rawQuery, unsigned int size, int dim, int nbr);
  58. void setCryptoMethod(CryptographicSystem* cm);
  59. };
  60. #endif