|
@@ -60,51 +60,22 @@ class PrsonaServer : public PrsonaBase {
|
|
|
|
|
|
void print_scores(const std::vector<CurveBipoint>& scores);
|
|
|
|
|
|
- private:
|
|
|
- // constants for servers
|
|
|
- const size_t numServers;
|
|
|
-
|
|
|
- // Identical between all servers (but collaboratively constructed)
|
|
|
- BGN bgnSystem;
|
|
|
-
|
|
|
- // Private; different for each server
|
|
|
- Scalar currentSeed;
|
|
|
- Scalar nextSeed;
|
|
|
-
|
|
|
- // The actual data, which is collaboratively updated by all servers
|
|
|
- Twistpoint currentFreshGenerator;
|
|
|
- std::vector<CurveBipoint> previousVoteTallies;
|
|
|
- std::vector<Twistpoint> currentPseudonyms;
|
|
|
- std::vector<EGCiphertext> currentUserEncryptedTallies;
|
|
|
- std::vector<std::vector<TwistBipoint>> voteMatrix;
|
|
|
-
|
|
|
- /**
|
|
|
- * NOTE: voteMatrix structure:
|
|
|
- * Each element represents a vote by <rowID> applied to <colID>.
|
|
|
- * The outer vector is a vector of rows and the inner vector is
|
|
|
- * a vector of encrypted votes.
|
|
|
- */
|
|
|
-
|
|
|
- // An imaginary class; it's just used right now to coordinate servers
|
|
|
- // in memory instead of via network action.
|
|
|
- friend class PrsonaServerEntity;
|
|
|
-
|
|
|
+ protected:
|
|
|
// CONSTRUCTOR HELPERS
|
|
|
const BGN& get_bgn_details() const;
|
|
|
+
|
|
|
bool initialize_fresh_generator(
|
|
|
const std::vector<Proof>& pi,
|
|
|
const Twistpoint& firstGenerator);
|
|
|
+
|
|
|
Twistpoint add_rand_seed_to_generator(
|
|
|
std::vector<Proof>& pi,
|
|
|
const Twistpoint& currGenerator) const;
|
|
|
+
|
|
|
bool set_EG_blind_generator(
|
|
|
const std::vector<Proof>& pi,
|
|
|
const Twistpoint& currGenerator);
|
|
|
-
|
|
|
- // SCORE TALLYING
|
|
|
- std::vector<Scalar> tally_scores();
|
|
|
- Scalar get_max_possible_score();
|
|
|
-
|
|
|
+
|
|
|
// EPOCH ROUNDS
|
|
|
void build_up_midway_pseudonyms(
|
|
|
std::vector<std::vector<std::vector<Proof>>>& pi,
|
|
@@ -115,6 +86,7 @@ class PrsonaServer : public PrsonaBase {
|
|
|
std::vector<std::vector<std::vector<std::vector<TwistBipoint>>>>& partwayVoteMatrixCommits,
|
|
|
std::vector<std::vector<std::vector<std::vector<TwistBipoint>>>>& finalVoteMatrixCommits,
|
|
|
Twistpoint& nextGenerator);
|
|
|
+
|
|
|
void break_down_midway_pseudonyms(
|
|
|
std::vector<Proof>& generatorProof,
|
|
|
std::vector<std::vector<std::vector<Proof>>>& pi,
|
|
@@ -129,6 +101,64 @@ class PrsonaServer : public PrsonaBase {
|
|
|
std::vector<std::vector<std::vector<Twistpoint>>>& userTallySeedCommits,
|
|
|
const Twistpoint& nextGenerator);
|
|
|
|
|
|
+ bool accept_epoch_updates(
|
|
|
+ const std::vector<std::vector<Proof>>& pi,
|
|
|
+ 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);
|
|
|
+
|
|
|
+ // DATA MAINTENANCE
|
|
|
+ bool import_new_user_update(
|
|
|
+ const std::vector<Proof>& pi,
|
|
|
+ const std::vector<CurveBipoint>& otherPreviousVoteTallies,
|
|
|
+ const std::vector<Twistpoint>& otherCurrentPseudonyms,
|
|
|
+ const std::vector<EGCiphertext>& otherCurrentUserEncryptedTallies,
|
|
|
+ const std::vector<std::vector<TwistBipoint>>& otherVoteMatrix);
|
|
|
+
|
|
|
+ private:
|
|
|
+ // constants for servers
|
|
|
+ const size_t numServers;
|
|
|
+
|
|
|
+ // Identical between all servers (but collaboratively constructed)
|
|
|
+ BGN bgnSystem;
|
|
|
+
|
|
|
+ // Private; different for each server
|
|
|
+ Scalar currentSeed;
|
|
|
+ Scalar nextSeed;
|
|
|
+
|
|
|
+ // The actual data, which is collaboratively updated by all servers
|
|
|
+ Twistpoint currentFreshGenerator;
|
|
|
+ std::vector<CurveBipoint> previousVoteTallies;
|
|
|
+ std::vector<Twistpoint> currentPseudonyms;
|
|
|
+ std::vector<EGCiphertext> currentUserEncryptedTallies;
|
|
|
+ std::vector<std::vector<TwistBipoint>> voteMatrix;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * NOTE: voteMatrix structure:
|
|
|
+ * Each element represents a vote by <rowID> applied to <colID>.
|
|
|
+ * The outer vector is a vector of rows and the inner vector is
|
|
|
+ * a vector of encrypted votes.
|
|
|
+ */
|
|
|
+
|
|
|
+ // An imaginary class; it's just used right now to coordinate servers
|
|
|
+ // in memory instead of via network action.
|
|
|
+ friend class PrsonaServerEntity;
|
|
|
+
|
|
|
+ // SCORE TALLYING
|
|
|
+ std::vector<Scalar> tally_scores();
|
|
|
+ Scalar get_max_possible_score();
|
|
|
+ void receive_tallied_scores(
|
|
|
+ const std::vector<EGCiphertext>& userTallyScores,
|
|
|
+ const std::vector<CurveBipoint>& serverTallyScores);
|
|
|
+
|
|
|
// EPOCH HELPERS
|
|
|
std::vector<std::vector<Proof>> epoch_calculations(
|
|
|
std::vector<std::vector<Twistpoint>>& permutationCommits,
|
|
@@ -144,20 +174,6 @@ class PrsonaServer : public PrsonaBase {
|
|
|
const Twistpoint& nextGenerator,
|
|
|
bool doUserTallies);
|
|
|
|
|
|
- bool accept_epoch_updates(
|
|
|
- const std::vector<std::vector<Proof>>& pi,
|
|
|
- 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);
|
|
|
-
|
|
|
std::vector<std::vector<Scalar>> generate_permutation_matrix(
|
|
|
const Scalar& reorderSeed
|
|
|
) const;
|
|
@@ -277,14 +293,6 @@ class PrsonaServer : public PrsonaBase {
|
|
|
const std::vector<Twistpoint> newPseudonyms
|
|
|
) const;
|
|
|
|
|
|
- // DATA MAINTENANCE
|
|
|
- bool import_new_user_update(
|
|
|
- const std::vector<Proof>& pi,
|
|
|
- const std::vector<CurveBipoint>& otherPreviousVoteTallies,
|
|
|
- const std::vector<Twistpoint>& otherCurrentPseudonyms,
|
|
|
- const std::vector<EGCiphertext>& otherCurrentUserEncryptedTallies,
|
|
|
- const std::vector<std::vector<TwistBipoint>>& otherVoteMatrix);
|
|
|
-
|
|
|
// DATA SAFEKEEPING
|
|
|
std::vector<size_t> order_data();
|
|
|
|