|
@@ -49,9 +49,9 @@ size_t PrsonaServer::get_num_servers() const
|
|
|
|
|
|
|
|
|
|
|
|
-Curvepoint PrsonaServer::add_curr_seed_to_generator(
|
|
|
+Twistpoint PrsonaServer::add_curr_seed_to_generator(
|
|
|
std::vector<Proof>& pi,
|
|
|
- const Curvepoint& currGenerator) const
|
|
|
+ const Twistpoint& currGenerator) const
|
|
|
{
|
|
|
pi.push_back(add_to_generator_proof(currGenerator, currentSeed));
|
|
|
|
|
@@ -60,9 +60,9 @@ Curvepoint PrsonaServer::add_curr_seed_to_generator(
|
|
|
|
|
|
|
|
|
|
|
|
-Curvepoint PrsonaServer::add_next_seed_to_generator(
|
|
|
+Twistpoint PrsonaServer::add_next_seed_to_generator(
|
|
|
std::vector<Proof>& pi,
|
|
|
- const Curvepoint& currGenerator) const
|
|
|
+ const Twistpoint& currGenerator) const
|
|
|
{
|
|
|
pi.push_back(add_to_generator_proof(currGenerator, nextSeed));
|
|
|
|
|
@@ -77,10 +77,10 @@ Curvepoint PrsonaServer::add_next_seed_to_generator(
|
|
|
* (who is identified by their short term public key).
|
|
|
* In practice, this is intended for clients,
|
|
|
* who need to know their current votes in order to rerandomize them. */
|
|
|
-std::vector<CurveBipoint> PrsonaServer::get_current_votes_by(
|
|
|
- Proof& pi, const Curvepoint& shortTermPublicKey) const
|
|
|
+std::vector<TwistBipoint> PrsonaServer::get_current_votes_by(
|
|
|
+ Proof& pi, const Twistpoint& shortTermPublicKey) const
|
|
|
{
|
|
|
- std::vector<CurveBipoint> retval;
|
|
|
+ std::vector<TwistBipoint> retval;
|
|
|
size_t voteSubmitter = binary_search(shortTermPublicKey);
|
|
|
retval = voteMatrix[voteSubmitter];
|
|
|
|
|
@@ -88,7 +88,7 @@ std::vector<CurveBipoint> PrsonaServer::get_current_votes_by(
|
|
|
return retval;
|
|
|
}
|
|
|
|
|
|
-std::vector<std::vector<CurveBipoint>> PrsonaServer::get_all_current_votes(
|
|
|
+std::vector<std::vector<TwistBipoint>> PrsonaServer::get_all_current_votes(
|
|
|
Proof& pi) const
|
|
|
{
|
|
|
pi = generate_valid_vote_matrix_proof(voteMatrix);
|
|
@@ -100,7 +100,7 @@ std::vector<std::vector<CurveBipoint>> PrsonaServer::get_all_current_votes(
|
|
|
* In practice, this is intended for clients, so that the servers vouch
|
|
|
* for their ciphertexts being valid as part of their reputation proofs. */
|
|
|
EGCiphertext PrsonaServer::get_current_user_encrypted_tally(
|
|
|
- Proof& pi, const Curvepoint& shortTermPublicKey) const
|
|
|
+ Proof& pi, const Twistpoint& shortTermPublicKey) const
|
|
|
{
|
|
|
EGCiphertext retval;
|
|
|
size_t tallyOwner = binary_search(shortTermPublicKey);
|
|
@@ -110,10 +110,10 @@ EGCiphertext PrsonaServer::get_current_user_encrypted_tally(
|
|
|
return retval;
|
|
|
}
|
|
|
|
|
|
-TwistBipoint PrsonaServer::get_current_server_encrypted_tally(
|
|
|
- Proof& pi, const Curvepoint& shortTermPublicKey) const
|
|
|
+CurveBipoint PrsonaServer::get_current_server_encrypted_tally(
|
|
|
+ Proof& pi, const Twistpoint& shortTermPublicKey) const
|
|
|
{
|
|
|
- TwistBipoint retval;
|
|
|
+ CurveBipoint retval;
|
|
|
size_t tallyOwner = binary_search(shortTermPublicKey);
|
|
|
retval = previousVoteTallies[tallyOwner];
|
|
|
|
|
@@ -121,7 +121,7 @@ TwistBipoint PrsonaServer::get_current_server_encrypted_tally(
|
|
|
return retval;
|
|
|
}
|
|
|
|
|
|
-std::vector<Curvepoint> PrsonaServer::get_current_pseudonyms(Proof& pi) const
|
|
|
+std::vector<Twistpoint> PrsonaServer::get_current_pseudonyms(Proof& pi) const
|
|
|
{
|
|
|
pi = generate_valid_pseudonyms_proof(currentPseudonyms);
|
|
|
return currentPseudonyms;
|
|
@@ -131,7 +131,7 @@ std::vector<Curvepoint> PrsonaServer::get_current_pseudonyms(Proof& pi) const
|
|
|
* PROOF COMMITMENT GETTERS
|
|
|
*/
|
|
|
|
|
|
-Proof PrsonaServer::get_vote_row_commitment(const Curvepoint& request) const
|
|
|
+Proof PrsonaServer::get_vote_row_commitment(const Twistpoint& request) const
|
|
|
{
|
|
|
size_t requestID = binary_search(request);
|
|
|
return generate_valid_vote_row_proof(voteMatrix[requestID]);
|
|
@@ -142,13 +142,13 @@ Proof PrsonaServer::get_vote_matrix_commitment() const
|
|
|
return generate_valid_vote_matrix_proof(voteMatrix);
|
|
|
}
|
|
|
|
|
|
-Proof PrsonaServer::get_user_tally_commitment(const Curvepoint& request) const
|
|
|
+Proof PrsonaServer::get_user_tally_commitment(const Twistpoint& request) const
|
|
|
{
|
|
|
size_t requestID = binary_search(request);
|
|
|
return generate_valid_user_tally_proof(currentUserEncryptedTallies[requestID]);
|
|
|
}
|
|
|
|
|
|
-Proof PrsonaServer::get_server_tally_commitment(const Curvepoint& request) const
|
|
|
+Proof PrsonaServer::get_server_tally_commitment(const Twistpoint& request) const
|
|
|
{
|
|
|
size_t requestID = binary_search(request);
|
|
|
return generate_valid_server_tally_proof(previousVoteTallies[requestID]);
|
|
@@ -169,7 +169,7 @@ Proof PrsonaServer::get_pseudonyms_commitment() const
|
|
|
void PrsonaServer::add_new_client(
|
|
|
std::vector<Proof>& proofOfValidAddition,
|
|
|
const Proof& proofOfValidKey,
|
|
|
- const Curvepoint& shortTermPublicKey)
|
|
|
+ const Twistpoint& shortTermPublicKey)
|
|
|
{
|
|
|
if (!verify_ownership_proof(
|
|
|
proofOfValidKey, currentFreshGenerator, shortTermPublicKey))
|
|
@@ -183,8 +183,8 @@ void PrsonaServer::add_new_client(
|
|
|
|
|
|
|
|
|
Scalar tallySeed;
|
|
|
- TwistBipoint encryptedDefaultTally =
|
|
|
- bgnSystem.get_public_key().twistEncrypt(tallySeed, DEFAULT_TALLY);
|
|
|
+ CurveBipoint encryptedDefaultTally =
|
|
|
+ bgnSystem.get_public_key().curveEncrypt(tallySeed, DEFAULT_TALLY);
|
|
|
previousVoteTallies.push_back(encryptedDefaultTally);
|
|
|
|
|
|
Scalar seedForUserTally;
|
|
@@ -197,14 +197,14 @@ void PrsonaServer::add_new_client(
|
|
|
currentUserEncryptedTallies.push_back(newUserEncryptedTally);
|
|
|
|
|
|
|
|
|
- CurveBipoint encryptedDefaultVote, encryptedSelfVote;
|
|
|
+ TwistBipoint encryptedDefaultVote, encryptedSelfVote;
|
|
|
Scalar currDefaultSeed, currSelfSeed;
|
|
|
encryptedDefaultVote =
|
|
|
- bgnSystem.get_public_key().curveEncrypt(currDefaultSeed, DEFAULT_VOTE);
|
|
|
+ bgnSystem.get_public_key().twistEncrypt(currDefaultSeed, DEFAULT_VOTE);
|
|
|
encryptedSelfVote =
|
|
|
- bgnSystem.get_public_key().curveEncrypt(currSelfSeed, Scalar(MAX_ALLOWED_VOTE));
|
|
|
+ bgnSystem.get_public_key().twistEncrypt(currSelfSeed, Scalar(MAX_ALLOWED_VOTE));
|
|
|
|
|
|
- std::vector<CurveBipoint> newRow;
|
|
|
+ std::vector<TwistBipoint> newRow;
|
|
|
std::vector<Scalar> userVoteSeeds;
|
|
|
std::vector<Scalar> otherVoteSeeds;
|
|
|
for (size_t i = 0; i < voteMatrix.size(); i++)
|
|
@@ -258,11 +258,11 @@ void PrsonaServer::add_new_client(
|
|
|
|
|
|
bool PrsonaServer::receive_vote(
|
|
|
const std::vector<Proof>& pi,
|
|
|
- const std::vector<CurveBipoint>& newVotes,
|
|
|
- const Curvepoint& shortTermPublicKey)
|
|
|
+ const std::vector<TwistBipoint>& newVotes,
|
|
|
+ const Twistpoint& shortTermPublicKey)
|
|
|
{
|
|
|
size_t voteSubmitter = binary_search(shortTermPublicKey);
|
|
|
- std::vector<CurveBipoint> oldVotes = voteMatrix[voteSubmitter];
|
|
|
+ std::vector<TwistBipoint> oldVotes = voteMatrix[voteSubmitter];
|
|
|
|
|
|
if (!verify_vote_proof(pi, oldVotes, newVotes, shortTermPublicKey))
|
|
|
return false;
|
|
@@ -286,7 +286,7 @@ const BGN& PrsonaServer::get_bgn_details() const
|
|
|
|
|
|
bool PrsonaServer::initialize_fresh_generator(
|
|
|
const std::vector<Proof>& pi,
|
|
|
- const Curvepoint& firstGenerator)
|
|
|
+ const Twistpoint& firstGenerator)
|
|
|
{
|
|
|
if (!verify_generator_proof(pi, firstGenerator, numServers))
|
|
|
{
|
|
@@ -300,9 +300,9 @@ bool PrsonaServer::initialize_fresh_generator(
|
|
|
|
|
|
|
|
|
|
|
|
-Curvepoint PrsonaServer::add_rand_seed_to_generator(
|
|
|
+Twistpoint PrsonaServer::add_rand_seed_to_generator(
|
|
|
std::vector<Proof>& pi,
|
|
|
- const Curvepoint& currGenerator) const
|
|
|
+ const Twistpoint& currGenerator) const
|
|
|
{
|
|
|
Scalar lambda;
|
|
|
lambda.set_random();
|
|
@@ -314,7 +314,7 @@ Curvepoint PrsonaServer::add_rand_seed_to_generator(
|
|
|
|
|
|
bool PrsonaServer::set_EG_blind_generator(
|
|
|
const std::vector<Proof>& pi,
|
|
|
- const Curvepoint& currGenerator)
|
|
|
+ const Twistpoint& currGenerator)
|
|
|
{
|
|
|
return PrsonaBase::set_EG_blind_generator(pi, currGenerator, numServers);
|
|
|
}
|
|
@@ -341,7 +341,7 @@ std::vector<Scalar> PrsonaServer::tally_scores()
|
|
|
{
|
|
|
Quadripoint curr =
|
|
|
bgnSystem.homomorphic_multiplication_no_rerandomize(
|
|
|
- voteMatrix[j][i], previousVoteTallies[j]);
|
|
|
+ previousVoteTallies[j], voteMatrix[j][i]);
|
|
|
|
|
|
weightedVotes.push_back(curr);
|
|
|
}
|
|
@@ -370,7 +370,7 @@ std::vector<Scalar> PrsonaServer::tally_scores()
|
|
|
Scalar PrsonaServer::get_max_possible_score()
|
|
|
{
|
|
|
|
|
|
- TwistBipoint currEncryptedVal = previousVoteTallies[0];
|
|
|
+ CurveBipoint currEncryptedVal = previousVoteTallies[0];
|
|
|
for (size_t i = 1; i < previousVoteTallies.size(); i++)
|
|
|
{
|
|
|
currEncryptedVal =
|
|
@@ -391,25 +391,25 @@ Scalar PrsonaServer::get_max_possible_score()
|
|
|
|
|
|
void PrsonaServer::build_up_midway_pseudonyms(
|
|
|
std::vector<std::vector<std::vector<Proof>>>& pi,
|
|
|
- std::vector<std::vector<std::vector<Curvepoint>>>& permutationCommits,
|
|
|
- std::vector<std::vector<std::vector<Curvepoint>>>& freshPseudonymCommits,
|
|
|
- std::vector<std::vector<std::vector<Curvepoint>>>& freshPseudonymSeedCommits,
|
|
|
- std::vector<std::vector<std::vector<TwistBipoint>>>& serverTallyCommits,
|
|
|
- std::vector<std::vector<std::vector<std::vector<CurveBipoint>>>>& partwayVoteMatrixCommits,
|
|
|
- std::vector<std::vector<std::vector<std::vector<CurveBipoint>>>>& finalVoteMatrixCommits,
|
|
|
- Curvepoint& nextGenerator)
|
|
|
+ std::vector<std::vector<std::vector<Twistpoint>>>& permutationCommits,
|
|
|
+ std::vector<std::vector<std::vector<Twistpoint>>>& freshPseudonymCommits,
|
|
|
+ std::vector<std::vector<std::vector<Twistpoint>>>& freshPseudonymSeedCommits,
|
|
|
+ std::vector<std::vector<std::vector<CurveBipoint>>>& serverTallyCommits,
|
|
|
+ std::vector<std::vector<std::vector<std::vector<TwistBipoint>>>>& partwayVoteMatrixCommits,
|
|
|
+ std::vector<std::vector<std::vector<std::vector<TwistBipoint>>>>& finalVoteMatrixCommits,
|
|
|
+ Twistpoint& nextGenerator)
|
|
|
{
|
|
|
nextSeed.set_random();
|
|
|
|
|
|
- std::vector<std::vector<Curvepoint>> currPermutationCommits;
|
|
|
- std::vector<std::vector<Curvepoint>> currFreshPseudonymCommits;
|
|
|
- std::vector<std::vector<Curvepoint>> currFreshPseudonymSeedCommits;
|
|
|
- std::vector<std::vector<TwistBipoint>> currServerTallyCommits;
|
|
|
- std::vector<std::vector<std::vector<CurveBipoint>>> currPartwayVoteMatrixCommits;
|
|
|
- std::vector<std::vector<std::vector<CurveBipoint>>> currFinalVoteMatrixCommits;
|
|
|
- std::vector<std::vector<Curvepoint>> currUserTallyMaskCommits;
|
|
|
- std::vector<std::vector<Curvepoint>> currUserTallyMessageCommits;
|
|
|
- std::vector<std::vector<Curvepoint>> currUserTallySeedCommits;
|
|
|
+ std::vector<std::vector<Twistpoint>> currPermutationCommits;
|
|
|
+ std::vector<std::vector<Twistpoint>> currFreshPseudonymCommits;
|
|
|
+ std::vector<std::vector<Twistpoint>> currFreshPseudonymSeedCommits;
|
|
|
+ std::vector<std::vector<CurveBipoint>> currServerTallyCommits;
|
|
|
+ std::vector<std::vector<std::vector<TwistBipoint>>> currPartwayVoteMatrixCommits;
|
|
|
+ std::vector<std::vector<std::vector<TwistBipoint>>> currFinalVoteMatrixCommits;
|
|
|
+ std::vector<std::vector<Twistpoint>> currUserTallyMaskCommits;
|
|
|
+ std::vector<std::vector<Twistpoint>> currUserTallyMessageCommits;
|
|
|
+ std::vector<std::vector<Twistpoint>> currUserTallySeedCommits;
|
|
|
pi.push_back(epoch_calculations(
|
|
|
currPermutationCommits,
|
|
|
currFreshPseudonymCommits,
|
|
@@ -443,16 +443,16 @@ void PrsonaServer::build_up_midway_pseudonyms(
|
|
|
void PrsonaServer::break_down_midway_pseudonyms(
|
|
|
std::vector<Proof>& generatorProof,
|
|
|
std::vector<std::vector<std::vector<Proof>>>& pi,
|
|
|
- std::vector<std::vector<std::vector<Curvepoint>>>& permutationCommits,
|
|
|
- std::vector<std::vector<std::vector<Curvepoint>>>& freshPseudonymCommits,
|
|
|
- std::vector<std::vector<std::vector<Curvepoint>>>& freshPseudonymSeedCommits,
|
|
|
- std::vector<std::vector<std::vector<TwistBipoint>>>& serverTallyCommits,
|
|
|
- std::vector<std::vector<std::vector<std::vector<CurveBipoint>>>>& partwayVoteMatrixCommits,
|
|
|
- std::vector<std::vector<std::vector<std::vector<CurveBipoint>>>>& finalVoteMatrixCommits,
|
|
|
- std::vector<std::vector<std::vector<Curvepoint>>>& userTallyMaskCommits,
|
|
|
- std::vector<std::vector<std::vector<Curvepoint>>>& userTallyMessageCommits,
|
|
|
- std::vector<std::vector<std::vector<Curvepoint>>>& userTallySeedCommits,
|
|
|
- const Curvepoint& nextGenerator)
|
|
|
+ std::vector<std::vector<std::vector<Twistpoint>>>& permutationCommits,
|
|
|
+ std::vector<std::vector<std::vector<Twistpoint>>>& freshPseudonymCommits,
|
|
|
+ std::vector<std::vector<std::vector<Twistpoint>>>& freshPseudonymSeedCommits,
|
|
|
+ std::vector<std::vector<std::vector<CurveBipoint>>>& serverTallyCommits,
|
|
|
+ std::vector<std::vector<std::vector<std::vector<TwistBipoint>>>>& partwayVoteMatrixCommits,
|
|
|
+ std::vector<std::vector<std::vector<std::vector<TwistBipoint>>>>& finalVoteMatrixCommits,
|
|
|
+ std::vector<std::vector<std::vector<Twistpoint>>>& userTallyMaskCommits,
|
|
|
+ std::vector<std::vector<std::vector<Twistpoint>>>& userTallyMessageCommits,
|
|
|
+ std::vector<std::vector<std::vector<Twistpoint>>>& userTallySeedCommits,
|
|
|
+ const Twistpoint& nextGenerator)
|
|
|
{
|
|
|
if (!initialize_fresh_generator(generatorProof, nextGenerator))
|
|
|
{
|
|
@@ -462,15 +462,15 @@ void PrsonaServer::break_down_midway_pseudonyms(
|
|
|
|
|
|
Scalar inverseSeed = currentSeed.curveMultInverse();
|
|
|
|
|
|
- std::vector<std::vector<Curvepoint>> currPermutationCommits;
|
|
|
- std::vector<std::vector<Curvepoint>> currFreshPseudonymCommits;
|
|
|
- std::vector<std::vector<Curvepoint>> currFreshPseudonymSeedCommits;
|
|
|
- std::vector<std::vector<TwistBipoint>> currServerTallyCommits;
|
|
|
- std::vector<std::vector<std::vector<CurveBipoint>>> currPartwayVoteMatrixCommits;
|
|
|
- std::vector<std::vector<std::vector<CurveBipoint>>> currFinalVoteMatrixCommits;
|
|
|
- std::vector<std::vector<Curvepoint>> currUserTallyMaskCommits;
|
|
|
- std::vector<std::vector<Curvepoint>> currUserTallyMessageCommits;
|
|
|
- std::vector<std::vector<Curvepoint>> currUserTallySeedCommits;
|
|
|
+ std::vector<std::vector<Twistpoint>> currPermutationCommits;
|
|
|
+ std::vector<std::vector<Twistpoint>> currFreshPseudonymCommits;
|
|
|
+ std::vector<std::vector<Twistpoint>> currFreshPseudonymSeedCommits;
|
|
|
+ std::vector<std::vector<CurveBipoint>> currServerTallyCommits;
|
|
|
+ std::vector<std::vector<std::vector<TwistBipoint>>> currPartwayVoteMatrixCommits;
|
|
|
+ std::vector<std::vector<std::vector<TwistBipoint>>> currFinalVoteMatrixCommits;
|
|
|
+ std::vector<std::vector<Twistpoint>> currUserTallyMaskCommits;
|
|
|
+ std::vector<std::vector<Twistpoint>> currUserTallyMessageCommits;
|
|
|
+ std::vector<std::vector<Twistpoint>> currUserTallySeedCommits;
|
|
|
pi.push_back(epoch_calculations(
|
|
|
currPermutationCommits,
|
|
|
currFreshPseudonymCommits,
|
|
@@ -503,17 +503,17 @@ void PrsonaServer::break_down_midway_pseudonyms(
|
|
|
*/
|
|
|
|
|
|
std::vector<std::vector<Proof>> PrsonaServer::epoch_calculations(
|
|
|
- std::vector<std::vector<Curvepoint>>& permutationCommits,
|
|
|
- std::vector<std::vector<Curvepoint>>& freshPseudonymCommits,
|
|
|
- std::vector<std::vector<Curvepoint>>& freshPseudonymSeedCommits,
|
|
|
- std::vector<std::vector<TwistBipoint>>& serverTallyCommits,
|
|
|
- std::vector<std::vector<std::vector<CurveBipoint>>>& partwayVoteMatrixCommits,
|
|
|
- std::vector<std::vector<std::vector<CurveBipoint>>>& finalVoteMatrixCommits,
|
|
|
- std::vector<std::vector<Curvepoint>>& userTallyMaskCommits,
|
|
|
- std::vector<std::vector<Curvepoint>>& userTallyMessageCommits,
|
|
|
- std::vector<std::vector<Curvepoint>>& userTallySeedCommits,
|
|
|
+ std::vector<std::vector<Twistpoint>>& permutationCommits,
|
|
|
+ std::vector<std::vector<Twistpoint>>& freshPseudonymCommits,
|
|
|
+ std::vector<std::vector<Twistpoint>>& freshPseudonymSeedCommits,
|
|
|
+ std::vector<std::vector<CurveBipoint>>& serverTallyCommits,
|
|
|
+ std::vector<std::vector<std::vector<TwistBipoint>>>& partwayVoteMatrixCommits,
|
|
|
+ std::vector<std::vector<std::vector<TwistBipoint>>>& finalVoteMatrixCommits,
|
|
|
+ std::vector<std::vector<Twistpoint>>& userTallyMaskCommits,
|
|
|
+ std::vector<std::vector<Twistpoint>>& userTallyMessageCommits,
|
|
|
+ std::vector<std::vector<Twistpoint>>& userTallySeedCommits,
|
|
|
const Scalar& power,
|
|
|
- const Curvepoint& nextGenerator,
|
|
|
+ const Twistpoint& nextGenerator,
|
|
|
bool doUserTallies)
|
|
|
{
|
|
|
std::vector<std::vector<Proof>> retval;
|
|
@@ -558,15 +558,15 @@ std::vector<std::vector<Proof>> PrsonaServer::epoch_calculations(
|
|
|
serverTallySeeds);
|
|
|
|
|
|
retval.push_back(
|
|
|
- generate_proof_of_reordering<TwistBipoint>(
|
|
|
+ generate_proof_of_reordering<CurveBipoint>(
|
|
|
permutations,
|
|
|
permutationSeeds,
|
|
|
serverTallySeeds,
|
|
|
previousVoteTallies,
|
|
|
permutationCommits,
|
|
|
serverTallyCommits,
|
|
|
- bgnSystem.get_public_key().get_bipoint_twistgen(),
|
|
|
- bgnSystem.get_public_key().get_bipoint_twist_subgroup_gen()));
|
|
|
+ bgnSystem.get_public_key().get_bipoint_curvegen(),
|
|
|
+ bgnSystem.get_public_key().get_bipoint_curve_subgroup_gen()));
|
|
|
|
|
|
std::vector<std::vector<std::vector<Scalar>>> partwayVoteMatrixSeeds;
|
|
|
std::vector<std::vector<std::vector<Scalar>>> finalVoteMatrixSeeds;
|
|
@@ -577,7 +577,7 @@ std::vector<std::vector<Proof>> PrsonaServer::epoch_calculations(
|
|
|
partwayVoteMatrixSeeds,
|
|
|
false);
|
|
|
|
|
|
- std::vector<std::vector<CurveBipoint>> partialVoteMatrix =
|
|
|
+ std::vector<std::vector<TwistBipoint>> partialVoteMatrix =
|
|
|
calculate_next_vote_matrix(partwayVoteMatrixCommits);
|
|
|
|
|
|
finalVoteMatrixCommits.clear();
|
|
@@ -609,8 +609,8 @@ std::vector<std::vector<Proof>> PrsonaServer::epoch_calculations(
|
|
|
|
|
|
if (doUserTallies)
|
|
|
{
|
|
|
- std::vector<Curvepoint> userTallyMasks;
|
|
|
- std::vector<Curvepoint> userTallyMessages;
|
|
|
+ std::vector<Twistpoint> userTallyMasks;
|
|
|
+ std::vector<Twistpoint> userTallyMessages;
|
|
|
std::vector<std::vector<Scalar>> userTallySeeds;
|
|
|
userTallyMaskCommits.clear();
|
|
|
userTallyMessageCommits.clear();
|
|
@@ -656,16 +656,16 @@ std::vector<std::vector<Proof>> PrsonaServer::epoch_calculations(
|
|
|
|
|
|
bool PrsonaServer::accept_epoch_updates(
|
|
|
const std::vector<std::vector<Proof>>& pi,
|
|
|
- const std::vector<std::vector<Curvepoint>>& permutationCommits,
|
|
|
- const std::vector<std::vector<Curvepoint>>& freshPseudonymCommits,
|
|
|
- const std::vector<std::vector<Curvepoint>>& freshPseudonymSeedCommits,
|
|
|
- const std::vector<std::vector<TwistBipoint>>& serverTallyCommits,
|
|
|
- const std::vector<std::vector<std::vector<CurveBipoint>>>& partwayVoteMatrixCommits,
|
|
|
- const std::vector<std::vector<std::vector<CurveBipoint>>>& finalVoteMatrixCommits,
|
|
|
- const std::vector<std::vector<Curvepoint>>& userTallyMaskCommits,
|
|
|
- const std::vector<std::vector<Curvepoint>>& userTallyMessageCommits,
|
|
|
- const std::vector<std::vector<Curvepoint>>& userTallySeedCommits,
|
|
|
- const Curvepoint& nextGenerator,
|
|
|
+ const std::vector<std::vector<Twistpoint>>& permutationCommits,
|
|
|
+ const std::vector<std::vector<Twistpoint>>& freshPseudonymCommits,
|
|
|
+ const std::vector<std::vector<Twistpoint>>& freshPseudonymSeedCommits,
|
|
|
+ const std::vector<std::vector<CurveBipoint>>& serverTallyCommits,
|
|
|
+ const std::vector<std::vector<std::vector<TwistBipoint>>>& partwayVoteMatrixCommits,
|
|
|
+ const std::vector<std::vector<std::vector<TwistBipoint>>>& finalVoteMatrixCommits,
|
|
|
+ const std::vector<std::vector<Twistpoint>>& userTallyMaskCommits,
|
|
|
+ const std::vector<std::vector<Twistpoint>>& userTallyMessageCommits,
|
|
|
+ const std::vector<std::vector<Twistpoint>>& userTallySeedCommits,
|
|
|
+ const Twistpoint& nextGenerator,
|
|
|
bool doUserTallies)
|
|
|
{
|
|
|
bool verification;
|
|
@@ -705,13 +705,13 @@ bool PrsonaServer::accept_epoch_updates(
|
|
|
}
|
|
|
|
|
|
verification =
|
|
|
- verify_proof_of_reordering<TwistBipoint>(
|
|
|
+ verify_proof_of_reordering<CurveBipoint>(
|
|
|
pi[currOffset],
|
|
|
previousVoteTallies,
|
|
|
permutationCommits,
|
|
|
serverTallyCommits,
|
|
|
- bgnSystem.get_public_key().get_bipoint_twistgen(),
|
|
|
- bgnSystem.get_public_key().get_bipoint_twist_subgroup_gen());
|
|
|
+ bgnSystem.get_public_key().get_bipoint_curvegen(),
|
|
|
+ bgnSystem.get_public_key().get_bipoint_curve_subgroup_gen());
|
|
|
currOffset++;
|
|
|
if (!verification)
|
|
|
{
|
|
@@ -733,7 +733,7 @@ bool PrsonaServer::accept_epoch_updates(
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- std::vector<std::vector<CurveBipoint>> partialVoteMatrix =
|
|
|
+ std::vector<std::vector<TwistBipoint>> partialVoteMatrix =
|
|
|
calculate_next_vote_matrix(partwayVoteMatrixCommits);
|
|
|
verification = verify_vote_tensor_proofs(
|
|
|
pi,
|
|
@@ -751,8 +751,8 @@ bool PrsonaServer::accept_epoch_updates(
|
|
|
|
|
|
if (doUserTallies)
|
|
|
{
|
|
|
- std::vector<Curvepoint> userTallyMasks;
|
|
|
- std::vector<Curvepoint> userTallyMessages;
|
|
|
+ std::vector<Twistpoint> userTallyMasks;
|
|
|
+ std::vector<Twistpoint> userTallyMessages;
|
|
|
for (size_t i = 0; i < currentUserEncryptedTallies.size(); i++)
|
|
|
{
|
|
|
userTallyMasks.push_back(currentUserEncryptedTallies[i].mask);
|
|
@@ -800,7 +800,7 @@ std::vector<std::vector<Scalar>> PrsonaServer::generate_permutation_matrix(
|
|
|
retval.push_back(currRow);
|
|
|
}
|
|
|
|
|
|
- std::vector<Curvepoint> nextPseudonyms;
|
|
|
+ std::vector<Twistpoint> nextPseudonyms;
|
|
|
for (size_t i = 0; i < currentPseudonyms.size(); i++)
|
|
|
nextPseudonyms.push_back(currentPseudonyms[i] * reorderSeed);
|
|
|
|
|
@@ -820,13 +820,13 @@ std::vector<std::vector<Scalar>> PrsonaServer::generate_permutation_matrix(
|
|
|
return retval;
|
|
|
}
|
|
|
|
|
|
-std::vector<std::vector<Curvepoint>> PrsonaServer::generate_commitment_matrix(
|
|
|
+std::vector<std::vector<Twistpoint>> PrsonaServer::generate_commitment_matrix(
|
|
|
const std::vector<std::vector<Scalar>>& permutations,
|
|
|
std::vector<std::vector<Scalar>>& seeds) const
|
|
|
{
|
|
|
- std::vector<std::vector<Curvepoint>> retval;
|
|
|
- Curvepoint g = EL_GAMAL_GENERATOR;
|
|
|
- Curvepoint h = elGamalBlindGenerator;
|
|
|
+ std::vector<std::vector<Twistpoint>> retval;
|
|
|
+ Twistpoint g = EL_GAMAL_GENERATOR;
|
|
|
+ Twistpoint h = elGamalBlindGenerator;
|
|
|
|
|
|
seeds.clear();
|
|
|
for (size_t i = 0; i < permutations.size(); i++)
|
|
@@ -841,12 +841,12 @@ std::vector<std::vector<Curvepoint>> PrsonaServer::generate_commitment_matrix(
|
|
|
|
|
|
for (size_t i = 0; i < permutations.size(); i++)
|
|
|
{
|
|
|
- std::vector<Curvepoint> currRow;
|
|
|
+ std::vector<Twistpoint> currRow;
|
|
|
|
|
|
size_t last = permutations[i].size() - 1;
|
|
|
for (size_t j = 0; j < permutations[i].size(); j++)
|
|
|
{
|
|
|
- Curvepoint element;
|
|
|
+ Twistpoint element;
|
|
|
|
|
|
if (j != last)
|
|
|
{
|
|
@@ -864,13 +864,13 @@ std::vector<std::vector<Curvepoint>> PrsonaServer::generate_commitment_matrix(
|
|
|
return retval;
|
|
|
}
|
|
|
|
|
|
-std::vector<std::vector<Curvepoint>> PrsonaServer::generate_pseudonym_matrix(
|
|
|
+std::vector<std::vector<Twistpoint>> PrsonaServer::generate_pseudonym_matrix(
|
|
|
const std::vector<std::vector<Scalar>>& permutations,
|
|
|
const Scalar& power,
|
|
|
std::vector<std::vector<Scalar>>& seeds,
|
|
|
- std::vector<std::vector<Curvepoint>>& seedCommits) const
|
|
|
+ std::vector<std::vector<Twistpoint>>& seedCommits) const
|
|
|
{
|
|
|
- return generate_reordered_plus_power_matrix<Curvepoint>(
|
|
|
+ return generate_reordered_plus_power_matrix<Twistpoint>(
|
|
|
permutations,
|
|
|
power,
|
|
|
currentPseudonyms,
|
|
@@ -879,31 +879,31 @@ std::vector<std::vector<Curvepoint>> PrsonaServer::generate_pseudonym_matrix(
|
|
|
elGamalBlindGenerator);
|
|
|
}
|
|
|
|
|
|
-std::vector<std::vector<TwistBipoint>> PrsonaServer::generate_server_tally_matrix(
|
|
|
+std::vector<std::vector<CurveBipoint>> PrsonaServer::generate_server_tally_matrix(
|
|
|
const std::vector<std::vector<Scalar>>& permutations,
|
|
|
std::vector<std::vector<Scalar>>& seeds) const
|
|
|
{
|
|
|
- return generate_reordered_matrix<TwistBipoint>(
|
|
|
+ return generate_reordered_matrix<CurveBipoint>(
|
|
|
permutations,
|
|
|
previousVoteTallies,
|
|
|
seeds,
|
|
|
- bgnSystem.get_public_key().get_bipoint_twist_subgroup_gen(),
|
|
|
+ bgnSystem.get_public_key().get_bipoint_curve_subgroup_gen(),
|
|
|
false);
|
|
|
}
|
|
|
|
|
|
-std::vector<std::vector<std::vector<CurveBipoint>>> PrsonaServer::generate_vote_tensor(
|
|
|
+std::vector<std::vector<std::vector<TwistBipoint>>> PrsonaServer::generate_vote_tensor(
|
|
|
const std::vector<std::vector<Scalar>>& permutations,
|
|
|
- const std::vector<std::vector<CurveBipoint>>& currVoteMatrix,
|
|
|
+ const std::vector<std::vector<TwistBipoint>>& currVoteMatrix,
|
|
|
std::vector<std::vector<std::vector<Scalar>>>& seeds,
|
|
|
bool inverted) const
|
|
|
{
|
|
|
- std::vector<std::vector<std::vector<CurveBipoint>>> retval;
|
|
|
+ std::vector<std::vector<std::vector<TwistBipoint>>> retval;
|
|
|
|
|
|
for (size_t i = 0; i < currVoteMatrix.size(); i++)
|
|
|
{
|
|
|
std::vector<std::vector<Scalar>> currSeeds;
|
|
|
|
|
|
- std::vector<CurveBipoint> inputRow;
|
|
|
+ std::vector<TwistBipoint> inputRow;
|
|
|
if (inverted)
|
|
|
{
|
|
|
for (size_t j = 0; j < currVoteMatrix.size(); j++)
|
|
@@ -914,11 +914,11 @@ std::vector<std::vector<std::vector<CurveBipoint>>> PrsonaServer::generate_vote_
|
|
|
inputRow = currVoteMatrix[i];
|
|
|
}
|
|
|
|
|
|
- retval.push_back(generate_reordered_matrix<CurveBipoint>(
|
|
|
+ retval.push_back(generate_reordered_matrix<TwistBipoint>(
|
|
|
permutations,
|
|
|
inputRow,
|
|
|
currSeeds,
|
|
|
- bgnSystem.get_public_key().get_bipoint_curve_subgroup_gen(),
|
|
|
+ bgnSystem.get_public_key().get_bipoint_twist_subgroup_gen(),
|
|
|
false));
|
|
|
|
|
|
seeds.push_back(currSeeds);
|
|
@@ -927,17 +927,17 @@ std::vector<std::vector<std::vector<CurveBipoint>>> PrsonaServer::generate_vote_
|
|
|
return retval;
|
|
|
}
|
|
|
|
|
|
-std::vector<std::vector<CurveBipoint>> PrsonaServer::calculate_next_vote_matrix(
|
|
|
- const std::vector<std::vector<std::vector<CurveBipoint>>>& voteTensor) const
|
|
|
+std::vector<std::vector<TwistBipoint>> PrsonaServer::calculate_next_vote_matrix(
|
|
|
+ const std::vector<std::vector<std::vector<TwistBipoint>>>& voteTensor) const
|
|
|
{
|
|
|
- std::vector<std::vector<CurveBipoint>> retval;
|
|
|
+ std::vector<std::vector<TwistBipoint>> retval;
|
|
|
|
|
|
for (size_t i = 0; i < voteTensor.size(); i++)
|
|
|
{
|
|
|
- std::vector<CurveBipoint> currRow;
|
|
|
+ std::vector<TwistBipoint> currRow;
|
|
|
for (size_t j = 0; j < voteTensor[i].size(); j++)
|
|
|
{
|
|
|
- CurveBipoint sum = voteTensor[i][j][0];
|
|
|
+ TwistBipoint sum = voteTensor[i][j][0];
|
|
|
|
|
|
for (size_t k = 1; k < voteTensor[i][j].size(); k++)
|
|
|
sum = sum + voteTensor[i][j][k];
|
|
@@ -955,14 +955,14 @@ void PrsonaServer::generate_vote_tensor_proofs(
|
|
|
const std::vector<std::vector<Scalar>>& permutations,
|
|
|
const std::vector<std::vector<Scalar>>& permutationSeeds,
|
|
|
const std::vector<std::vector<std::vector<Scalar>>>& matrixSeeds,
|
|
|
- const std::vector<std::vector<CurveBipoint>>& currMatrix,
|
|
|
- const std::vector<std::vector<Curvepoint>>& permutationCommits,
|
|
|
- const std::vector<std::vector<std::vector<CurveBipoint>>>& matrixCommits,
|
|
|
+ const std::vector<std::vector<TwistBipoint>>& currMatrix,
|
|
|
+ const std::vector<std::vector<Twistpoint>>& permutationCommits,
|
|
|
+ const std::vector<std::vector<std::vector<TwistBipoint>>>& matrixCommits,
|
|
|
bool inverted) const
|
|
|
{
|
|
|
for (size_t i = 0; i < currMatrix.size(); i++)
|
|
|
{
|
|
|
- std::vector<CurveBipoint> inputRow;
|
|
|
+ std::vector<TwistBipoint> inputRow;
|
|
|
if (inverted)
|
|
|
{
|
|
|
for (size_t j = 0; j < currMatrix.size(); j++)
|
|
@@ -973,31 +973,31 @@ void PrsonaServer::generate_vote_tensor_proofs(
|
|
|
inputRow = currMatrix[i];
|
|
|
}
|
|
|
|
|
|
- pi.push_back(generate_proof_of_reordering<CurveBipoint>(
|
|
|
+ pi.push_back(generate_proof_of_reordering<TwistBipoint>(
|
|
|
permutations,
|
|
|
permutationSeeds,
|
|
|
matrixSeeds[i],
|
|
|
inputRow,
|
|
|
permutationCommits,
|
|
|
matrixCommits[i],
|
|
|
- bgnSystem.get_public_key().get_bipoint_curvegen(),
|
|
|
- bgnSystem.get_public_key().get_bipoint_curve_subgroup_gen()));
|
|
|
+ bgnSystem.get_public_key().get_bipoint_twistgen(),
|
|
|
+ bgnSystem.get_public_key().get_bipoint_twist_subgroup_gen()));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
bool PrsonaServer::verify_vote_tensor_proofs(
|
|
|
const std::vector<std::vector<Proof>>& pi,
|
|
|
size_t start_offset,
|
|
|
- const std::vector<std::vector<CurveBipoint>>& currMatrix,
|
|
|
- const std::vector<std::vector<Curvepoint>>& permutationCommits,
|
|
|
- const std::vector<std::vector<std::vector<CurveBipoint>>>& matrixCommits,
|
|
|
+ const std::vector<std::vector<TwistBipoint>>& currMatrix,
|
|
|
+ const std::vector<std::vector<Twistpoint>>& permutationCommits,
|
|
|
+ const std::vector<std::vector<std::vector<TwistBipoint>>>& matrixCommits,
|
|
|
bool inverted) const
|
|
|
{
|
|
|
bool retval = true;
|
|
|
|
|
|
for (size_t i = 0; i < currMatrix.size(); i++)
|
|
|
{
|
|
|
- std::vector<CurveBipoint> inputRow;
|
|
|
+ std::vector<TwistBipoint> inputRow;
|
|
|
if (inverted)
|
|
|
{
|
|
|
for (size_t j = 0; j < currMatrix.size(); j++)
|
|
@@ -1009,13 +1009,13 @@ bool PrsonaServer::verify_vote_tensor_proofs(
|
|
|
}
|
|
|
|
|
|
size_t whichProof = i + start_offset;
|
|
|
- retval = retval && verify_proof_of_reordering<CurveBipoint>(
|
|
|
+ retval = retval && verify_proof_of_reordering<TwistBipoint>(
|
|
|
pi[whichProof],
|
|
|
inputRow,
|
|
|
permutationCommits,
|
|
|
matrixCommits[i],
|
|
|
- bgnSystem.get_public_key().get_bipoint_curvegen(),
|
|
|
- bgnSystem.get_public_key().get_bipoint_curve_subgroup_gen());
|
|
|
+ bgnSystem.get_public_key().get_bipoint_twistgen(),
|
|
|
+ bgnSystem.get_public_key().get_bipoint_twist_subgroup_gen());
|
|
|
}
|
|
|
|
|
|
return retval;
|
|
@@ -1024,14 +1024,14 @@ bool PrsonaServer::verify_vote_tensor_proofs(
|
|
|
void PrsonaServer::generate_user_tally_matrix(
|
|
|
const std::vector<std::vector<Scalar>>& permutations,
|
|
|
const Scalar& power,
|
|
|
- const Curvepoint& nextGenerator,
|
|
|
- const std::vector<Curvepoint>& currPseudonyms,
|
|
|
- std::vector<Curvepoint>& masks,
|
|
|
- std::vector<std::vector<Curvepoint>>& maskCommits,
|
|
|
- std::vector<Curvepoint>& messages,
|
|
|
- std::vector<std::vector<Curvepoint>>& messageCommits,
|
|
|
+ const Twistpoint& nextGenerator,
|
|
|
+ const std::vector<Twistpoint>& currPseudonyms,
|
|
|
+ std::vector<Twistpoint>& masks,
|
|
|
+ std::vector<std::vector<Twistpoint>>& maskCommits,
|
|
|
+ std::vector<Twistpoint>& messages,
|
|
|
+ std::vector<std::vector<Twistpoint>>& messageCommits,
|
|
|
std::vector<std::vector<Scalar>>& userTallySeeds,
|
|
|
- std::vector<std::vector<Curvepoint>>& userTallySeedCommits) const
|
|
|
+ std::vector<std::vector<Twistpoint>>& userTallySeedCommits) const
|
|
|
{
|
|
|
masks.clear();
|
|
|
messages.clear();
|
|
@@ -1049,11 +1049,11 @@ void PrsonaServer::generate_user_tally_matrix(
|
|
|
for (size_t i = 0; i < permutations.size(); i++)
|
|
|
{
|
|
|
std::vector<Scalar> currSeeds;
|
|
|
- std::vector<Curvepoint> currRow;
|
|
|
+ std::vector<Twistpoint> currRow;
|
|
|
for (size_t j = 0; j < permutations[i].size(); j++)
|
|
|
{
|
|
|
currSeeds.push_back(Scalar(0));
|
|
|
- currRow.push_back(Curvepoint());
|
|
|
+ currRow.push_back(Twistpoint());
|
|
|
}
|
|
|
userTallySeeds.push_back(currSeeds);
|
|
|
maskCommits.push_back(currRow);
|
|
@@ -1096,7 +1096,7 @@ std::vector<std::vector<T>> PrsonaServer::generate_reordered_plus_power_matrix(
|
|
|
const Scalar& power,
|
|
|
const std::vector<T>& oldValues,
|
|
|
std::vector<std::vector<Scalar>>& seeds,
|
|
|
- std::vector<std::vector<Curvepoint>>& seedCommits,
|
|
|
+ std::vector<std::vector<Twistpoint>>& seedCommits,
|
|
|
const T& h) const
|
|
|
{
|
|
|
std::vector<std::vector<Scalar>> permutation_plus_power;
|
|
@@ -1105,11 +1105,11 @@ std::vector<std::vector<T>> PrsonaServer::generate_reordered_plus_power_matrix(
|
|
|
for (size_t i = 0; i < permutations.size(); i++)
|
|
|
{
|
|
|
std::vector<Scalar> currPermutations;
|
|
|
- std::vector<Curvepoint> currSeedCommits;
|
|
|
+ std::vector<Twistpoint> currSeedCommits;
|
|
|
for (size_t j = 0; j < permutations[i].size(); j++)
|
|
|
{
|
|
|
currPermutations.push_back(permutations[i][j] * power);
|
|
|
- currSeedCommits.push_back(Curvepoint());
|
|
|
+ currSeedCommits.push_back(Twistpoint());
|
|
|
}
|
|
|
permutation_plus_power.push_back(currPermutations);
|
|
|
seedCommits.push_back(currSeedCommits);
|
|
@@ -1176,7 +1176,7 @@ std::vector<std::vector<T>> PrsonaServer::generate_reordered_matrix(
|
|
|
return retval;
|
|
|
}
|
|
|
|
|
|
-std::vector<size_t> PrsonaServer::sort_data(const std::vector<Curvepoint>& inputs) const
|
|
|
+std::vector<size_t> PrsonaServer::sort_data(const std::vector<Twistpoint>& inputs) const
|
|
|
{
|
|
|
std::vector<size_t> retval;
|
|
|
|
|
@@ -1200,22 +1200,22 @@ std::vector<size_t> PrsonaServer::sort_data(const std::vector<Curvepoint>& input
|
|
|
}
|
|
|
|
|
|
bool PrsonaServer::update_data(
|
|
|
- const std::vector<std::vector<Curvepoint>>& freshPseudonymCommits,
|
|
|
- const std::vector<std::vector<TwistBipoint>>& serverTallyCommits,
|
|
|
- const std::vector<std::vector<std::vector<CurveBipoint>>>& voteMatrixCommits,
|
|
|
- const std::vector<std::vector<Curvepoint>>& userTallyMaskCommits,
|
|
|
- const std::vector<std::vector<Curvepoint>>& userTallyMessageCommits)
|
|
|
+ const std::vector<std::vector<Twistpoint>>& freshPseudonymCommits,
|
|
|
+ const std::vector<std::vector<CurveBipoint>>& serverTallyCommits,
|
|
|
+ const std::vector<std::vector<std::vector<TwistBipoint>>>& voteMatrixCommits,
|
|
|
+ const std::vector<std::vector<Twistpoint>>& userTallyMaskCommits,
|
|
|
+ const std::vector<std::vector<Twistpoint>>& userTallyMessageCommits)
|
|
|
{
|
|
|
- std::vector<Curvepoint> newPseudonyms;
|
|
|
- std::vector<TwistBipoint> newVoteTallies;
|
|
|
+ std::vector<Twistpoint> newPseudonyms;
|
|
|
+ std::vector<CurveBipoint> newVoteTallies;
|
|
|
std::vector<EGCiphertext> newUserTallies;
|
|
|
|
|
|
for (size_t i = 0; i < freshPseudonymCommits.size(); i++)
|
|
|
{
|
|
|
- Curvepoint pseudonymSum = freshPseudonymCommits[i][0];
|
|
|
- TwistBipoint voteTallySum = serverTallyCommits[i][0];
|
|
|
+ Twistpoint pseudonymSum = freshPseudonymCommits[i][0];
|
|
|
+ CurveBipoint voteTallySum = serverTallyCommits[i][0];
|
|
|
|
|
|
- Curvepoint userTallyMask, userTallyMessage;
|
|
|
+ Twistpoint userTallyMask, userTallyMessage;
|
|
|
if (!userTallyMaskCommits.empty())
|
|
|
{
|
|
|
userTallyMask = userTallyMaskCommits[i][0];
|
|
@@ -1261,7 +1261,7 @@ bool PrsonaServer::update_data(
|
|
|
}
|
|
|
|
|
|
bool PrsonaServer::pseudonyms_sorted(
|
|
|
- const std::vector<Curvepoint> newPseudonyms) const
|
|
|
+ const std::vector<Twistpoint> newPseudonyms) const
|
|
|
{
|
|
|
bool retval = true;
|
|
|
|
|
@@ -1277,26 +1277,26 @@ bool PrsonaServer::pseudonyms_sorted(
|
|
|
|
|
|
bool PrsonaServer::import_new_user_update(
|
|
|
const std::vector<Proof>& pi,
|
|
|
- const std::vector<TwistBipoint>& otherPreviousVoteTallies,
|
|
|
- const std::vector<Curvepoint>& otherCurrentPseudonyms,
|
|
|
+ const std::vector<CurveBipoint>& otherPreviousVoteTallies,
|
|
|
+ const std::vector<Twistpoint>& otherCurrentPseudonyms,
|
|
|
const std::vector<EGCiphertext>& otherCurrentUserEncryptedTallies,
|
|
|
- const std::vector<std::vector<CurveBipoint>>& otherVoteMatrix)
|
|
|
+ const std::vector<std::vector<TwistBipoint>>& otherVoteMatrix)
|
|
|
{
|
|
|
size_t newIndex = 0;
|
|
|
if (!currentPseudonyms.empty())
|
|
|
while (otherCurrentPseudonyms[newIndex] == currentPseudonyms[newIndex])
|
|
|
newIndex++;
|
|
|
|
|
|
- Curvepoint shortTermPublicKey = otherCurrentPseudonyms[newIndex];
|
|
|
+ Twistpoint shortTermPublicKey = otherCurrentPseudonyms[newIndex];
|
|
|
|
|
|
bool flag = verify_proof_of_added_user(
|
|
|
pi,
|
|
|
currentFreshGenerator,
|
|
|
shortTermPublicKey,
|
|
|
- bgnSystem.get_public_key().get_bipoint_curvegen(),
|
|
|
- bgnSystem.get_public_key().get_bipoint_curve_subgroup_gen(),
|
|
|
bgnSystem.get_public_key().get_bipoint_twistgen(),
|
|
|
bgnSystem.get_public_key().get_bipoint_twist_subgroup_gen(),
|
|
|
+ bgnSystem.get_public_key().get_bipoint_curvegen(),
|
|
|
+ bgnSystem.get_public_key().get_bipoint_curve_subgroup_gen(),
|
|
|
newIndex,
|
|
|
otherCurrentUserEncryptedTallies[newIndex],
|
|
|
otherPreviousVoteTallies[newIndex],
|
|
@@ -1360,10 +1360,10 @@ std::vector<size_t> PrsonaServer::order_data()
|
|
|
std::vector<size_t> retval = sort_data(currentPseudonyms);
|
|
|
|
|
|
|
|
|
- std::vector<Curvepoint> newPseudonyms;
|
|
|
- std::vector<TwistBipoint> newVoteTallies;
|
|
|
+ std::vector<Twistpoint> newPseudonyms;
|
|
|
+ std::vector<CurveBipoint> newVoteTallies;
|
|
|
std::vector<EGCiphertext> newUserEncryptedTallies;
|
|
|
- std::vector<std::vector<CurveBipoint>> newVoteMatrix;
|
|
|
+ std::vector<std::vector<TwistBipoint>> newVoteMatrix;
|
|
|
|
|
|
for (size_t i = 0; i < retval.size(); i++)
|
|
|
{
|
|
@@ -1376,7 +1376,7 @@ std::vector<size_t> PrsonaServer::order_data()
|
|
|
currentUserEncryptedTallies[retval[i]]);
|
|
|
}
|
|
|
|
|
|
- std::vector<CurveBipoint> currNewRow;
|
|
|
+ std::vector<TwistBipoint> currNewRow;
|
|
|
for (size_t j = 0; j < currentPseudonyms.size(); j++)
|
|
|
{
|
|
|
currNewRow.push_back(
|
|
@@ -1398,7 +1398,7 @@ std::vector<size_t> PrsonaServer::order_data()
|
|
|
*/
|
|
|
|
|
|
|
|
|
-size_t PrsonaServer::binary_search(const Curvepoint& index) const
|
|
|
+size_t PrsonaServer::binary_search(const Twistpoint& index) const
|
|
|
{
|
|
|
return PrsonaBase::binary_search(currentPseudonyms, index);
|
|
|
}
|
|
@@ -1409,14 +1409,14 @@ size_t PrsonaServer::binary_search(const Curvepoint& index) const
|
|
|
|
|
|
bool PrsonaServer::verify_vote_proof(
|
|
|
const std::vector<Proof>& pi,
|
|
|
- const std::vector<CurveBipoint>& oldVotes,
|
|
|
- const std::vector<CurveBipoint>& newVotes,
|
|
|
- const Curvepoint& shortTermPublicKey) const
|
|
|
+ const std::vector<TwistBipoint>& oldVotes,
|
|
|
+ const std::vector<TwistBipoint>& newVotes,
|
|
|
+ const Twistpoint& shortTermPublicKey) const
|
|
|
{
|
|
|
const BGNPublicKey& pubKey = bgnSystem.get_public_key();
|
|
|
return PrsonaBase::verify_vote_proof(
|
|
|
- pubKey.get_bipoint_curvegen(),
|
|
|
- pubKey.get_bipoint_curve_subgroup_gen(),
|
|
|
+ pubKey.get_bipoint_twistgen(),
|
|
|
+ pubKey.get_bipoint_twist_subgroup_gen(),
|
|
|
pi,
|
|
|
oldVotes,
|
|
|
newVotes,
|
|
@@ -1424,7 +1424,7 @@ bool PrsonaServer::verify_vote_proof(
|
|
|
shortTermPublicKey);
|
|
|
}
|
|
|
|
|
|
-void PrsonaServer::print_scores(const std::vector<TwistBipoint>& scores)
|
|
|
+void PrsonaServer::print_scores(const std::vector<CurveBipoint>& scores)
|
|
|
{
|
|
|
std::cout << "[";
|
|
|
for (size_t i = 0; i < scores.size(); i++)
|