Browse Source

Fixes for unused functions (#30)

* Add files via upload

* getters and setters not removed

* Delete NFLLWE.cpp

* Delete NFLlib.cpp

* Delete NFLlib.hpp

* Delete OptimVars.cpp

* Delete PIROptimizer.cpp

* Delete PIRSession.cpp

* Delete PaillierKeys.cpp

* Delete WriteEvent.cpp

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload
nicolasAmat 5 years ago
parent
commit
176d5aceb3

+ 0 - 13
apps/client/DESC.cpp

@@ -138,19 +138,6 @@ uint64_t DESC::getFileSize(uint64_t index)
 #endif
 }
 
-/**
- *	Checks whether the provided file number exists. 
- *	Param : 
- *		- int dex : file index.
- *
- *	Return :
- *		- bool : true if file exist, false else.
- **/
-bool DESC::file_exists (uint64_t index) 
-{
-	return (index < nbFiles) ? true : false; 
-}
-
 /**
  *	Get number of files.
  *	Return :

+ 0 - 3
apps/server/PIRSession.cpp

@@ -382,9 +382,6 @@ void PIRSession::startProcessQuery ()
 /**
  * Recieve queries n messages with n = nbr of files.
  **/
-void blo(const boost::system::error_code& err) {
-  std::cout <<"rec "<<omp_get_wtime()<<std::endl;
-}
 void PIRSession::downloadWorker()
 {
   double start = omp_get_wtime();

+ 0 - 4
crypto/HomomorphicCrypto.hpp

@@ -59,10 +59,6 @@ public:
     virtual ~HomomorphicCrypto();
     
     double estimatePrecomputeTime(std::string crypto_param) { return 0;}
-	uint64_t getCiphertextBytesize() {
-		return 	getPublicParameters().getQuerySizeFromRecLvl(0) / 8;
-
-	}
     std::string& toString() { return cryptoName;}
 };
 

+ 0 - 10
crypto/HomomorphicCryptoFactory_internal.cpp

@@ -74,14 +74,4 @@ void HomomorphicCryptoFactory_internal::getAllCryptoSystems(std::vector<Homomorp
   crypto_sys_vec.push_back(crypto_ptr);
 }
 
-void HomomorphicCryptoFactory_internal::getOneCryptoSystem(std::vector<HomomorphicCrypto*>& crypto_sys_vec, std::string crypto_system_desc)
-{
-  std::vector<std::string> fields;
-  boost::algorithm::split(fields, crypto_system_desc, boost::algorithm::is_any_of(":"));
-  
-  HomomorphicCrypto* h;
-  h = getCrypto(fields[0]);
-  crypto_sys_vec.push_back(h);
-}
-
 

+ 0 - 5
crypto/NFLLWEPublicParameters.cpp

@@ -145,11 +145,6 @@ unsigned int NFLLWEPublicParameters::getAbsorptionBitsize(unsigned int i)
 	return (absPerCoordinateBitsize < 0) ? 0 : getpolyDegree() * absPerCoordinateBitsize;
 }
 
-unsigned int NFLLWEPublicParameters::getCiphertextSize()
-{
-  return getpolyDegree() * 64 * 2 *crypto_container->getnbModuli();
-}
-
 unsigned int NFLLWEPublicParameters::getCiphertextBitsize()
 {
 	return getModulusRepresentationBitsize() * getpolyDegree() * 2 ;

+ 0 - 87
pir/optim/OptimService.cpp

@@ -35,18 +35,6 @@ const std::string OptimService::getCurrentTime()
     return buf;
 }
 
-void OptimService::getAllOptimData(std::vector<FixedVars>& fixed_vars_vec, std::string testValuesFileName)
-{
-  unsigned int experience_nbr = getNumberOfExperiences(testValuesFileName);
-
-  for(unsigned int i = 0 ; i < experience_nbr ; i++)
-  {
-    FixedVars vars;
-    readTestValues(i, vars, testValuesFileName);
-    fixed_vars_vec.push_back(vars);
-  }
-}
-
 int OptimService::getNumberOfExperiences(std::string testValuesFileName)
 {
   std::string line;
@@ -167,26 +155,6 @@ void OptimService::writeTestCurrentResult(unsigned int alpha_min, unsigned int a
   file.close();
 }
 
-int OptimService::writeOptimData(double encrypt_time, double decrypt_time, std::string crypto_params_desc, std::string crypto_name)
-{
-  std::ofstream	fdec(folderName + fileName + crypto_name + decFileExtension, ios::app);
-  std::ofstream fenc(folderName + fileName + crypto_name + encFileExtension, ios::app);
-  fdec.setf( std::ios::fixed, std:: ios::floatfield );
-  fenc.setf( std::ios::fixed, std:: ios::floatfield );
-
-  if (!fdec.good() || !fenc.good()) 
-  {
-    fenc.close();
-    fdec.close();
-    return 1;
-  }
-
-  fenc << crypto_params_desc << " " << encrypt_time << std::endl;
-  fdec << crypto_params_desc << " " << decrypt_time << std::endl;
-
-  return 0;
-}
-
 int OptimService::writeOptimDataBuffer(const std::string& buffer, const std::string& file_path)
 {
   std::ofstream	f(file_path);
@@ -204,19 +172,6 @@ int OptimService::writeOptimDataBuffer(const std::string& buffer, const std::str
 }
 
 
-void OptimService::gotoLine(std::ifstream& file, unsigned int num)
-{
-  if (num > 0)
-  {
-    file.seekg(std::ios::beg);
-
-    for (unsigned int i = 0 ; i < num ; ++i)
-    {
-      file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
-    }
-  }
-}
-
 void OptimService::writeFootFile(unsigned int i)
 {  
   std::ofstream file(std::string("exp/exp"+ std::to_string(i)).c_str(), std::ios::out | std::ios::app );
@@ -256,48 +211,6 @@ void OptimService::writeConfigFile(unsigned int alpha, unsigned int alphaMul, un
   file.close();
 }
 
-void OptimService::writeLWEFile(unsigned int order, unsigned int p_size, unsigned int exp_nbr)
-{
-  std::ofstream file(std::string("LWEFile" + std::to_string(exp_nbr)).c_str(), std::ios::out);
-
-  file << "degree\t" << order  << endl;
-  file << "p_size\t" << p_size  << endl;
-
-  file.close();
-}
-
-// Ugly test can cause segfault if file is somehow too big
-// Should try to build a cache dictionary and test whether the
-// desired crypto_params have been filled
-int OptimService::verifyOptimData(set<string> crypto_params_set, const std::string& fenc_path, const std::string& fdec_path)
-{
-  string line_dec, line_enc;
-  unsigned int params_nbr = crypto_params_set.size();
-  int return_value = 1;
-  std::ifstream	fdec(fenc_path);
-  std::ifstream fenc(fdec_path);
-
-  if (!fenc.is_open() || !fdec.is_open()) 
-  {
-    return 0;
-  }
-  if(getNumberOfLines(fdec) < params_nbr || getNumberOfLines(fenc) < params_nbr)
-  {
-    fdec.close();
-    fenc.close();
-    std::ofstream fdec_in(fdec_path);
-    std::ofstream fenc_in(fenc_path);
-    fdec_in.close();
-    fdec_in.close();
-    return_value = 0;
-  }
-  fdec.close();
-  fenc.close();
-  return return_value;
-}
-
-unsigned int OptimService::getNumberOfLines(std::ifstream& f)
-{
   unsigned int i = 0;
   string line;
 

+ 0 - 34
pir/replyGenerator/PIRReplyGeneratorNFL_internal.cpp

@@ -335,40 +335,6 @@ void PIRReplyGeneratorNFL_internal::generateReplyGenericFromData(const imported_
 }
 
 
-// Function used to generate a PIR reply if:
-// - database is small enough to be kept in memory
-// - it has already been imported to it
-void PIRReplyGeneratorNFL_internal::generateReplyExternal(imported_database_t* database)
-{
-  uint64_t max_readable_size, database_size, nbr_of_iterations;
-
-  database_size = database->beforeImportElementBytesize * database->nbElements;
-  max_readable_size = 1280000000UL/database->nbElements;
-  // Ensure it is not larger than maxfilebytesize
-  max_readable_size = min(max_readable_size, database->beforeImportElementBytesize);
-  // Given readable size we get how many iterations we need
-  nbr_of_iterations = ceil((double)database->beforeImportElementBytesize/max_readable_size);
-
-
-  boost::mutex::scoped_lock l(mutex);
-  double start = omp_get_wtime();
-  for (unsigned iteration = 0; iteration < nbr_of_iterations; iteration++)
-  {
-
-    input_data = (lwe_in_data*) database->imported_database_ptr;
-    currentMaxNbPolys = database->polysPerElement;
-    repliesAmount = computeReplySizeInChunks(database->beforeImportElementBytesize);
-    generateReply();
-  }
-  freeInputData();
-  double end = omp_get_wtime();
-	std::cout<<"PIRReplyGeneratorNFL_internal: Total process time " << end - start << " seconds" << std::endl;
-	std::cout<<"PIRReplyGeneratorNFL_internal: DB processing throughput " << 8*dbhandler->getmaxFileBytesize()*dbhandler->getNbStream()/(end - start) << "bps" << std::endl;
-	std::cout<<"PIRReplyGeneratorNFL_internal: Client cleartext reception throughput  " << 8*dbhandler->getmaxFileBytesize()/(end - start) << "bps" << std::endl;
-  freeQueries();
-}
-
-
 /**
  *	Prepare reply and start absoptions.
  **/