@@ -48,12 +48,10 @@ void Register::init(int rfd, int n_parties) {
4848 mask = mask>0 ? 1 : 0 ;
4949 keys.init (n_parties);
5050 keys.randomize ();
51- #ifdef KEY_SIGNAL
5251 for (int i = 0 ; i < 2 ; i++)
5352 for (size_t j = 0 ; j < keys[i].size (); j++)
5453 if (keys[i][j].get_signal () != i)
5554 keys[i][j] ^= Key (1 );
56- #endif
5755}
5856
5957void Register::set_eval_keys ()
@@ -284,21 +282,7 @@ void Register::eval(const Register& left, const Register& right, GarbledGate& ga
284282// }
285283// std::cout << std::endl;
286284
287- #ifdef KEY_SIGNAL
288285 external = garbled_entry[my_id - 1 ].get_signal ();
289- #else
290- if (garbled_entry[my_id-1 ] == key (my_id, 0 )) {
291- external = 0 ;
292- } else if (garbled_entry[my_id-1 ] == key (my_id, 1 )) {
293- external = 1 ;
294- } else {
295- printf (" \n ERROR!!!\n " );
296- cout << " got key: " << garbled_entry[my_id - 1 ] << endl;
297- cout << " possibilities: " << key (my_id, 0 ) << " " << key (my_id, 1 ) << endl;
298- throw std::invalid_argument (" result key doesn't fit any of my keys" );
299- // return NO_SIGNAL;
300- }
301- #endif
302286
303287#ifdef DEBUG_MASK
304288 cout << " output signal: " << (int )external << endl;
@@ -680,9 +664,7 @@ void RandomRegister::randomize()
680664 party.random_timer .start ();
681665 init (party.randomfd , party._N );
682666 party.random_timer .stop ();
683- #ifdef FREE_XOR
684667 keys[1 ] = keys[0 ] ^ party.get_deltas ();
685- #endif
686668 party.add_keys (*this );
687669}
688670
@@ -764,16 +746,13 @@ void EvalRegister::output()
764746 ProgramParty& party = ProgramParty::s ();
765747 party.load_wire (*this );
766748 set_mask (party.output_masks .pop_front ());
767- #ifdef KEY_SIGNAL
768749#ifdef DEBUG_REGS
769750 cout << " check " << get_id () << endl;
770751#endif
771752 check_signal_key (party.get_id (), garbled_entry);
772- #endif
773753 party.taint ();
774754}
775755
776- #ifdef FREE_XOR
777756void RandomRegister::XOR (const Register& left, const Register& right)
778757{
779758 mask = left.get_mask () ^ right.get_mask ();
@@ -824,46 +803,6 @@ void EvalRegister::XOR(const Register& left, const Register& right)
824803 << " ^ " << right.get_garbled_entry ()[i] << endl;
825804#endif
826805}
827- #endif
828-
829- void EvalRegister::check (const int128& value, word share, int128 mac)
830- {
831- #ifdef DEBUG_DYNAMIC
832- cout << " check result " << value << endl;
833- #endif
834- if (value != 0 )
835- {
836- cout << " MAC check: " << value << " " << share<< " " << mac << endl;
837- throw runtime_error (" MAC check failed" );
838- }
839- }
840-
841- void EvalRegister::get_dyn_mask (GC::Mask& mask, int length, int mac_length)
842- {
843- mask.share = CommonParty::s ().prng .get_word () & ((1ULL << length) - 1 );
844- mask.mac = int128 (CommonParty::s ().prng .get_doubleword ())
845- & int128::ones (mac_length);
846- #ifdef DEBUG_DYNAMIC
847- cout << " mask " << hex << mask.share << " " << mask.mac << " " ;
848- cout << ((1ULL << length) - 1 ) << " " << int128::ones (mac_length) << endl;
849- #endif
850- }
851-
852- void EvalRegister::unmask (GC::AuthValue& dest, word mask_share, int128 mac_mask_share,
853- word masked, int128 masked_mac)
854- {
855- dest.share = mask_share;
856- dest.mac = mac_mask_share;
857- if (ProgramParty::s ()._id == 1 )
858- {
859- dest.share ^= masked;
860- dest.mac ^= masked_mac;
861- }
862- #ifdef DEBUG_DYNAMIC
863- cout << dest.share << " ?= " << mask_share << " ^ " << masked << endl;
864- cout << dest.mac << " ?= " << mac_mask_share << " ^ " << masked_mac << endl;
865- #endif
866- }
867806
868807template <>
869808void RandomRegister::store (NoMemory& mem,
0 commit comments