|
@@ -139,8 +139,6 @@ bool make_reputation_proof(
|
|
std::chrono::high_resolution_clock::time_point wallTimeBefore = std::chrono::high_resolution_clock::now();
|
|
std::chrono::high_resolution_clock::time_point wallTimeBefore = std::chrono::high_resolution_clock::now();
|
|
clock_t cpuTimeBefore = clock();
|
|
clock_t cpuTimeBefore = clock();
|
|
|
|
|
|
- std::cout << "Getting generator." << std::endl;
|
|
|
|
-
|
|
|
|
// Get current fresh generator (it's not guaranteed we've done this in the current epoch)
|
|
// Get current fresh generator (it's not guaranteed we've done this in the current epoch)
|
|
std::vector<Proof> generatorProof;
|
|
std::vector<Proof> generatorProof;
|
|
Twistpoint freshGenerator = get_generator(rng, serverIPs, serverPorts, true, generatorProof, bandwidthData);
|
|
Twistpoint freshGenerator = get_generator(rng, serverIPs, serverPorts, true, generatorProof, bandwidthData);
|
|
@@ -151,44 +149,30 @@ bool make_reputation_proof(
|
|
// Make current short term public key
|
|
// Make current short term public key
|
|
Twistpoint shortTermPublicKey = prsonaClient->get_short_term_public_key();
|
|
Twistpoint shortTermPublicKey = prsonaClient->get_short_term_public_key();
|
|
|
|
|
|
- std::cout << "Getting encrypted score." << std::endl;
|
|
|
|
-
|
|
|
|
// Get this client's current encrypted score
|
|
// Get this client's current encrypted score
|
|
std::vector<Proof> encryptedScoreProof;
|
|
std::vector<Proof> encryptedScoreProof;
|
|
EGCiphertext encryptedScore = get_server_committed_val<EGCiphertext>(rng, serverIPs, serverPorts, REQUEST_CLIENT_TALLY_URI, REQUEST_CLIENT_TALLY_COMMITMENT_URI, encryptedScoreProof, shortTermPublicKey, bandwidthData);
|
|
EGCiphertext encryptedScore = get_server_committed_val<EGCiphertext>(rng, serverIPs, serverPorts, REQUEST_CLIENT_TALLY_URI, REQUEST_CLIENT_TALLY_COMMITMENT_URI, encryptedScoreProof, shortTermPublicKey, bandwidthData);
|
|
|
|
|
|
- std::cout << "Loading encrypted score." << std::endl;
|
|
|
|
-
|
|
|
|
// Load this current encrypted score into client object
|
|
// Load this current encrypted score into client object
|
|
prsonaClient->receive_vote_tally(encryptedScoreProof, encryptedScore);
|
|
prsonaClient->receive_vote_tally(encryptedScoreProof, encryptedScore);
|
|
|
|
|
|
- std::cout << "Converting encrypted score to an int." << std::endl;
|
|
|
|
-
|
|
|
|
// Choose a random (valid) threshold to make a proof for
|
|
// Choose a random (valid) threshold to make a proof for
|
|
mpz_class maxScore = prsonaClient->get_score().toInt();
|
|
mpz_class maxScore = prsonaClient->get_score().toInt();
|
|
-
|
|
|
|
- std::cout << "Converting encrypted score to a usable int." << std::endl;
|
|
|
|
int maxScoreInt = 0;
|
|
int maxScoreInt = 0;
|
|
while (maxScoreInt < maxScore)
|
|
while (maxScoreInt < maxScore)
|
|
maxScoreInt++;
|
|
maxScoreInt++;
|
|
std::uniform_int_distribution<int> scoreThresholdDistribution(0, maxScoreInt);
|
|
std::uniform_int_distribution<int> scoreThresholdDistribution(0, maxScoreInt);
|
|
Scalar threshold(scoreThresholdDistribution(rng));
|
|
Scalar threshold(scoreThresholdDistribution(rng));
|
|
|
|
|
|
- std::cout << "Making proof." << std::endl;
|
|
|
|
-
|
|
|
|
// Use client object to generate a correct reputation proof with the chosen parameters
|
|
// Use client object to generate a correct reputation proof with the chosen parameters
|
|
std::vector<Proof> repProof = prsonaClient->generate_reputation_proof(threshold, numClients);
|
|
std::vector<Proof> repProof = prsonaClient->generate_reputation_proof(threshold, numClients);
|
|
|
|
|
|
// Serialize that proof
|
|
// Serialize that proof
|
|
std::string data = make_rep_proof_string(repProof, shortTermPublicKey, threshold);
|
|
std::string data = make_rep_proof_string(repProof, shortTermPublicKey, threshold);
|
|
|
|
|
|
- std::cout << "Sending proof." << std::endl;
|
|
|
|
-
|
|
|
|
// Send that proof to a chosen client (and set up a file to receive whether or not the client accepted the proof)
|
|
// Send that proof to a chosen client (and set up a file to receive whether or not the client accepted the proof)
|
|
char *responseFile = send_item(rng, target, targetPort, VERIFY_REPUTATION_PROOF_URI, data, true, bandwidthData);
|
|
char *responseFile = send_item(rng, target, targetPort, VERIFY_REPUTATION_PROOF_URI, data, true, bandwidthData);
|
|
|
|
|
|
- std::cout << "Work done." << std::endl;
|
|
|
|
-
|
|
|
|
clock_t cpuTimeAfter = clock();
|
|
clock_t cpuTimeAfter = clock();
|
|
std::chrono::high_resolution_clock::time_point wallTimeAfter = std::chrono::high_resolution_clock::now();
|
|
std::chrono::high_resolution_clock::time_point wallTimeAfter = std::chrono::high_resolution_clock::now();
|
|
std::vector<size_t> bandwidthDataAfter = get_server_log_data(civetServer.getContext());
|
|
std::vector<size_t> bandwidthDataAfter = get_server_log_data(civetServer.getContext());
|