|
@@ -27,250 +27,250 @@ void generate_random_targets(uint8_t ** target_share_read, size_t n_threads, boo
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-void write_evalfull_outs_into_a_file(bool party, size_t i, size_t db_nitems, int8_t ** flags, int64_t * outs_, __m128i * final_correction_word)
|
|
|
|
-{
|
|
|
|
- if(!party)
|
|
|
|
- {
|
|
|
|
- char const * p0_filename0;
|
|
|
|
- char tmp[100];
|
|
|
|
- p0_filename0 = "../duoram-online/party0_read_flags_b";
|
|
|
|
- strcpy(tmp, p0_filename0);
|
|
|
|
- strcat(tmp, std::to_string(i).c_str());
|
|
|
|
|
|
+// void write_evalfull_outs_into_a_file(bool party, size_t i, size_t db_nitems, int8_t ** flags, int64_t * outs_, __m128i * final_correction_word)
|
|
|
|
+// {
|
|
|
|
+// if(!party)
|
|
|
|
+// {
|
|
|
|
+// char const * p0_filename0;
|
|
|
|
+// char tmp[100];
|
|
|
|
+// p0_filename0 = "../duoram-online/party0_read_flags_b";
|
|
|
|
+// strcpy(tmp, p0_filename0);
|
|
|
|
+// strcat(tmp, std::to_string(i).c_str());
|
|
|
|
|
|
- int w0 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
- int written = write(w0, flags[i], db_nitems * sizeof(flags[i][0]));
|
|
|
|
- if(written<0) {
|
|
|
|
- perror("Write error");
|
|
|
|
- }
|
|
|
|
- close(w0);
|
|
|
|
-
|
|
|
|
- p0_filename0 = "../duoram-online/party0_read_flags_c";
|
|
|
|
- strcpy(tmp, p0_filename0);
|
|
|
|
- strcat(tmp, std::to_string(i).c_str());
|
|
|
|
- int w1 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
- written = write(w1, flags[i], db_nitems * sizeof(flags[i][0]));
|
|
|
|
- if(written<0) {
|
|
|
|
- perror("Write error");
|
|
|
|
- }
|
|
|
|
- close(w1);
|
|
|
|
|
|
+// int w0 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
+// int written = write(w0, flags[i], db_nitems * sizeof(flags[i][0]));
|
|
|
|
+// if(written<0) {
|
|
|
|
+// perror("Write error");
|
|
|
|
+// }
|
|
|
|
+// close(w0);
|
|
|
|
+
|
|
|
|
+// p0_filename0 = "../duoram-online/party0_read_flags_c";
|
|
|
|
+// strcpy(tmp, p0_filename0);
|
|
|
|
+// strcat(tmp, std::to_string(i).c_str());
|
|
|
|
+// int w1 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
+// written = write(w1, flags[i], db_nitems * sizeof(flags[i][0]));
|
|
|
|
+// if(written<0) {
|
|
|
|
+// perror("Write error");
|
|
|
|
+// }
|
|
|
|
+// close(w1);
|
|
|
|
|
|
- p0_filename0 = "../duoram-online/party0_read_flags_d";
|
|
|
|
- strcpy(tmp, p0_filename0);
|
|
|
|
- strcat(tmp, std::to_string(i).c_str());
|
|
|
|
- int w2 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
- written = write(w2, flags[i], db_nitems * sizeof(flags[i][0]));
|
|
|
|
|
|
+// p0_filename0 = "../duoram-online/party0_read_flags_d";
|
|
|
|
+// strcpy(tmp, p0_filename0);
|
|
|
|
+// strcat(tmp, std::to_string(i).c_str());
|
|
|
|
+// int w2 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
+// written = write(w2, flags[i], db_nitems * sizeof(flags[i][0]));
|
|
|
|
|
|
- if(written<0) {
|
|
|
|
- perror("Write error");
|
|
|
|
- }
|
|
|
|
- close(w2);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- p0_filename0 = "../duoram-online/party0_write_flags_b";
|
|
|
|
- strcpy(tmp, p0_filename0);
|
|
|
|
- strcat(tmp, std::to_string(i).c_str());
|
|
|
|
- int w4 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
- written = write(w4, flags[i], db_nitems * sizeof(flags[i][0]));
|
|
|
|
- if(written<0) {
|
|
|
|
- perror("Write error");
|
|
|
|
- }
|
|
|
|
- close(w4);
|
|
|
|
-
|
|
|
|
- p0_filename0 = "../duoram-online/party0_write_flags_c";
|
|
|
|
- strcpy(tmp, p0_filename0);
|
|
|
|
- strcat(tmp, std::to_string(i).c_str());
|
|
|
|
- int w5 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
- written = write(w5, flags[i], db_nitems * sizeof(flags[i][0]));
|
|
|
|
- if(written<0) {
|
|
|
|
- perror("Write error");
|
|
|
|
- }
|
|
|
|
- close(w5);
|
|
|
|
- p0_filename0 = "../duoram-online/party0_write_flags_d";
|
|
|
|
- strcpy(tmp, p0_filename0);
|
|
|
|
- strcat(tmp, std::to_string(i).c_str());
|
|
|
|
- int w6 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
- written = write(w6, flags[i], db_nitems * sizeof(flags[i][0]));
|
|
|
|
|
|
+// if(written<0) {
|
|
|
|
+// perror("Write error");
|
|
|
|
+// }
|
|
|
|
+// close(w2);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+// p0_filename0 = "../duoram-online/party0_write_flags_b";
|
|
|
|
+// strcpy(tmp, p0_filename0);
|
|
|
|
+// strcat(tmp, std::to_string(i).c_str());
|
|
|
|
+// int w4 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
+// written = write(w4, flags[i], db_nitems * sizeof(flags[i][0]));
|
|
|
|
+// if(written<0) {
|
|
|
|
+// perror("Write error");
|
|
|
|
+// }
|
|
|
|
+// close(w4);
|
|
|
|
+
|
|
|
|
+// p0_filename0 = "../duoram-online/party0_write_flags_c";
|
|
|
|
+// strcpy(tmp, p0_filename0);
|
|
|
|
+// strcat(tmp, std::to_string(i).c_str());
|
|
|
|
+// int w5 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
+// written = write(w5, flags[i], db_nitems * sizeof(flags[i][0]));
|
|
|
|
+// if(written<0) {
|
|
|
|
+// perror("Write error");
|
|
|
|
+// }
|
|
|
|
+// close(w5);
|
|
|
|
+// p0_filename0 = "../duoram-online/party0_write_flags_d";
|
|
|
|
+// strcpy(tmp, p0_filename0);
|
|
|
|
+// strcat(tmp, std::to_string(i).c_str());
|
|
|
|
+// int w6 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
+// written = write(w6, flags[i], db_nitems * sizeof(flags[i][0]));
|
|
|
|
|
|
- if(written<0) {
|
|
|
|
- perror("Write error");
|
|
|
|
- }
|
|
|
|
|
|
+// if(written<0) {
|
|
|
|
+// perror("Write error");
|
|
|
|
+// }
|
|
|
|
|
|
- close(w6);
|
|
|
|
-
|
|
|
|
- p0_filename0 = "../duoram-online/party0_write_b";
|
|
|
|
- strcpy(tmp, p0_filename0);
|
|
|
|
- strcat(tmp, std::to_string(i).c_str());
|
|
|
|
- w4 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
- written = write(w4, outs_, db_nitems * sizeof(outs_[0]));
|
|
|
|
- if(written<0) {
|
|
|
|
- perror("Write error");
|
|
|
|
- }
|
|
|
|
- close(w4);
|
|
|
|
-
|
|
|
|
- p0_filename0 = "../duoram-online/party0_write_c";
|
|
|
|
- strcpy(tmp, p0_filename0);
|
|
|
|
- strcat(tmp, std::to_string(i).c_str());
|
|
|
|
- w5 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
- written = write(w5, outs_, db_nitems * sizeof(outs_[0]));
|
|
|
|
- if(written<0) {
|
|
|
|
- perror("Write error");
|
|
|
|
- }
|
|
|
|
- close(w5);
|
|
|
|
-
|
|
|
|
- p0_filename0 = "../duoram-online/party0_write_d";
|
|
|
|
- strcpy(tmp, p0_filename0);
|
|
|
|
- strcat(tmp, std::to_string(i).c_str());
|
|
|
|
- w6 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
- written = write(w6, outs_, db_nitems * sizeof(outs_[0]));
|
|
|
|
|
|
+// close(w6);
|
|
|
|
+
|
|
|
|
+// p0_filename0 = "../duoram-online/party0_write_b";
|
|
|
|
+// strcpy(tmp, p0_filename0);
|
|
|
|
+// strcat(tmp, std::to_string(i).c_str());
|
|
|
|
+// w4 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
+// written = write(w4, outs_, db_nitems * sizeof(outs_[0]));
|
|
|
|
+// if(written<0) {
|
|
|
|
+// perror("Write error");
|
|
|
|
+// }
|
|
|
|
+// close(w4);
|
|
|
|
+
|
|
|
|
+// p0_filename0 = "../duoram-online/party0_write_c";
|
|
|
|
+// strcpy(tmp, p0_filename0);
|
|
|
|
+// strcat(tmp, std::to_string(i).c_str());
|
|
|
|
+// w5 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
+// written = write(w5, outs_, db_nitems * sizeof(outs_[0]));
|
|
|
|
+// if(written<0) {
|
|
|
|
+// perror("Write error");
|
|
|
|
+// }
|
|
|
|
+// close(w5);
|
|
|
|
+
|
|
|
|
+// p0_filename0 = "../duoram-online/party0_write_d";
|
|
|
|
+// strcpy(tmp, p0_filename0);
|
|
|
|
+// strcat(tmp, std::to_string(i).c_str());
|
|
|
|
+// w6 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
+// written = write(w6, outs_, db_nitems * sizeof(outs_[0]));
|
|
|
|
|
|
- if(written<0) {
|
|
|
|
- perror("Write error");
|
|
|
|
- }
|
|
|
|
|
|
+// if(written<0) {
|
|
|
|
+// perror("Write error");
|
|
|
|
+// }
|
|
|
|
|
|
- close(w6);
|
|
|
|
|
|
+// close(w6);
|
|
|
|
|
|
- }
|
|
|
|
- if(party)
|
|
|
|
- {
|
|
|
|
- char const * p0_filename0;
|
|
|
|
- char tmp[100];
|
|
|
|
- p0_filename0 = "../duoram-online/party1_read_flags_b";
|
|
|
|
- strcpy(tmp, p0_filename0);
|
|
|
|
- strcat(tmp, std::to_string(i).c_str());
|
|
|
|
|
|
+// }
|
|
|
|
+// if(party)
|
|
|
|
+// {
|
|
|
|
+// char const * p0_filename0;
|
|
|
|
+// char tmp[100];
|
|
|
|
+// p0_filename0 = "../duoram-online/party1_read_flags_b";
|
|
|
|
+// strcpy(tmp, p0_filename0);
|
|
|
|
+// strcat(tmp, std::to_string(i).c_str());
|
|
|
|
|
|
- int w0 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
- int written = write(w0, flags[i], db_nitems * sizeof(flags[i][0]));
|
|
|
|
- if(written<0) {
|
|
|
|
- perror("Write error");
|
|
|
|
- }
|
|
|
|
|
|
+// int w0 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
+// int written = write(w0, flags[i], db_nitems * sizeof(flags[i][0]));
|
|
|
|
+// if(written<0) {
|
|
|
|
+// perror("Write error");
|
|
|
|
+// }
|
|
|
|
|
|
- close(w0);
|
|
|
|
|
|
+// close(w0);
|
|
|
|
|
|
- p0_filename0 = "../duoram-online/party1_read_flags_c";
|
|
|
|
- strcpy(tmp, p0_filename0);
|
|
|
|
- strcat(tmp, std::to_string(i).c_str());
|
|
|
|
|
|
+// p0_filename0 = "../duoram-online/party1_read_flags_c";
|
|
|
|
+// strcpy(tmp, p0_filename0);
|
|
|
|
+// strcat(tmp, std::to_string(i).c_str());
|
|
|
|
|
|
- int w1 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
- written = write(w1, flags[i], db_nitems * sizeof(flags[i][0]));
|
|
|
|
- if(written<0) {
|
|
|
|
- perror("Write error");
|
|
|
|
- }
|
|
|
|
- close(w1);
|
|
|
|
-
|
|
|
|
- p0_filename0 = "../duoram-online/party1_read_flags_d";
|
|
|
|
- strcpy(tmp, p0_filename0);
|
|
|
|
- strcat(tmp, std::to_string(i).c_str());
|
|
|
|
|
|
+// int w1 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
+// written = write(w1, flags[i], db_nitems * sizeof(flags[i][0]));
|
|
|
|
+// if(written<0) {
|
|
|
|
+// perror("Write error");
|
|
|
|
+// }
|
|
|
|
+// close(w1);
|
|
|
|
+
|
|
|
|
+// p0_filename0 = "../duoram-online/party1_read_flags_d";
|
|
|
|
+// strcpy(tmp, p0_filename0);
|
|
|
|
+// strcat(tmp, std::to_string(i).c_str());
|
|
|
|
|
|
- int w2 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
- written = write(w2,flags[i], db_nitems * sizeof(flags[i][0]));
|
|
|
|
|
|
+// int w2 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
+// written = write(w2,flags[i], db_nitems * sizeof(flags[i][0]));
|
|
|
|
|
|
- if(written<0) {
|
|
|
|
- perror("Write error");
|
|
|
|
- }
|
|
|
|
|
|
+// if(written<0) {
|
|
|
|
+// perror("Write error");
|
|
|
|
+// }
|
|
|
|
|
|
- close(w2);
|
|
|
|
|
|
+// close(w2);
|
|
|
|
|
|
|
|
|
|
- p0_filename0 = "../duoram-online/party1_write_flags_b";
|
|
|
|
- strcpy(tmp, p0_filename0);
|
|
|
|
- strcat(tmp, std::to_string(i).c_str());
|
|
|
|
|
|
+// p0_filename0 = "../duoram-online/party1_write_flags_b";
|
|
|
|
+// strcpy(tmp, p0_filename0);
|
|
|
|
+// strcat(tmp, std::to_string(i).c_str());
|
|
|
|
|
|
- int w4 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
- written = write(w4,flags[i], db_nitems * sizeof(flags[i][0]));
|
|
|
|
- if(written<0) {
|
|
|
|
- perror("Write error");
|
|
|
|
- }
|
|
|
|
- close(w4);
|
|
|
|
-
|
|
|
|
- p0_filename0 = "../duoram-online/party1_write_flags_c";
|
|
|
|
- strcpy(tmp, p0_filename0);
|
|
|
|
- strcat(tmp, std::to_string(i).c_str());
|
|
|
|
|
|
+// int w4 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
+// written = write(w4,flags[i], db_nitems * sizeof(flags[i][0]));
|
|
|
|
+// if(written<0) {
|
|
|
|
+// perror("Write error");
|
|
|
|
+// }
|
|
|
|
+// close(w4);
|
|
|
|
+
|
|
|
|
+// p0_filename0 = "../duoram-online/party1_write_flags_c";
|
|
|
|
+// strcpy(tmp, p0_filename0);
|
|
|
|
+// strcat(tmp, std::to_string(i).c_str());
|
|
|
|
|
|
- int w5 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
- written = write(w5, flags[i], db_nitems * sizeof(flags[i][0]));
|
|
|
|
- if(written<0) {
|
|
|
|
- perror("Write error");
|
|
|
|
- }
|
|
|
|
- close(w5);
|
|
|
|
|
|
+// int w5 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
+// written = write(w5, flags[i], db_nitems * sizeof(flags[i][0]));
|
|
|
|
+// if(written<0) {
|
|
|
|
+// perror("Write error");
|
|
|
|
+// }
|
|
|
|
+// close(w5);
|
|
|
|
|
|
- p0_filename0 = "../duoram-online/party1_write_flags_d";
|
|
|
|
- strcpy(tmp, p0_filename0);
|
|
|
|
- strcat(tmp, std::to_string(i).c_str());
|
|
|
|
|
|
+// p0_filename0 = "../duoram-online/party1_write_flags_d";
|
|
|
|
+// strcpy(tmp, p0_filename0);
|
|
|
|
+// strcat(tmp, std::to_string(i).c_str());
|
|
|
|
|
|
- int w6 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
- written = write(w6, flags[i], db_nitems * sizeof(flags[i][0]));
|
|
|
|
- if(written<0) {
|
|
|
|
- perror("Write error");
|
|
|
|
- }
|
|
|
|
|
|
+// int w6 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
+// written = write(w6, flags[i], db_nitems * sizeof(flags[i][0]));
|
|
|
|
+// if(written<0) {
|
|
|
|
+// perror("Write error");
|
|
|
|
+// }
|
|
|
|
|
|
- close(w6);
|
|
|
|
-
|
|
|
|
- p0_filename0 = "../duoram-online/party1_write_b";
|
|
|
|
- strcpy(tmp, p0_filename0);
|
|
|
|
- strcat(tmp, std::to_string(i).c_str());
|
|
|
|
-
|
|
|
|
- w4 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
- written = write(w4, outs_, db_nitems * sizeof(outs_[0]));
|
|
|
|
- if(written<0) {
|
|
|
|
- perror("Write error");
|
|
|
|
- }
|
|
|
|
- close(w4);
|
|
|
|
-
|
|
|
|
- // char const * p0_filename0;
|
|
|
|
- p0_filename0 = "../duoram-online/party1_write_c";
|
|
|
|
- strcpy(tmp, p0_filename0);
|
|
|
|
- strcat(tmp, std::to_string(i).c_str());
|
|
|
|
- w5 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
- written = write(w5, outs_, db_nitems * sizeof(outs_[0]));
|
|
|
|
- if(written<0) {
|
|
|
|
- perror("Write error");
|
|
|
|
- }
|
|
|
|
- close(w5);
|
|
|
|
- p0_filename0 = "../duoram-online/party1_write_d";
|
|
|
|
- strcpy(tmp, p0_filename0);
|
|
|
|
- strcat(tmp, std::to_string(i).c_str());
|
|
|
|
- w6 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
- written = write(w6, outs_, db_nitems * sizeof(outs_[0]));
|
|
|
|
|
|
+// close(w6);
|
|
|
|
+
|
|
|
|
+// p0_filename0 = "../duoram-online/party1_write_b";
|
|
|
|
+// strcpy(tmp, p0_filename0);
|
|
|
|
+// strcat(tmp, std::to_string(i).c_str());
|
|
|
|
+
|
|
|
|
+// w4 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
+// written = write(w4, outs_, db_nitems * sizeof(outs_[0]));
|
|
|
|
+// if(written<0) {
|
|
|
|
+// perror("Write error");
|
|
|
|
+// }
|
|
|
|
+// close(w4);
|
|
|
|
+
|
|
|
|
+// // char const * p0_filename0;
|
|
|
|
+// p0_filename0 = "../duoram-online/party1_write_c";
|
|
|
|
+// strcpy(tmp, p0_filename0);
|
|
|
|
+// strcat(tmp, std::to_string(i).c_str());
|
|
|
|
+// w5 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
+// written = write(w5, outs_, db_nitems * sizeof(outs_[0]));
|
|
|
|
+// if(written<0) {
|
|
|
|
+// perror("Write error");
|
|
|
|
+// }
|
|
|
|
+// close(w5);
|
|
|
|
+// p0_filename0 = "../duoram-online/party1_write_d";
|
|
|
|
+// strcpy(tmp, p0_filename0);
|
|
|
|
+// strcat(tmp, std::to_string(i).c_str());
|
|
|
|
+// w6 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
+// written = write(w6, outs_, db_nitems * sizeof(outs_[0]));
|
|
|
|
|
|
- if(written<0) {
|
|
|
|
- perror("Write error");
|
|
|
|
- }
|
|
|
|
|
|
+// if(written<0) {
|
|
|
|
+// perror("Write error");
|
|
|
|
+// }
|
|
|
|
|
|
- close(w6);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if(party)
|
|
|
|
- {
|
|
|
|
- char const * p1_filename0;
|
|
|
|
- char tmp[100];
|
|
|
|
- p1_filename0 = "../duoram-online/FCW1";
|
|
|
|
- strcpy(tmp, p1_filename0);
|
|
|
|
- strcat(tmp, std::to_string(i).c_str());
|
|
|
|
|
|
+// close(w6);
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+// if(party)
|
|
|
|
+// {
|
|
|
|
+// char const * p1_filename0;
|
|
|
|
+// char tmp[100];
|
|
|
|
+// p1_filename0 = "../duoram-online/FCW1";
|
|
|
|
+// strcpy(tmp, p1_filename0);
|
|
|
|
+// strcat(tmp, std::to_string(i).c_str());
|
|
|
|
|
|
- int w0 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
- int written = write(w0, &final_correction_word[0][0], sizeof(final_correction_word[0][0]));
|
|
|
|
- if(written<0) {
|
|
|
|
- perror("Write error");
|
|
|
|
- }
|
|
|
|
- close(w0);
|
|
|
|
- }
|
|
|
|
|
|
+// int w0 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
+// int written = write(w0, &final_correction_word[0][0], sizeof(final_correction_word[0][0]));
|
|
|
|
+// if(written<0) {
|
|
|
|
+// perror("Write error");
|
|
|
|
+// }
|
|
|
|
+// close(w0);
|
|
|
|
+// }
|
|
|
|
|
|
- if(!party)
|
|
|
|
- {
|
|
|
|
- char const * p0_filename0;
|
|
|
|
- char tmp[100];
|
|
|
|
- p0_filename0 = "../duoram-online/FCW0";
|
|
|
|
- strcpy(tmp, p0_filename0);
|
|
|
|
- strcat(tmp, std::to_string(i).c_str());
|
|
|
|
|
|
+// if(!party)
|
|
|
|
+// {
|
|
|
|
+// char const * p0_filename0;
|
|
|
|
+// char tmp[100];
|
|
|
|
+// p0_filename0 = "../duoram-online/FCW0";
|
|
|
|
+// strcpy(tmp, p0_filename0);
|
|
|
|
+// strcat(tmp, std::to_string(i).c_str());
|
|
|
|
|
|
- int w0 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
- int written = write(w0, &final_correction_word[0][0], sizeof(final_correction_word[0][0]));
|
|
|
|
- if(written<0) {
|
|
|
|
- perror("Write error");
|
|
|
|
- }
|
|
|
|
- close(w0);
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
|
|
+// int w0 = open( tmp, O_WRONLY | O_CREAT, S_IWRITE | S_IREAD);
|
|
|
|
+// int written = write(w0, &final_correction_word[0][0], sizeof(final_correction_word[0][0]));
|
|
|
|
+// if(written<0) {
|
|
|
|
+// perror("Write error");
|
|
|
|
+// }
|
|
|
|
+// close(w0);
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
|
|
|
|
|
|
struct cw_construction
|
|
struct cw_construction
|
|
@@ -316,6 +316,7 @@ void compute_CW(tcp::socket& sout, tcp::socket& sin, __m128i L, __m128i R, uint8
|
|
|
|
|
|
cw_construction computecw;
|
|
cw_construction computecw;
|
|
|
|
|
|
|
|
+ //Communication from P2
|
|
read(sin, boost::asio::buffer(&computecw, sizeof(computecw)));
|
|
read(sin, boost::asio::buffer(&computecw, sizeof(computecw)));
|
|
|
|
|
|
__m128i rand_b = computecw.rand_b;
|
|
__m128i rand_b = computecw.rand_b;
|
|
@@ -345,6 +346,8 @@ void compute_CW(tcp::socket& sout, tcp::socket& sin, __m128i L, __m128i R, uint8
|
|
BlindsCW blinds_sent, blinds_recv;
|
|
BlindsCW blinds_sent, blinds_recv;
|
|
blinds_sent.blinded_bit = blinded_bit;
|
|
blinds_sent.blinded_bit = blinded_bit;
|
|
blinds_sent.blinded_message = blinded_L;
|
|
blinds_sent.blinded_message = blinded_L;
|
|
|
|
+
|
|
|
|
+ //exchange blinded shares for OSWAP.
|
|
boost::asio::write(sout, boost::asio::buffer(&blinds_sent, sizeof(BlindsCW)));
|
|
boost::asio::write(sout, boost::asio::buffer(&blinds_sent, sizeof(BlindsCW)));
|
|
boost::asio::read(sout, boost::asio::buffer(&blinds_recv, sizeof(BlindsCW)));
|
|
boost::asio::read(sout, boost::asio::buffer(&blinds_recv, sizeof(BlindsCW)));
|
|
|
|
|
|
@@ -369,6 +372,8 @@ void compute_CW(tcp::socket& sout, tcp::socket& sin, __m128i L, __m128i R, uint8
|
|
|
|
|
|
CW = out_reconstruction;
|
|
CW = out_reconstruction;
|
|
|
|
|
|
|
|
+
|
|
|
|
+ // The following asserts the correctness of ComputeCW
|
|
#ifdef DEBUG
|
|
#ifdef DEBUG
|
|
uint8_t bit_reconstruction;
|
|
uint8_t bit_reconstruction;
|
|
boost::asio::write(sout, boost::asio::buffer(&bit, sizeof(bit)));
|
|
boost::asio::write(sout, boost::asio::buffer(&bit, sizeof(bit)));
|
|
@@ -399,7 +404,6 @@ void compute_CW(tcp::socket& sout, tcp::socket& sin, __m128i L, __m128i R, uint8
|
|
assert(CW_debug[0] == CW[0]);
|
|
assert(CW_debug[0] == CW[0]);
|
|
assert(CW_debug[1] == CW[1]);
|
|
assert(CW_debug[1] == CW[1]);
|
|
#endif
|
|
#endif
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -409,6 +413,7 @@ static inline void traverse(const prgkey_t & prgkey, const node_t & seed, node_t
|
|
dpf::PRG(prgkey, clear_lsb(seed, 0b11), s, 2);
|
|
dpf::PRG(prgkey, clear_lsb(seed, 0b11), s, 2);
|
|
} // dpf::expand
|
|
} // dpf::expand
|
|
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* @brief
|
|
* @brief
|
|
*
|
|
*
|
|
@@ -509,6 +514,7 @@ inline void create_dpfs( size_t db_nitems,
|
|
compute_CW(socketsPb[socket_no], socketsP2[socket_no], L, R, target_share[layer], CW[layer]);
|
|
compute_CW(socketsPb[socket_no], socketsP2[socket_no], L, R, target_share[layer], CW[layer]);
|
|
|
|
|
|
uint8_t cwt_L, cwt_R;
|
|
uint8_t cwt_L, cwt_R;
|
|
|
|
+
|
|
// Computes the correction word bits
|
|
// Computes the correction word bits
|
|
compute_CW_bits(socketsPb[socket_no+1], L, R, target_share[layer], cwt_L, cwt_R);
|
|
compute_CW_bits(socketsPb[socket_no+1], L, R, target_share[layer], cwt_L, cwt_R);
|
|
|
|
|
|
@@ -520,8 +526,7 @@ inline void create_dpfs( size_t db_nitems,
|
|
std::cout << " cwt_R = " << (int) cwt_R << std::endl;
|
|
std::cout << " cwt_R = " << (int) cwt_R << std::endl;
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+
|
|
dpf_instance.CW[layer] = CW[layer];
|
|
dpf_instance.CW[layer] = CW[layer];
|
|
dpf_instance.cwt_L[layer] = cwt_L;
|
|
dpf_instance.cwt_L[layer] = cwt_L;
|
|
dpf_instance.cwt_R[layer] = cwt_R;
|
|
dpf_instance.cwt_R[layer] = cwt_R;
|