|
@@ -32,9 +32,6 @@ using socket_t = boost::asio::ip::tcp::socket;
|
|
#include "duoram-refresh.h"
|
|
#include "duoram-refresh.h"
|
|
#include "duoram-write.h"
|
|
#include "duoram-write.h"
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
void accept_conncections_from_Pb(boost::asio::io_context&io_context, std::vector<socket_t>& sockets_, int port, size_t j)
|
|
void accept_conncections_from_Pb(boost::asio::io_context&io_context, std::vector<socket_t>& sockets_, int port, size_t j)
|
|
{
|
|
{
|
|
tcp::acceptor acceptor_a(io_context, tcp::endpoint(tcp::v4(), port));
|
|
tcp::acceptor acceptor_a(io_context, tcp::endpoint(tcp::v4(), port));
|
|
@@ -42,8 +39,6 @@ void accept_conncections_from_Pb(boost::asio::io_context&io_context, std::vector
|
|
sockets_[j] = std::move(sb_a);
|
|
sockets_[j] = std::move(sb_a);
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
int main(const int argc, const char * argv[])
|
|
int main(const int argc, const char * argv[])
|
|
{
|
|
{
|
|
|
|
|
|
@@ -121,10 +116,8 @@ int main(const int argc, const char * argv[])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-#if (PARTY == 0)
|
|
|
|
-
|
|
|
|
- party = false;
|
|
|
|
-
|
|
|
|
|
|
+ #if (PARTY == 0)
|
|
|
|
+ party = false;
|
|
#ifdef ThreeParty
|
|
#ifdef ThreeParty
|
|
for(size_t j = 0; j < number_of_sockets; ++j)
|
|
for(size_t j = 0; j < number_of_sockets; ++j)
|
|
{
|
|
{
|
|
@@ -279,9 +272,9 @@ int main(const int argc, const char * argv[])
|
|
distinguised_value[0] = 80 * (1 + w);
|
|
distinguised_value[0] = 80 * (1 + w);
|
|
update_message[w] = distinguised_value[0] - read_out[w] + alpha0;
|
|
update_message[w] = distinguised_value[0] - read_out[w] + alpha0;
|
|
|
|
|
|
- #ifdef VERBOSE
|
|
|
|
- std::cout << "The updated message shares is = " << update_message[w] << std::endl;
|
|
|
|
- #endif
|
|
|
|
|
|
+ #ifdef VERBOSE
|
|
|
|
+ std::cout << "The updated message shares is = " << update_message[w] << std::endl;
|
|
|
|
+ #endif
|
|
boost::asio::write(sockets_2[2], boost::asio::buffer(&update_message[w], sizeof(DB_t)));
|
|
boost::asio::write(sockets_2[2], boost::asio::buffer(&update_message[w], sizeof(DB_t)));
|
|
boost::asio::write(sockets_[2], boost::asio::buffer(&update_message[w], sizeof(DB_t)));
|
|
boost::asio::write(sockets_[2], boost::asio::buffer(&update_message[w], sizeof(DB_t)));
|
|
boost::asio::read(sockets_[2], boost::asio::buffer(&CW[w], sizeof(DB_t)));
|
|
boost::asio::read(sockets_[2], boost::asio::buffer(&CW[w], sizeof(DB_t)));
|
|
@@ -295,22 +288,21 @@ int main(const int argc, const char * argv[])
|
|
#endif
|
|
#endif
|
|
|
|
|
|
for(size_t w = 0; w < number_of_writes; ++w)
|
|
for(size_t w = 0; w < number_of_writes; ++w)
|
|
- {
|
|
|
|
-
|
|
|
|
|
|
+ {
|
|
/*The definition of DuoramUpdate appears in duoram-write.h*/
|
|
/*The definition of DuoramUpdate appears in duoram-write.h*/
|
|
- DuoramUpdate(party, db_nitems, rotate_by_[w], DB, updated_DB, writing_b, b, CW[w], update_message[w], writing_c, writing_d, c, d);
|
|
|
|
|
|
+ DuoramUpdate(party, db_nitems, rotate_by_[w], DB, updated_DB, writing_b, b, CW[w], update_message[w], writing_c, writing_d, c, d);
|
|
|
|
|
|
- #ifdef DEBUG
|
|
|
|
- #ifdef ThreeParty
|
|
|
|
|
|
+ #ifdef DEBUG
|
|
|
|
+ #ifdef ThreeParty
|
|
/*The definition debug_ appears in duoram-utils.h*/
|
|
/*The definition debug_ appears in duoram-utils.h*/
|
|
debug_(sockets_2[0], sockets_[0], db_nitems);
|
|
debug_(sockets_2[0], sockets_[0], db_nitems);
|
|
#endif
|
|
#endif
|
|
- #endif
|
|
|
|
- }
|
|
|
|
|
|
+ #endif
|
|
|
|
+ }
|
|
|
|
|
|
- auto end_writes = std::chrono::steady_clock::now();
|
|
|
|
- std::chrono::duration<double> elapsed_seconds_writes = end_writes - start_writes;
|
|
|
|
- printf("elapsed_seconds_writes = %f\n",elapsed_seconds_writes.count());
|
|
|
|
|
|
+ auto end_writes = std::chrono::steady_clock::now();
|
|
|
|
+ std::chrono::duration<double> elapsed_seconds_writes = end_writes - start_writes;
|
|
|
|
+ printf("elapsed_seconds_writes = %f\n",elapsed_seconds_writes.count());
|
|
|
|
|
|
#ifdef VERBOSE
|
|
#ifdef VERBOSE
|
|
std::cout << "Reconstructing the database after doing " << number_of_writes << " writes " << std::endl;
|
|
std::cout << "Reconstructing the database after doing " << number_of_writes << " writes " << std::endl;
|
|
@@ -319,9 +311,9 @@ int main(const int argc, const char * argv[])
|
|
// WRITES END.
|
|
// WRITES END.
|
|
|
|
|
|
#ifdef ThreeParty
|
|
#ifdef ThreeParty
|
|
- #ifdef VERBOSE
|
|
|
|
- std::cout << std::endl << std::endl << "============== WRITES END ==============" << std::endl << std::endl;
|
|
|
|
- #endif
|
|
|
|
|
|
+ #ifdef VERBOSE
|
|
|
|
+ std::cout << std::endl << std::endl << "============== WRITES END ==============" << std::endl << std::endl;
|
|
|
|
+ #endif
|
|
auto start_ind_reads = std::chrono::steady_clock::now();
|
|
auto start_ind_reads = std::chrono::steady_clock::now();
|
|
size_t * WritePb_ind_reads = new size_t[number_of_ind_reads];
|
|
size_t * WritePb_ind_reads = new size_t[number_of_ind_reads];
|
|
size_t * WritePb_ind_reads_recv = new size_t[number_of_ind_reads];
|
|
size_t * WritePb_ind_reads_recv = new size_t[number_of_ind_reads];
|
|
@@ -345,17 +337,17 @@ int main(const int argc, const char * argv[])
|
|
DB_t * read_out_independent_reads = new DB_t[number_of_ind_reads];
|
|
DB_t * read_out_independent_reads = new DB_t[number_of_ind_reads];
|
|
for(size_t r = 0; r < number_of_ind_reads; ++r)
|
|
for(size_t r = 0; r < number_of_ind_reads; ++r)
|
|
{
|
|
{
|
|
- #ifdef VERBOSE
|
|
|
|
- std::cout << "rotate[r]" << rotate[r] << std::endl;
|
|
|
|
- std::cout << "Gamma_reads[r] = " << Gamma_reads[r] << std::endl;
|
|
|
|
- #endif
|
|
|
|
|
|
+ #ifdef VERBOSE
|
|
|
|
+ std::cout << "rotate[r]" << rotate[r] << std::endl;
|
|
|
|
+ std::cout << "Gamma_reads[r] = " << Gamma_reads[r] << std::endl;
|
|
|
|
+ #endif
|
|
|
|
|
|
- read_out_independent_reads[r] = DuoramIndependentRead(party, db_nitems, ri, Gamma_reads, rotate, r);
|
|
|
|
|
|
+ read_out_independent_reads[r] = DuoramIndependentRead(party, db_nitems, ri, Gamma_reads, rotate, r);
|
|
|
|
|
|
- #ifdef VERBOSE
|
|
|
|
- std::cout << "---> [duoram independent reads] " << print_reconstruction(sockets_[0], read_out_independent_reads[r]) << std::endl;
|
|
|
|
- #endif
|
|
|
|
- }
|
|
|
|
|
|
+ #ifdef VERBOSE
|
|
|
|
+ std::cout << "---> [duoram independent reads] " << print_reconstruction(sockets_[0], read_out_independent_reads[r]) << std::endl;
|
|
|
|
+ #endif
|
|
|
|
+ }
|
|
|
|
|
|
auto end_ind_reads = std::chrono::steady_clock::now();
|
|
auto end_ind_reads = std::chrono::steady_clock::now();
|
|
std::chrono::duration<double> elapsed_seconds_ind_reads = end_ind_reads - start_ind_reads;
|
|
std::chrono::duration<double> elapsed_seconds_ind_reads = end_ind_reads - start_ind_reads;
|