PIRReplyGeneratorTrivial.hpp 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. #include "apps/server/DBHandler.hpp"
  23. class PIRReplyGeneratorTrivial : public GenericPIRReplyGenerator
  24. {
  25. private:
  26. // boost::mutex size_mutex;
  27. // bool lwe;
  28. // uint64_t currentMaxNbPolys;
  29. // lwe_query **queriesBuf;
  30. uint64_t totalNbChunks;
  31. NoCryptography * cryptoMethod;
  32. char* input_data;
  33. bool firstTimeImport;
  34. // LatticesBasedCryptosystem* cryptoMethod;
  35. // void generateReply( lwe_query *queries,
  36. // lwe_in_data* data,
  37. // unsigned int lvl,
  38. // lwe_cipher* result);
  39. // char** exportResult(lwe_cipher** inter_reply, unsigned int absp_nbr, unsigned int max_chunk, unsigned int rec_lvl);
  40. // lwe_cipher** importDatabase(char** database, unsigned int x_size, unsigned int y_size, unsigned int absp_nbr);
  41. // void importFakeData(uint64_t file_kb_size);
  42. // void pushFakeQuery();
  43. void generateReply();
  44. void freeResult();
  45. // void freeInputData();
  46. // void freeFakeInputData();
  47. public:
  48. // PIRReplyGeneratorNFL_internal();
  49. PIRReplyGeneratorTrivial();
  50. PIRReplyGeneratorTrivial(PIRParameters& param, DBHandler *db);
  51. ~PIRReplyGeneratorTrivial();
  52. void importData();
  53. void initQueriesBuffer();
  54. imported_database_t generateReplyGeneric(bool keep_imported_data = false);
  55. void generateReplyGenericFromData(const imported_database_t database);
  56. double generateReplySimulation(const PIRParameters& pir_params, uint64_t plaintext_nbr);
  57. unsigned long computeReplySizeInChunks(unsigned long int);
  58. void pushQuery(char* rawQuery, unsigned int size, int dim, int nbr);
  59. void setCryptoMethod(CryptographicSystem* cm);
  60. };
  61. #endif