sk will become the share of the secret key * pk will become the global public key */
| 286 | * pk will become the global public key |
| 287 | */ |
| 288 | void Run_Gen_Protocol(FHE_PK& pk,FHE_SK& sk,const Player& P,int num_runs, |
| 289 | bool commit) |
| 290 | { |
| 291 | CODE_LOCATION |
| 292 | const FHE_Params& params=pk.get_params(); |
| 293 | |
| 294 | #ifdef VERBOSE_KEYGEN |
| 295 | double start,stop; |
| 296 | /*********************** |
| 297 | * Step 1 * |
| 298 | ***********************/ |
| 299 | start=clock(); |
| 300 | #endif |
| 301 | |
| 302 | // First compute and commit to the challenge value |
| 303 | vector<unsigned int> e(P.num_players()); |
| 304 | vector<octetStream> Comm_e(P.num_players()); |
| 305 | vector<octetStream> Open_e(P.num_players()); |
| 306 | Commit_To_Challenge(e,Comm_e,Open_e,P,num_runs); |
| 307 | |
| 308 | #ifdef VERBOSE_KEYGEN |
| 309 | cout << "Done Step 1 " << endl; |
| 310 | |
| 311 | stop=clock(); |
| 312 | cout << "\t\tTime = " << (stop-start)/CLOCKS_PER_SEC << " seconds " << endl; |
| 313 | start=clock(); |
| 314 | #endif |
| 315 | |
| 316 | /*********************** |
| 317 | * Step 2 * |
| 318 | ***********************/ |
| 319 | vector< vector<octetStream> > seeds(num_runs, vector<octetStream>(P.num_players())); |
| 320 | vector< vector<octetStream> > Comm_seeds(num_runs, vector<octetStream>(P.num_players())); |
| 321 | vector<octetStream> Open_seeds(num_runs); |
| 322 | |
| 323 | vector<PRNG> G(num_runs); |
| 324 | Commit_To_Seeds(G,seeds,Comm_seeds,Open_seeds,P,num_runs); |
| 325 | |
| 326 | #ifdef VERBOSE_KEYGEN |
| 327 | cout << "Done Step 2 " << endl; |
| 328 | |
| 329 | stop=clock(); |
| 330 | cout << "\t\tTime = " << (stop-start)/CLOCKS_PER_SEC << " seconds " << endl; |
| 331 | start=clock(); |
| 332 | #endif |
| 333 | |
| 334 | /*********************** |
| 335 | * Step 2.5 * |
| 336 | ***********************/ |
| 337 | |
| 338 | // Generate my random data |
| 339 | vector<DistKeyGen> keys(num_runs, {params, pk.p()}); |
| 340 | |
| 341 | vector< vector<Rq_Element> > a(num_runs, vector<Rq_Element>(P.num_players(),Rq_Element(params.FFTD(), evaluation, evaluation))); |
| 342 | |
| 343 | |
| 344 | for (int i = 0; i < num_runs; i++) |
| 345 | { |
no test coverage detected