Browse Source

minor changes that lead to ~30% reduction in proof time

tristangurtler 1 year ago
parent
commit
da32b7a842

+ 3 - 3
prsona/inc/EGCiphertext.hpp

@@ -6,9 +6,9 @@
 class EGCiphertext {
     public:
         EGCiphertext();
-        EGCiphertext(const Curvepoint& mask, const Curvepoint& encryptedMessage);
-        Curvepoint mask;
-        Curvepoint encryptedMessage;
+        EGCiphertext(const Twistpoint& mask, const Twistpoint& encryptedMessage);
+        Twistpoint mask;
+        Twistpoint encryptedMessage;
 
         bool operator==(const EGCiphertext& other) const;
         friend std::ostream& operator<<(std::ostream& os, const EGCiphertext& output);

+ 72 - 72
prsona/inc/base.hpp

@@ -21,16 +21,16 @@ class PrsonaBase {
 
         // CONST GETTERS
         static size_t get_max_allowed_vote();
-        Curvepoint get_blinding_generator() const;
-        Curvepoint get_blinding_generator(std::vector<Proof>& pi) const;
+        Twistpoint get_blinding_generator() const;
+        Twistpoint get_blinding_generator(std::vector<Proof>& pi) const;
 
         // BINARY SEARCH
         size_t binary_search(
-            const std::vector<Curvepoint> list, const Curvepoint& index) const;
+            const std::vector<Twistpoint> list, const Twistpoint& index) const;
 
     protected:
         // Essentially constants, true for both servers and clients
-        static Curvepoint EL_GAMAL_GENERATOR;
+        static Twistpoint EL_GAMAL_GENERATOR;
         static Scalar SCALAR_N;
         static Scalar DEFAULT_TALLY;
         static Scalar DEFAULT_VOTE;
@@ -39,50 +39,50 @@ class PrsonaBase {
         static bool CLIENT_IS_MALICIOUS;
         
         std::vector<Proof> elGamalBlindGeneratorProof;
-        Curvepoint elGamalBlindGenerator;
+        Twistpoint elGamalBlindGenerator;
 
         // PRIVATE ELEMENT SETTER
         bool set_EG_blind_generator(
             const std::vector<Proof>& pi,
-            const Curvepoint& currGenerator,
+            const Twistpoint& currGenerator,
             size_t numServers);
 
         // SCHNORR PROOFS
         Proof schnorr_generation(
-            const Curvepoint& generator,
-            const Curvepoint& commitment,
+            const Twistpoint& generator,
+            const Twistpoint& commitment,
             const Scalar& log
         ) const;
 
         bool schnorr_verification(
-            const Curvepoint& generator,
-            const Curvepoint& commitment,
+            const Twistpoint& generator,
+            const Twistpoint& commitment,
             const Scalar& c,
             const Scalar& z
         ) const;
 
         // OWNERSHIP PROOFS
         Proof generate_ownership_proof(
-            const Curvepoint& generator,
-            const Curvepoint& commitment,
+            const Twistpoint& generator,
+            const Twistpoint& commitment,
             const Scalar& log
         ) const;
 
         bool verify_ownership_proof(
             const Proof& pi,
-            const Curvepoint& generator,
-            const Curvepoint& commitment
+            const Twistpoint& generator,
+            const Twistpoint& commitment
         ) const;
 
         // ITERATED SCHNORR PROOFS
         Proof add_to_generator_proof(
-            const Curvepoint& currGenerator, 
+            const Twistpoint& currGenerator, 
             const Scalar& seed
         ) const;
 
         bool verify_generator_proof(
             const std::vector<Proof>& pi,
-            const Curvepoint& currGenerator,
+            const Twistpoint& currGenerator,
             size_t numServers
         ) const;
 
@@ -98,8 +98,8 @@ class PrsonaBase {
 
         bool verify_reputation_proof(
             const std::vector<Proof>& pi,
-            const Curvepoint& generator,
-            const Curvepoint& owner,
+            const Twistpoint& generator,
+            const Twistpoint& owner,
             const EGCiphertext& commitment,
             const Scalar& threshold
         ) const;
@@ -107,23 +107,23 @@ class PrsonaBase {
         // VALID VOTE PROOFS
         std::vector<Proof> generate_vote_proof(
             const Proof& ownershipProof,
-            const CurveBipoint& g,
-            const CurveBipoint& h,
+            const TwistBipoint& g,
+            const TwistBipoint& h,
             const std::vector<bool>& replaces,
-            const std::vector<CurveBipoint>& oldEncryptedVotes,
-            const std::vector<CurveBipoint>& newEncryptedVotes,
+            const std::vector<TwistBipoint>& oldEncryptedVotes,
+            const std::vector<TwistBipoint>& newEncryptedVotes,
             const std::vector<Scalar>& seeds,
             const std::vector<Scalar>& votes
         ) const;
 
         bool verify_vote_proof(
-            const CurveBipoint& g,
-            const CurveBipoint& h,
+            const TwistBipoint& g,
+            const TwistBipoint& h,
             const std::vector<Proof>& pi,
-            const std::vector<CurveBipoint>& oldEncryptedVotes,
-            const std::vector<CurveBipoint>& newEncryptedVotes,
-            const Curvepoint& freshGenerator,
-            const Curvepoint& owner
+            const std::vector<TwistBipoint>& oldEncryptedVotes,
+            const std::vector<TwistBipoint>& newEncryptedVotes,
+            const Twistpoint& freshGenerator,
+            const Twistpoint& owner
         ) const;
 
         // NEW USER PROOFS
@@ -136,28 +136,28 @@ class PrsonaBase {
 
         bool verify_proof_of_added_user(
             const std::vector<Proof>& pi,
-            const Curvepoint& currentFreshGenerator,
-            const Curvepoint& shortTermPublicKey,
-            const CurveBipoint& curveG,
-            const CurveBipoint& curveH,
-            const TwistBipoint& twistG,
-            const TwistBipoint& twistH,
+            const Twistpoint& currentFreshGenerator,
+            const Twistpoint& shortTermPublicKey,
+            const TwistBipoint& curveG,
+            const TwistBipoint& curveH,
+            const CurveBipoint& twistG,
+            const CurveBipoint& twistH,
             size_t selfIndex,
             const EGCiphertext& userEncryptedScore,
-            const TwistBipoint& serverEncryptedScore,
-            const std::vector<std::vector<CurveBipoint>> encryptedVoteMatrix
+            const CurveBipoint& serverEncryptedScore,
+            const std::vector<std::vector<TwistBipoint>> encryptedVoteMatrix
         ) const;
 
         // EPOCH PROOFS
         std::vector<Proof> generate_valid_permutation_proof(
             const std::vector<std::vector<Scalar>>& permutations,
             const std::vector<std::vector<Scalar>>& seeds,
-            const std::vector<std::vector<Curvepoint>>& commits
+            const std::vector<std::vector<Twistpoint>>& commits
         ) const;
 
         bool verify_valid_permutation_proof(
             const std::vector<Proof>& pi,
-            const std::vector<std::vector<Curvepoint>>& commits
+            const std::vector<std::vector<Twistpoint>>& commits
         ) const;
 
         std::vector<Proof> generate_proof_of_reordering_plus_power(
@@ -165,45 +165,45 @@ class PrsonaBase {
             const Scalar& power,
             const std::vector<std::vector<Scalar>>& permutationSeeds,
             const std::vector<std::vector<Scalar>>& productSeeds,
-            const std::vector<Curvepoint>& oldValues,
-            const std::vector<std::vector<Curvepoint>>& permutationCommits,
-            const std::vector<std::vector<Curvepoint>>& productCommits,
-            const std::vector<std::vector<Curvepoint>>& seedCommits
+            const std::vector<Twistpoint>& oldValues,
+            const std::vector<std::vector<Twistpoint>>& permutationCommits,
+            const std::vector<std::vector<Twistpoint>>& productCommits,
+            const std::vector<std::vector<Twistpoint>>& seedCommits
         ) const;
 
         bool verify_proof_of_reordering_plus_power(
             const std::vector<Proof>& pi,
-            const std::vector<Curvepoint>& oldValues,
-            const std::vector<std::vector<Curvepoint>>& permutationCommits,
-            const std::vector<std::vector<Curvepoint>>& productCommits,
-            const std::vector<std::vector<Curvepoint>>& seedCommits
+            const std::vector<Twistpoint>& oldValues,
+            const std::vector<std::vector<Twistpoint>>& permutationCommits,
+            const std::vector<std::vector<Twistpoint>>& productCommits,
+            const std::vector<std::vector<Twistpoint>>& seedCommits
         ) const;
 
         std::vector<Proof> generate_user_tally_proofs(
             const std::vector<std::vector<Scalar>>& permutations,
             const Scalar& power,
-            const Curvepoint& nextGenerator,
+            const Twistpoint& nextGenerator,
             const std::vector<std::vector<Scalar>>& permutationSeeds,
             const std::vector<std::vector<Scalar>>& userTallySeeds,
-            const std::vector<Curvepoint>& currPseudonyms,
-            const std::vector<Curvepoint>& userTallyMasks,
-            const std::vector<Curvepoint>& userTallyMessages,
-            const std::vector<std::vector<Curvepoint>>& permutationCommits,
-            const std::vector<std::vector<Curvepoint>>& userTallyMaskCommits,
-            const std::vector<std::vector<Curvepoint>>& userTallyMessageCommits,
-            const std::vector<std::vector<Curvepoint>>& userTallySeedCommits
+            const std::vector<Twistpoint>& currPseudonyms,
+            const std::vector<Twistpoint>& userTallyMasks,
+            const std::vector<Twistpoint>& userTallyMessages,
+            const std::vector<std::vector<Twistpoint>>& permutationCommits,
+            const std::vector<std::vector<Twistpoint>>& userTallyMaskCommits,
+            const std::vector<std::vector<Twistpoint>>& userTallyMessageCommits,
+            const std::vector<std::vector<Twistpoint>>& userTallySeedCommits
         ) const;
 
         bool verify_user_tally_proofs(
             const std::vector<Proof>& pi,
-            const Curvepoint& nextGenerator,
-            const std::vector<Curvepoint>& currPseudonyms,
-            const std::vector<Curvepoint>& userTallyMasks,
-            const std::vector<Curvepoint>& userTallyMessages,
-            const std::vector<std::vector<Curvepoint>>& permutationCommits,
-            const std::vector<std::vector<Curvepoint>>& userTallyMaskCommits,
-            const std::vector<std::vector<Curvepoint>>& userTallyMessageCommits,
-            const std::vector<std::vector<Curvepoint>>& userTallySeedCommits
+            const Twistpoint& nextGenerator,
+            const std::vector<Twistpoint>& currPseudonyms,
+            const std::vector<Twistpoint>& userTallyMasks,
+            const std::vector<Twistpoint>& userTallyMessages,
+            const std::vector<std::vector<Twistpoint>>& permutationCommits,
+            const std::vector<std::vector<Twistpoint>>& userTallyMaskCommits,
+            const std::vector<std::vector<Twistpoint>>& userTallyMessageCommits,
+            const std::vector<std::vector<Twistpoint>>& userTallySeedCommits
         ) const;
 
         template <typename T>
@@ -212,7 +212,7 @@ class PrsonaBase {
             const std::vector<std::vector<Scalar>>& permutationSeeds,
             const std::vector<std::vector<Scalar>>& productSeeds,
             const std::vector<T>& oldValues,
-            const std::vector<std::vector<Curvepoint>>& permutationCommits,
+            const std::vector<std::vector<Twistpoint>>& permutationCommits,
             const std::vector<std::vector<T>>& productCommits,
             const T& otherG,
             const T& otherH
@@ -222,7 +222,7 @@ class PrsonaBase {
         bool verify_proof_of_reordering(
             const std::vector<Proof>& pi,
             const std::vector<T>& oldValues,
-            const std::vector<std::vector<Curvepoint>>& permutationCommits,
+            const std::vector<std::vector<Twistpoint>>& permutationCommits,
             const std::vector<std::vector<T>>& productCommits,
             const T& otherG,
             const T& otherH
@@ -230,23 +230,23 @@ class PrsonaBase {
 
         // SERVER AGREEMENT PROOFS
         Proof generate_valid_vote_row_proof(
-            const std::vector<CurveBipoint>& commitment) const;
+            const std::vector<TwistBipoint>& commitment) const;
         Proof generate_valid_vote_matrix_proof(
-            const std::vector<std::vector<CurveBipoint>>& commitment) const;
+            const std::vector<std::vector<TwistBipoint>>& commitment) const;
         Proof generate_valid_user_tally_proof(
             const EGCiphertext& commitment) const;
         Proof generate_valid_server_tally_proof(
-            const TwistBipoint& commitment) const;
+            const CurveBipoint& commitment) const;
         Proof generate_valid_pseudonyms_proof(
-            const std::vector<Curvepoint>& commitment) const;
+            const std::vector<Twistpoint>& commitment) const;
         
         bool verify_valid_vote_row_proof(
             const std::vector<Proof>& pi,
-            const std::vector<CurveBipoint>& commitment
+            const std::vector<TwistBipoint>& commitment
         ) const;
         bool verify_valid_vote_matrix_proof(
             const std::vector<Proof>& pi,
-            const std::vector<std::vector<CurveBipoint>>& commitment
+            const std::vector<std::vector<TwistBipoint>>& commitment
         ) const;
         bool verify_valid_user_tally_proof(
             const std::vector<Proof>& pi,
@@ -254,11 +254,11 @@ class PrsonaBase {
         ) const;
         bool verify_valid_server_tally_proof(
             const std::vector<Proof>& pi,
-            const TwistBipoint& commitment
+            const CurveBipoint& commitment
         ) const;
         bool verify_valid_pseudonyms_proof(
             const std::vector<Proof>& pi,
-            const std::vector<Curvepoint>& commitment
+            const std::vector<Twistpoint>& commitment
         ) const;
 };
 

+ 14 - 14
prsona/inc/client.hpp

@@ -17,38 +17,38 @@ class PrsonaClient : public PrsonaBase {
         // CONSTRUCTORS
         PrsonaClient(
             const std::vector<Proof>& generatorProof,
-            const Curvepoint& elGamalBlindGenerator,
+            const Twistpoint& elGamalBlindGenerator,
             const BGNPublicKey& serverPublicKey,
             size_t numServers);
 
         // BASIC PUBLIC SYSTEM INFO GETTERS
-        Curvepoint get_short_term_public_key() const;
-        Curvepoint get_short_term_public_key(Proof &pi) const;
+        Twistpoint get_short_term_public_key() const;
+        Twistpoint get_short_term_public_key(Proof &pi) const;
 
         // SERVER INTERACTIONS
-        std::vector<CurveBipoint> make_votes(
+        std::vector<TwistBipoint> make_votes(
             std::vector<Proof>& validVoteProof,
             const std::vector<Proof>& serverProof,
-            const std::vector<CurveBipoint>& oldEncryptedVotes,
+            const std::vector<TwistBipoint>& oldEncryptedVotes,
             const std::vector<Scalar>& votes,
             const std::vector<bool>& replaces
         ) const;
         bool receive_fresh_generator(
             const std::vector<Proof>& pi,
-            const Curvepoint& freshGenerator);
+            const Twistpoint& freshGenerator);
         bool receive_vote_tally(
             const std::vector<Proof>& pi,
             const EGCiphertext& score);
         bool receive_new_user_data(
             const std::vector<Proof>& mainProof,
             const std::vector<Proof>& serverEncryptedScoreProof,
-            const TwistBipoint& serverEncryptedScore,
+            const CurveBipoint& serverEncryptedScore,
             const std::vector<Proof>& userEncryptedScoreProof,
             const EGCiphertext& userEncryptedScore,
             const std::vector<Proof>& voteMatrixProof,
-            const std::vector<std::vector<CurveBipoint>>& encryptedVoteMatrix,
+            const std::vector<std::vector<TwistBipoint>>& encryptedVoteMatrix,
             const std::vector<Proof>& pseudonymsProof,
-            const std::vector<Curvepoint>& currentPseudonyms);
+            const std::vector<Twistpoint>& currentPseudonyms);
 
         // REPUTATION PROOFS
         std::vector<Proof> generate_reputation_proof(
@@ -57,7 +57,7 @@ class PrsonaClient : public PrsonaBase {
         ) const;
         bool verify_reputation_proof(
             const std::vector<Proof>& pi,
-            const Curvepoint& shortTermPublicKey,
+            const Twistpoint& shortTermPublicKey,
             const Scalar& threshold,
             const std::vector<Proof>& encryptedScoreProof,
             const EGCiphertext& encryptedScore
@@ -72,7 +72,7 @@ class PrsonaClient : public PrsonaBase {
         const size_t numServers;
 
         // Things bound to the servers (but change regularly)
-        Curvepoint currentFreshGenerator;
+        Twistpoint currentFreshGenerator;
 
         // Things bound to this user permanently
         Scalar longTermPrivateKey;
@@ -83,7 +83,7 @@ class PrsonaClient : public PrsonaBase {
         Scalar currentScore;
 
         // Things related to making decryption more efficient
-        std::unordered_map<Curvepoint, Scalar, CurvepointHash>
+        std::unordered_map<Twistpoint, Scalar, TwistpointHash>
             decryption_memoizer;
         Scalar max_checked;
 
@@ -96,8 +96,8 @@ class PrsonaClient : public PrsonaBase {
         // VALID VOTE PROOFS
         std::vector<Proof> generate_vote_proof(
             const std::vector<bool>& replaces,
-            const std::vector<CurveBipoint>& oldEncryptedVotes,
-            const std::vector<CurveBipoint>& newEncryptedVotes,
+            const std::vector<TwistBipoint>& oldEncryptedVotes,
+            const std::vector<TwistBipoint>& newEncryptedVotes,
             const std::vector<Scalar>& seeds,
             const std::vector<Scalar>& votes
         ) const;

+ 1 - 1
prsona/inc/networkClient.hpp

@@ -8,7 +8,7 @@ class PrsonaNetworkClient : public PrsonaClient {
         // CONSTRUCTORS
         PrsonaNetworkClient(
             const std::vector<Proof>& generatorProof,
-            const Curvepoint& elGamalBlindGenerator,
+            const Twistpoint& elGamalBlindGenerator,
             const BGNPublicKey& serverPublicKey,
             const size_t numServers);
 }; 

+ 2 - 2
prsona/inc/proof.hpp

@@ -23,8 +23,8 @@ class Proof {
         std::string hbc;
 
         // Malicious security
-        std::vector<Curvepoint> curvepointUniversals;
-        std::vector<CurveBipoint> curveBipointUniversals;
+        std::vector<Twistpoint> curvepointUniversals;
+        std::vector<TwistBipoint> curveBipointUniversals;
         std::vector<Scalar> challengeParts;
         std::vector<Scalar> responseParts;
 

+ 100 - 100
prsona/inc/server.hpp

@@ -23,42 +23,42 @@ class PrsonaServer : public PrsonaBase {
         size_t get_num_servers() const;
         
         // FRESH GENERATOR CALCULATION
-        Curvepoint add_curr_seed_to_generator(
+        Twistpoint add_curr_seed_to_generator(
             std::vector<Proof>& pi,
-            const Curvepoint& currGenerator) const;
-        Curvepoint add_next_seed_to_generator(
+            const Twistpoint& currGenerator) const;
+        Twistpoint add_next_seed_to_generator(
             std::vector<Proof>& pi,
-            const Curvepoint& currGenerator) const;
+            const Twistpoint& currGenerator) const;
 
         // ENCRYPTED DATA GETTERS
-        std::vector<CurveBipoint> get_current_votes_by(
-            Proof& pi, const Curvepoint& shortTermPublicKey) const;
-        std::vector<std::vector<CurveBipoint>> get_all_current_votes(
+        std::vector<TwistBipoint> get_current_votes_by(
+            Proof& pi, const Twistpoint& shortTermPublicKey) const;
+        std::vector<std::vector<TwistBipoint>> get_all_current_votes(
             Proof& pi) const;
         EGCiphertext get_current_user_encrypted_tally(
-            Proof& pi, const Curvepoint& shortTermPublicKey) const;
-        TwistBipoint get_current_server_encrypted_tally(
-            Proof& pi, const Curvepoint& shortTermPublicKey) const;
-        std::vector<Curvepoint> get_current_pseudonyms(Proof& pi) const;
+            Proof& pi, const Twistpoint& shortTermPublicKey) const;
+        CurveBipoint get_current_server_encrypted_tally(
+            Proof& pi, const Twistpoint& shortTermPublicKey) const;
+        std::vector<Twistpoint> get_current_pseudonyms(Proof& pi) const;
 
         // PROOF COMMITMENT GETTERS
-        Proof get_vote_row_commitment(const Curvepoint& request) const;
+        Proof get_vote_row_commitment(const Twistpoint& request) const;
         Proof get_vote_matrix_commitment() const;
-        Proof get_user_tally_commitment(const Curvepoint& request) const;
-        Proof get_server_tally_commitment(const Curvepoint& request) const;
+        Proof get_user_tally_commitment(const Twistpoint& request) const;
+        Proof get_server_tally_commitment(const Twistpoint& request) const;
         Proof get_pseudonyms_commitment() const;
 
         // CLIENT INTERACTIONS
         void add_new_client(
             std::vector<Proof>& proofOfValidAddition,
             const Proof& proofOfValidKey,
-            const Curvepoint& shortTermPublicKey);
+            const Twistpoint& shortTermPublicKey);
         bool receive_vote(
             const std::vector<Proof>& pi,
-            const std::vector<CurveBipoint>& newVotes,
-            const Curvepoint& shortTermPublicKey);
+            const std::vector<TwistBipoint>& newVotes,
+            const Twistpoint& shortTermPublicKey);
 
-        void print_scores(const std::vector<TwistBipoint>& scores);
+        void print_scores(const std::vector<CurveBipoint>& scores);
 
     private:
         // constants for servers
@@ -72,11 +72,11 @@ class PrsonaServer : public PrsonaBase {
         Scalar nextSeed;
 
         // The actual data, which is collaboratively updated by all servers
-        Curvepoint currentFreshGenerator;
-        std::vector<TwistBipoint> previousVoteTallies;
-        std::vector<Curvepoint> currentPseudonyms;
+        Twistpoint currentFreshGenerator;
+        std::vector<CurveBipoint> previousVoteTallies;
+        std::vector<Twistpoint> currentPseudonyms;
         std::vector<EGCiphertext> currentUserEncryptedTallies;
-        std::vector<std::vector<CurveBipoint>> voteMatrix;
+        std::vector<std::vector<TwistBipoint>> voteMatrix;
 
         /**
          * NOTE: voteMatrix structure:
@@ -93,13 +93,13 @@ class PrsonaServer : public PrsonaBase {
         const BGN& get_bgn_details() const;
         bool initialize_fresh_generator(
             const std::vector<Proof>& pi,
-            const Curvepoint& firstGenerator);
-        Curvepoint add_rand_seed_to_generator(
+            const Twistpoint& firstGenerator);
+        Twistpoint add_rand_seed_to_generator(
             std::vector<Proof>& pi,
-            const Curvepoint& currGenerator) const;
+            const Twistpoint& currGenerator) const;
         bool set_EG_blind_generator(
             const std::vector<Proof>& pi,
-            const Curvepoint& currGenerator);
+            const Twistpoint& currGenerator);
         
         // SCORE TALLYING
         std::vector<Scalar> tally_scores();
@@ -108,85 +108,85 @@ class PrsonaServer : public PrsonaBase {
         // EPOCH ROUNDS
         void 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);
         void 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);
 
         // EPOCH HELPERS
         std::vector<std::vector<Proof>> 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);
 
         bool 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);
 
         std::vector<std::vector<Scalar>> generate_permutation_matrix(
             const Scalar& reorderSeed
         ) const;
-        std::vector<std::vector<Curvepoint>> generate_commitment_matrix(
+        std::vector<std::vector<Twistpoint>> generate_commitment_matrix(
             const std::vector<std::vector<Scalar>>& permutations,
             std::vector<std::vector<Scalar>>& seeds
         ) const;
 
-        std::vector<std::vector<Curvepoint>> generate_pseudonym_matrix(
+        std::vector<std::vector<Twistpoint>> 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
+            std::vector<std::vector<Twistpoint>>& seedCommits
         ) const;
 
-        std::vector<std::vector<TwistBipoint>> generate_server_tally_matrix(
+        std::vector<std::vector<CurveBipoint>> generate_server_tally_matrix(
             const std::vector<std::vector<Scalar>>& permutations,
             std::vector<std::vector<Scalar>>& seeds
         ) const;
 
-        std::vector<std::vector<std::vector<CurveBipoint>>> generate_vote_tensor(
+        std::vector<std::vector<std::vector<TwistBipoint>>> 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<CurveBipoint>> calculate_next_vote_matrix(
-            const std::vector<std::vector<std::vector<CurveBipoint>>>& voteTensor
+        std::vector<std::vector<TwistBipoint>> calculate_next_vote_matrix(
+            const std::vector<std::vector<std::vector<TwistBipoint>>>& voteTensor
         ) const;
 
         void generate_vote_tensor_proofs(
@@ -194,31 +194,31 @@ class PrsonaServer : public PrsonaBase {
             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;
         bool 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;
 
         void 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
+            std::vector<std::vector<Twistpoint>>& userTallySeedCommits
         ) const;
 
         template <typename T>
@@ -227,7 +227,7 @@ class PrsonaServer : public PrsonaBase {
             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;
 
@@ -246,12 +246,12 @@ class PrsonaServer : public PrsonaBase {
         ) const;
 
         std::vector<size_t> sort_data(
-            const std::vector<Curvepoint>& inputs
+            const std::vector<Twistpoint>& inputs
         ) const;
 
         // A helper class for "ordering" data and for binary search
         struct SortingType {
-            Curvepoint pseudonym;
+            Twistpoint pseudonym;
             size_t index;
 
             bool operator<( const SortingType& rhs ) const
@@ -267,36 +267,36 @@ class PrsonaServer : public PrsonaBase {
         ) const;
 
         bool 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);
 
         bool pseudonyms_sorted(
-            const std::vector<Curvepoint> newPseudonyms
+            const std::vector<Twistpoint> newPseudonyms
         ) const;
 
         // DATA MAINTENANCE
         bool 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);
 
         // DATA SAFEKEEPING
         std::vector<size_t> order_data();
         
         // BINARY SEARCH
-        size_t binary_search(const Curvepoint& index) const;
+        size_t binary_search(const Twistpoint& index) const;
 
         // VALID VOTE PROOFS
         bool verify_vote_proof(
             const std::vector<Proof>& pi,
-            const std::vector<CurveBipoint>& oldVotes,
-            const std::vector<CurveBipoint>& newVotes,
-            const Curvepoint& shortTermPublicKey
+            const std::vector<TwistBipoint>& oldVotes,
+            const std::vector<TwistBipoint>& newVotes,
+            const Twistpoint& shortTermPublicKey
         ) const;
 }; 
 

+ 37 - 37
prsona/inc/serverEntity.hpp

@@ -15,15 +15,15 @@ class PrsonaServerEntity {
         // BASIC PUBLIC SYSTEM INFO GETTERS
         BGNPublicKey get_bgn_public_key() const;
         BGNPublicKey get_bgn_public_key(size_t which) const;
-        Curvepoint get_blinding_generator() const;
-        Curvepoint get_blinding_generator(size_t which) const;
-        Curvepoint get_blinding_generator(std::vector<Proof>& pi) const;
-        Curvepoint get_blinding_generator(
+        Twistpoint get_blinding_generator() const;
+        Twistpoint get_blinding_generator(size_t which) const;
+        Twistpoint get_blinding_generator(std::vector<Proof>& pi) const;
+        Twistpoint get_blinding_generator(
             std::vector<Proof>& pi, size_t which) const;
-        Curvepoint get_fresh_generator() const;
-        Curvepoint get_fresh_generator(size_t which) const;
-        Curvepoint get_fresh_generator(std::vector<Proof>& pi) const;
-        Curvepoint get_fresh_generator(
+        Twistpoint get_fresh_generator() const;
+        Twistpoint get_fresh_generator(size_t which) const;
+        Twistpoint get_fresh_generator(std::vector<Proof>& pi) const;
+        Twistpoint get_fresh_generator(
             std::vector<Proof>& pi, size_t which) const;
         size_t get_num_clients() const;
         size_t get_num_clients(size_t which) const;
@@ -31,33 +31,33 @@ class PrsonaServerEntity {
         size_t get_num_servers(size_t which) const;
 
         // ENCRYPTED DATA GETTERS
-        std::vector<CurveBipoint> get_current_votes_by(
-            Proof& pi, const Curvepoint& shortTermPublicKey) const;
-        std::vector<CurveBipoint> get_current_votes_by(
-            Proof& pi, const Curvepoint& shortTermPublicKey, size_t which) const;
-        std::vector<std::vector<CurveBipoint>> get_all_current_votes(
+        std::vector<TwistBipoint> get_current_votes_by(
+            Proof& pi, const Twistpoint& shortTermPublicKey) const;
+        std::vector<TwistBipoint> get_current_votes_by(
+            Proof& pi, const Twistpoint& shortTermPublicKey, size_t which) const;
+        std::vector<std::vector<TwistBipoint>> get_all_current_votes(
             Proof& pi) const;
-        std::vector<std::vector<CurveBipoint>> get_all_current_votes(
+        std::vector<std::vector<TwistBipoint>> get_all_current_votes(
             Proof& pi, size_t which) const;
         EGCiphertext get_current_user_encrypted_tally(
-            Proof& pi, const Curvepoint& shortTermPublicKey) const;
+            Proof& pi, const Twistpoint& shortTermPublicKey) const;
         EGCiphertext get_current_user_encrypted_tally(
-            Proof& pi, const Curvepoint& shortTermPublicKey, size_t which) const;
-        TwistBipoint get_current_server_encrypted_tally(
-            Proof& pi, const Curvepoint& shortTermPublicKey) const;
-        TwistBipoint get_current_server_encrypted_tally(
-            Proof& pi, const Curvepoint& shortTermPublicKey, size_t which) const;
-        std::vector<Curvepoint> get_current_pseudonyms(
+            Proof& pi, const Twistpoint& shortTermPublicKey, size_t which) const;
+        CurveBipoint get_current_server_encrypted_tally(
+            Proof& pi, const Twistpoint& shortTermPublicKey) const;
+        CurveBipoint get_current_server_encrypted_tally(
+            Proof& pi, const Twistpoint& shortTermPublicKey, size_t which) const;
+        std::vector<Twistpoint> get_current_pseudonyms(
             Proof& pi) const;
-        std::vector<Curvepoint> get_current_pseudonyms(
+        std::vector<Twistpoint> get_current_pseudonyms(
             Proof& pi, size_t which) const;
 
         // PROOF COMMITMENT GETTERS
         void get_other_vote_row_commitments(
-            std::vector<Proof>& pi, const Curvepoint& request) const;
+            std::vector<Proof>& pi, const Twistpoint& request) const;
         void get_other_vote_row_commitments(
             std::vector<Proof>& pi,
-            const Curvepoint& request,
+            const Twistpoint& request,
             size_t whichNot
         ) const;
         void get_other_vote_matrix_commitments(
@@ -65,17 +65,17 @@ class PrsonaServerEntity {
         void get_other_vote_matrix_commitments(
             std::vector<Proof>& pi, size_t whichNot) const;
         void get_other_user_tally_commitments(
-            std::vector<Proof>& pi, const Curvepoint& request) const;
+            std::vector<Proof>& pi, const Twistpoint& request) const;
         void get_other_user_tally_commitments(
             std::vector<Proof>& pi,
-            const Curvepoint& request,
+            const Twistpoint& request,
             size_t whichNot
         ) const;
         void get_other_server_tally_commitments(
-            std::vector<Proof>& pi, const Curvepoint& request) const;
+            std::vector<Proof>& pi, const Twistpoint& request) const;
         void get_other_server_tally_commitments(
             std::vector<Proof>& pi,
-            const Curvepoint& request,
+            const Twistpoint& request,
             size_t whichNot)
         const;
         void get_other_pseudonyms_commitments(
@@ -88,12 +88,12 @@ class PrsonaServerEntity {
         void add_new_client(PrsonaClient& newUser, size_t which);
         bool receive_vote(
             const std::vector<Proof>& pi,
-            const std::vector<CurveBipoint>& newVotes,
-            const Curvepoint& shortTermPublicKey);
+            const std::vector<TwistBipoint>& newVotes,
+            const Twistpoint& shortTermPublicKey);
         bool 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 which);
         void transmit_new_user_data(
             const std::vector<Proof>& pi, PrsonaClient& newUser) const;
@@ -108,24 +108,24 @@ class PrsonaServerEntity {
 
         void print_scores() const;
         void print_votes() const;
-        void print_current_votes_by(const Curvepoint& index) const;
+        void print_current_votes_by(const Twistpoint& index) const;
 
     private:
         std::vector<PrsonaServer> servers;
 
         // SCORE TALLYING
         void tally_scores(
-            const Curvepoint& nextGenerator,
+            const Twistpoint& nextGenerator,
             std::vector<EGCiphertext>& userTallyScores,
-            std::vector<TwistBipoint>& serverTallyScores,
+            std::vector<CurveBipoint>& serverTallyScores,
             size_t which);
         void distribute_tallied_scores(
             const std::vector<EGCiphertext>& userScores,
-            const std::vector<TwistBipoint>& serverScores);
+            const std::vector<CurveBipoint>& serverScores);
         
         // BINARY SEARCH
         size_t binary_search(
-            const Curvepoint& shortTermPublicKey, size_t which) const;
+            const Twistpoint& shortTermPublicKey, size_t which) const;
 }; 
 
 #endif

+ 1 - 1
prsona/src/EGCiphertext.cpp

@@ -3,7 +3,7 @@
 EGCiphertext::EGCiphertext()
 { /* Do nothing */ }
 
-EGCiphertext::EGCiphertext(const Curvepoint& mask, const Curvepoint& encryptedMessage)
+EGCiphertext::EGCiphertext(const Twistpoint& mask, const Twistpoint& encryptedMessage)
 {
     this->mask = mask;
     this->encryptedMessage = encryptedMessage;

+ 151 - 151
prsona/src/base.cpp

@@ -4,13 +4,13 @@
 #include "base.hpp"
 
 extern const scalar_t bn_n;
-extern const curvepoint_fp_t bn_curvegen;
+extern const twistpoint_fp2_t bn_twistgen;
 
 /* These lines need to be here so these static variables are defined,
  * but in C++ putting code here doesn't actually execute
  * (or at least, with g++, whenever it would execute is not at a useful time)
  * so we have an init() function to actually put the correct values in them. */
-Curvepoint PrsonaBase::EL_GAMAL_GENERATOR = Curvepoint();
+Twistpoint PrsonaBase::EL_GAMAL_GENERATOR = Twistpoint();
 Scalar PrsonaBase::SCALAR_N = Scalar();
 Scalar PrsonaBase::DEFAULT_TALLY = Scalar();
 Scalar PrsonaBase::DEFAULT_VOTE = Scalar();
@@ -48,7 +48,7 @@ mpz_class bit(mpz_class x)
 // Must be called once before any usage of this class
 void PrsonaBase::init()
 {
-    EL_GAMAL_GENERATOR = Curvepoint(bn_curvegen);
+    EL_GAMAL_GENERATOR = Twistpoint(bn_twistgen);
     SCALAR_N = Scalar(bn_n);
     DEFAULT_TALLY = Scalar(1);
     DEFAULT_VOTE = Scalar(1);
@@ -75,12 +75,12 @@ size_t PrsonaBase::get_max_allowed_vote()
     return MAX_ALLOWED_VOTE;
 }
 
-Curvepoint PrsonaBase::get_blinding_generator() const
+Twistpoint PrsonaBase::get_blinding_generator() const
 {
     return elGamalBlindGenerator;
 }
 
-Curvepoint PrsonaBase::get_blinding_generator(std::vector<Proof>& pi) const
+Twistpoint PrsonaBase::get_blinding_generator(std::vector<Proof>& pi) const
 {
     pi = elGamalBlindGeneratorProof;
 
@@ -97,7 +97,7 @@ Curvepoint PrsonaBase::get_blinding_generator(std::vector<Proof>& pi) const
 
 bool PrsonaBase::set_EG_blind_generator(
     const std::vector<Proof>& pi,
-    const Curvepoint& currGenerator,
+    const Twistpoint& currGenerator,
     size_t numServers)
 {
     if (!verify_generator_proof(pi, currGenerator, numServers))
@@ -116,7 +116,7 @@ bool PrsonaBase::set_EG_blind_generator(
  * There might be a standard function for this in <algorithms>?
  * But it returns an iterator, not a size_t, so less useful. */
 size_t PrsonaBase::binary_search(
-    const std::vector<Curvepoint> list, const Curvepoint& index) const
+    const std::vector<Twistpoint> list, const Twistpoint& index) const
 {
     size_t lo, hi;
     lo = 0;
@@ -142,8 +142,8 @@ size_t PrsonaBase::binary_search(
  */
 
 Proof PrsonaBase::schnorr_generation(
-    const Curvepoint& generator,
-    const Curvepoint& commitment,
+    const Twistpoint& generator,
+    const Twistpoint& commitment,
     const Scalar& log) const
 {
     Proof retval;
@@ -153,7 +153,7 @@ Proof PrsonaBase::schnorr_generation(
     Scalar u;
     u.set_random();
     
-    Curvepoint U = generator * u;
+    Twistpoint U = generator * u;
     oracleInput << generator << commitment << U;
 
     Scalar x = oracle(oracleInput.str());
@@ -166,12 +166,12 @@ Proof PrsonaBase::schnorr_generation(
 }
 
 bool PrsonaBase::schnorr_verification(
-    const Curvepoint& generator,
-    const Curvepoint& commitment,
+    const Twistpoint& generator,
+    const Twistpoint& commitment,
     const Scalar& x,
     const Scalar& z) const
 {
-    Curvepoint U = generator * z - commitment * x;
+    Twistpoint U = generator * z - commitment * x;
 
     std::stringstream oracleInput;
     oracleInput << generator << commitment << U;
@@ -185,8 +185,8 @@ bool PrsonaBase::schnorr_verification(
 
 // Prove ownership of the short term public key
 Proof PrsonaBase::generate_ownership_proof(
-    const Curvepoint& generator,
-    const Curvepoint& commitment,
+    const Twistpoint& generator,
+    const Twistpoint& commitment,
     const Scalar& log) const
 {
     if (!CLIENT_IS_MALICIOUS)
@@ -202,8 +202,8 @@ Proof PrsonaBase::generate_ownership_proof(
 
 bool PrsonaBase::verify_ownership_proof(
     const Proof& pi,
-    const Curvepoint& generator,
-    const Curvepoint& commitment) const
+    const Twistpoint& generator,
+    const Twistpoint& commitment) const
 {
     if (!CLIENT_IS_MALICIOUS)
         return pi.hbc == "PROOF";
@@ -219,7 +219,7 @@ bool PrsonaBase::verify_ownership_proof(
  */
 
 Proof PrsonaBase::add_to_generator_proof(
-    const Curvepoint& currGenerator, 
+    const Twistpoint& currGenerator, 
     const Scalar& seed) const
 {
     Proof retval;
@@ -229,7 +229,7 @@ Proof PrsonaBase::add_to_generator_proof(
         return retval;
     }
 
-    Curvepoint nextGenerator = currGenerator * seed;
+    Twistpoint nextGenerator = currGenerator * seed;
     retval = schnorr_generation(currGenerator, nextGenerator, seed);
 
     retval.curvepointUniversals.push_back(currGenerator);
@@ -238,7 +238,7 @@ Proof PrsonaBase::add_to_generator_proof(
 
 bool PrsonaBase::verify_generator_proof(
     const std::vector<Proof>& pi,
-    const Curvepoint& currGenerator,
+    const Twistpoint& currGenerator,
     size_t numServers) const
 {
     if (pi.size() != numServers || numServers == 0)
@@ -259,8 +259,8 @@ bool PrsonaBase::verify_generator_proof(
 
     for (size_t i = 0; i < pi.size(); i++)
     {
-        Curvepoint generator = pi[i].curvepointUniversals[0];
-        Curvepoint commitment = (i == pi.size() - 1 ?
+        Twistpoint generator = pi[i].curvepointUniversals[0];
+        Twistpoint commitment = (i == pi.size() - 1 ?
                                     currGenerator :
                                     pi[i + 1].curvepointUniversals[0]);
         Scalar c = pi[i].challengeParts[0];
@@ -333,7 +333,7 @@ std::vector<Proof> PrsonaBase::generate_reputation_proof(
     for (size_t i = 0; i < proofBits; i++)
     {
         Proof currProof;
-        Curvepoint g, h, C, C_a, C_b;
+        Twistpoint g, h, C, C_a, C_b;
         g = commitment.mask;
         h = elGamalBlindGenerator;
     
@@ -375,8 +375,8 @@ std::vector<Proof> PrsonaBase::generate_reputation_proof(
 // A pretty straightforward range proof (verification)
 bool PrsonaBase::verify_reputation_proof(
     const std::vector<Proof>& pi,
-    const Curvepoint& generator,
-    const Curvepoint& owner,
+    const Twistpoint& generator,
+    const Twistpoint& owner,
     const EGCiphertext& commitment,
     const Scalar& threshold) const
 {
@@ -411,10 +411,10 @@ bool PrsonaBase::verify_reputation_proof(
 
     // X is the thing we're going to be checking in on throughout
     // to try to get our score commitment back in the end.
-    Curvepoint X;
+    Twistpoint X;
     for (size_t i = 1; i < pi.size(); i++)
     {
-        Curvepoint C, g, h;
+        Twistpoint C, g, h;
         C = pi[i].curvepointUniversals[0];
         g = commitment.mask;
         h = elGamalBlindGenerator;
@@ -428,7 +428,7 @@ bool PrsonaBase::verify_reputation_proof(
         z_b = pi[i].responseParts[2];
 
         // Taken from Fig. 1 in https://eprint.iacr.org/2014/764.pdf
-        Curvepoint C_a, C_b;
+        Twistpoint C_a, C_b;
         C_a = g * z_a + h * f - C * x;
         C_b = g * z_b - C * (x - f);
 
@@ -442,7 +442,7 @@ bool PrsonaBase::verify_reputation_proof(
         }
     }
 
-    Curvepoint scoreCommitment =
+    Twistpoint scoreCommitment =
         commitment.encryptedMessage +
         elGamalBlindGenerator * -threshold;
     
@@ -455,11 +455,11 @@ bool PrsonaBase::verify_reputation_proof(
 
 std::vector<Proof> PrsonaBase::generate_vote_proof(
     const Proof& ownershipProof,
-    const CurveBipoint& g,
-    const CurveBipoint& h,
+    const TwistBipoint& g,
+    const TwistBipoint& h,
     const std::vector<bool>& replaces,
-    const std::vector<CurveBipoint>& oldEncryptedVotes,
-    const std::vector<CurveBipoint>& newEncryptedVotes,
+    const std::vector<TwistBipoint>& oldEncryptedVotes,
+    const std::vector<TwistBipoint>& newEncryptedVotes,
     const std::vector<Scalar>& seeds,
     const std::vector<Scalar>& votes) const
 {
@@ -504,17 +504,17 @@ std::vector<Proof> PrsonaBase::generate_vote_proof(
             t_1.set_random();
             t_2.set_random();
 
-            CurveBipoint U = h * z_r +
+            TwistBipoint U = h * z_r +
                                 oldEncryptedVotes[i] * x_r -
                                 newEncryptedVotes[i] * x_r;
 
-            CurveBipoint C_a = g * a + h * s;
+            TwistBipoint C_a = g * a + h * s;
 
             Scalar power = ((a + a) * m * m - (a + a + a) * m);
-            CurveBipoint C_b = g * power + h * t_1;
+            TwistBipoint C_b = g * power + h * t_1;
             currProof.curveBipointUniversals.push_back(C_b);
 
-            CurveBipoint C_c = g * (a * a * m) +
+            TwistBipoint C_c = g * (a * a * m) +
                                 h * t_2;
 
             oracleInput << U << C_a << C_b << C_c;
@@ -550,16 +550,16 @@ std::vector<Proof> PrsonaBase::generate_vote_proof(
             z_nb.set_random();
             f.set_random();
 
-            CurveBipoint U = h * u;
+            TwistBipoint U = h * u;
 
-            CurveBipoint C_a = g * f +
+            TwistBipoint C_a = g * f +
                 h * z_na -
                 newEncryptedVotes[i] * x_n;
 
-            CurveBipoint C_b = g * commitmentLambda_1 + h * commitmentLambda_2;
+            TwistBipoint C_b = g * commitmentLambda_1 + h * commitmentLambda_2;
             currProof.curveBipointUniversals.push_back(C_b);
 
-            CurveBipoint C_c =
+            TwistBipoint C_c =
                 h * z_nb -
                 newEncryptedVotes[i] * ((f - x_n) * (x_n + x_n - f)) -
                 C_b * x_n;
@@ -585,13 +585,13 @@ std::vector<Proof> PrsonaBase::generate_vote_proof(
 }
 
 bool PrsonaBase::verify_vote_proof(
-    const CurveBipoint& g,
-    const CurveBipoint& h,
+    const TwistBipoint& g,
+    const TwistBipoint& h,
     const std::vector<Proof>& pi,
-    const std::vector<CurveBipoint>& oldEncryptedVotes,
-    const std::vector<CurveBipoint>& newEncryptedVotes,
-    const Curvepoint& freshGenerator,
-    const Curvepoint& owner) const
+    const std::vector<TwistBipoint>& oldEncryptedVotes,
+    const std::vector<TwistBipoint>& newEncryptedVotes,
+    const Twistpoint& freshGenerator,
+    const Twistpoint& owner) const
 {
     // Reject outright if there's no proof to check
     if (pi.empty())
@@ -621,7 +621,7 @@ bool PrsonaBase::verify_vote_proof(
     for (size_t i = 1; i < pi.size(); i++)
     {
         size_t voteIndex = i - 1;
-        CurveBipoint C_b;
+        TwistBipoint C_b;
         C_b = pi[i].curveBipointUniversals[0];
 
         Scalar x_r, x_n, z_r, f, z_na, z_nb;
@@ -633,7 +633,7 @@ bool PrsonaBase::verify_vote_proof(
         z_na = pi[i].responseParts[2];
         z_nb = pi[i].responseParts[3];
 
-        CurveBipoint U, C_a, C_c;
+        TwistBipoint U, C_a, C_c;
         U = h * z_r +
             oldEncryptedVotes[voteIndex] * x_r -
             newEncryptedVotes[voteIndex] * x_r;
@@ -696,16 +696,16 @@ std::vector<Proof> PrsonaBase::generate_proof_of_added_user(
 
 bool PrsonaBase::verify_proof_of_added_user(
     const std::vector<Proof>& pi,
-    const Curvepoint& currentFreshGenerator,
-    const Curvepoint& shortTermPublicKey,
-    const CurveBipoint& curveG,
-    const CurveBipoint& curveH,
-    const TwistBipoint& twistG,
-    const TwistBipoint& twistH,
+    const Twistpoint& currentFreshGenerator,
+    const Twistpoint& shortTermPublicKey,
+    const TwistBipoint& curveG,
+    const TwistBipoint& curveH,
+    const CurveBipoint& twistG,
+    const CurveBipoint& twistH,
     size_t selfIndex,
     const EGCiphertext& userEncryptedScore,
-    const TwistBipoint& serverEncryptedScore,
-    const std::vector<std::vector<CurveBipoint>> encryptedVoteMatrix) const
+    const CurveBipoint& serverEncryptedScore,
+    const std::vector<std::vector<TwistBipoint>> encryptedVoteMatrix) const
 {
     if (pi.empty())
     {
@@ -739,7 +739,7 @@ bool PrsonaBase::verify_proof_of_added_user(
     
     for (size_t i = 0; i < pi[2].responseParts.size(); i++)
     {
-        CurveBipoint currVote = encryptedVoteMatrix[selfIndex][i];
+        TwistBipoint currVote = encryptedVoteMatrix[selfIndex][i];
         currSeed = pi[2].responseParts[i];
 
         if (i == selfIndex)
@@ -765,7 +765,7 @@ bool PrsonaBase::verify_proof_of_added_user(
 
     for (size_t i = 0; i < pi[3].responseParts.size(); i++)
     {
-        CurveBipoint currVote = encryptedVoteMatrix[i][selfIndex];
+        TwistBipoint currVote = encryptedVoteMatrix[i][selfIndex];
         currSeed = pi[3].responseParts[i];
 
         if (i != selfIndex)
@@ -790,7 +790,7 @@ bool PrsonaBase::verify_proof_of_added_user(
 std::vector<Proof> PrsonaBase::generate_valid_permutation_proof(
     const std::vector<std::vector<Scalar>>& permutations,
     const std::vector<std::vector<Scalar>>& seeds,
-    const std::vector<std::vector<Curvepoint>>& commits) const
+    const std::vector<std::vector<Twistpoint>>& commits) const
 {
     std::vector<Proof> retval;
 
@@ -800,7 +800,7 @@ std::vector<Proof> PrsonaBase::generate_valid_permutation_proof(
         return retval;
     }
 
-    Curvepoint g, h;
+    Twistpoint g, h;
     g = EL_GAMAL_GENERATOR;
     h = elGamalBlindGenerator;
 
@@ -834,7 +834,7 @@ std::vector<Proof> PrsonaBase::generate_valid_permutation_proof(
     {
         for (size_t j = 0; j < permutations[i].size(); j++)
         {
-            Curvepoint C, C_a, C_b;
+            Twistpoint C, C_a, C_b;
         
             Scalar p, r;
             a[i][j].set_random();
@@ -880,7 +880,7 @@ std::vector<Proof> PrsonaBase::generate_valid_permutation_proof(
 
 bool PrsonaBase::verify_valid_permutation_proof(
     const std::vector<Proof>& pi,
-    const std::vector<std::vector<Curvepoint>>& commits) const
+    const std::vector<std::vector<Twistpoint>>& commits) const
 {
    // Reject outright if there's no proof to check
     if (pi.empty())
@@ -892,7 +892,7 @@ bool PrsonaBase::verify_valid_permutation_proof(
     if (!SERVER_IS_MALICIOUS)
         return pi[0].hbc == "PROOF";
 
-    Curvepoint g, h;
+    Twistpoint g, h;
     g = EL_GAMAL_GENERATOR;
     h = elGamalBlindGenerator;
 
@@ -911,7 +911,7 @@ bool PrsonaBase::verify_valid_permutation_proof(
         {
             size_t piIndex = i * commits.size() + j + 1;
 
-            Curvepoint C, C_a, C_b;
+            Twistpoint C, C_a, C_b;
 
             C = commits[i][j];
 
@@ -936,7 +936,7 @@ bool PrsonaBase::verify_valid_permutation_proof(
 
     for (size_t i = 0; i < commits.size(); i++)
     {
-        Curvepoint sum = commits[i][0];
+        Twistpoint sum = commits[i][0];
 
         for (size_t j = 1; j < commits[i].size(); j++)
             sum = sum + commits[i][j];
@@ -956,10 +956,10 @@ std::vector<Proof> PrsonaBase::generate_proof_of_reordering_plus_power(
     const Scalar& power,
     const std::vector<std::vector<Scalar>>& permutationSeeds,
     const std::vector<std::vector<Scalar>>& productSeeds,
-    const std::vector<Curvepoint>& oldValues,
-    const std::vector<std::vector<Curvepoint>>& permutationCommits,
-    const std::vector<std::vector<Curvepoint>>& productCommits,
-    const std::vector<std::vector<Curvepoint>>& seedCommits) const
+    const std::vector<Twistpoint>& oldValues,
+    const std::vector<std::vector<Twistpoint>>& permutationCommits,
+    const std::vector<std::vector<Twistpoint>>& productCommits,
+    const std::vector<std::vector<Twistpoint>>& seedCommits) const
 {
     std::vector<Proof> retval;
 
@@ -972,8 +972,8 @@ std::vector<Proof> PrsonaBase::generate_proof_of_reordering_plus_power(
     Proof first;
     retval.push_back(first);
     
-    Curvepoint g = EL_GAMAL_GENERATOR;
-    Curvepoint h = elGamalBlindGenerator;
+    Twistpoint g = EL_GAMAL_GENERATOR;
+    Twistpoint h = elGamalBlindGenerator;
 
     std::stringstream oracleInput;
     oracleInput << g << h;
@@ -1013,7 +1013,7 @@ std::vector<Proof> PrsonaBase::generate_proof_of_reordering_plus_power(
             Scalar currt1;
             Scalar currt2;
 
-            Curvepoint U1, U2, U3, U4;
+            Twistpoint U1, U2, U3, U4;
 
             currb2.set_random();
             currt1.set_random();
@@ -1068,10 +1068,10 @@ std::vector<Proof> PrsonaBase::generate_proof_of_reordering_plus_power(
 
 bool PrsonaBase::verify_proof_of_reordering_plus_power(
     const std::vector<Proof>& pi,
-    const std::vector<Curvepoint>& oldValues,
-    const std::vector<std::vector<Curvepoint>>& permutationCommits,
-    const std::vector<std::vector<Curvepoint>>& productCommits,
-    const std::vector<std::vector<Curvepoint>>& seedCommits) const
+    const std::vector<Twistpoint>& oldValues,
+    const std::vector<std::vector<Twistpoint>>& permutationCommits,
+    const std::vector<std::vector<Twistpoint>>& productCommits,
+    const std::vector<std::vector<Twistpoint>>& seedCommits) const
 {
     if (pi.empty())
         return false;
@@ -1079,8 +1079,8 @@ bool PrsonaBase::verify_proof_of_reordering_plus_power(
     if (!SERVER_IS_MALICIOUS)
         return pi[0].hbc == "PROOF";
     
-    Curvepoint g = EL_GAMAL_GENERATOR;
-    Curvepoint h = elGamalBlindGenerator;
+    Twistpoint g = EL_GAMAL_GENERATOR;
+    Twistpoint h = elGamalBlindGenerator;
 
     std::stringstream oracleInput;
     oracleInput << g << h;
@@ -1109,7 +1109,7 @@ bool PrsonaBase::verify_proof_of_reordering_plus_power(
         {
             size_t piIndex = i * permutationCommits.size() + j + 1;
 
-            Curvepoint U1, U2, U3, U4;
+            Twistpoint U1, U2, U3, U4;
             U2 = pi[piIndex].curvepointUniversals[0];
 
             Scalar f2 = pi[piIndex].responseParts[0];
@@ -1137,12 +1137,12 @@ bool PrsonaBase::verify_proof_of_reordering_plus_power(
 
     for (size_t i = 0; i < seedCommits.size(); i++)
     {
-        Curvepoint sum = seedCommits[i][0];
+        Twistpoint sum = seedCommits[i][0];
 
         for (size_t j = 1; j < seedCommits[i].size(); j++)
             sum = sum + seedCommits[i][j];
 
-        if (sum != Curvepoint())
+        if (sum != Twistpoint())
         {
             std::cerr << "seed commits did not sum to 0, aborting." << std::endl;
             return false;
@@ -1155,16 +1155,16 @@ bool PrsonaBase::verify_proof_of_reordering_plus_power(
 std::vector<Proof> PrsonaBase::generate_user_tally_proofs(
     const std::vector<std::vector<Scalar>>& permutations,
     const Scalar& power,
-    const Curvepoint& nextGenerator,
+    const Twistpoint& nextGenerator,
     const std::vector<std::vector<Scalar>>& permutationSeeds,
     const std::vector<std::vector<Scalar>>& userTallySeeds,
-    const std::vector<Curvepoint>& currPseudonyms,
-    const std::vector<Curvepoint>& userTallyMasks,
-    const std::vector<Curvepoint>& userTallyMessages,
-    const std::vector<std::vector<Curvepoint>>& permutationCommits,
-    const std::vector<std::vector<Curvepoint>>& userTallyMaskCommits,
-    const std::vector<std::vector<Curvepoint>>& userTallyMessageCommits,
-    const std::vector<std::vector<Curvepoint>>& userTallySeedCommits) const
+    const std::vector<Twistpoint>& currPseudonyms,
+    const std::vector<Twistpoint>& userTallyMasks,
+    const std::vector<Twistpoint>& userTallyMessages,
+    const std::vector<std::vector<Twistpoint>>& permutationCommits,
+    const std::vector<std::vector<Twistpoint>>& userTallyMaskCommits,
+    const std::vector<std::vector<Twistpoint>>& userTallyMessageCommits,
+    const std::vector<std::vector<Twistpoint>>& userTallySeedCommits) const
 {
     std::vector<Proof> retval;
 
@@ -1177,8 +1177,8 @@ std::vector<Proof> PrsonaBase::generate_user_tally_proofs(
     Proof first;
     retval.push_back(first);
     
-    Curvepoint g = EL_GAMAL_GENERATOR;
-    Curvepoint h = elGamalBlindGenerator;
+    Twistpoint g = EL_GAMAL_GENERATOR;
+    Twistpoint h = elGamalBlindGenerator;
 
     std::stringstream oracleInput;
     oracleInput << g << h << nextGenerator;
@@ -1228,7 +1228,7 @@ std::vector<Proof> PrsonaBase::generate_user_tally_proofs(
             Scalar currt1;
             Scalar currt2;
 
-            Curvepoint U1, U2, U3, U4, U5, U6, U7;
+            Twistpoint U1, U2, U3, U4, U5, U6, U7;
 
             currb2.set_random();
             currt1.set_random();
@@ -1300,14 +1300,14 @@ std::vector<Proof> PrsonaBase::generate_user_tally_proofs(
 
 bool PrsonaBase::verify_user_tally_proofs(
     const std::vector<Proof>& pi,
-    const Curvepoint& nextGenerator,
-    const std::vector<Curvepoint>& currPseudonyms,
-    const std::vector<Curvepoint>& userTallyMasks,
-    const std::vector<Curvepoint>& userTallyMessages,
-    const std::vector<std::vector<Curvepoint>>& permutationCommits,
-    const std::vector<std::vector<Curvepoint>>& userTallyMaskCommits,
-    const std::vector<std::vector<Curvepoint>>& userTallyMessageCommits,
-    const std::vector<std::vector<Curvepoint>>& userTallySeedCommits) const
+    const Twistpoint& nextGenerator,
+    const std::vector<Twistpoint>& currPseudonyms,
+    const std::vector<Twistpoint>& userTallyMasks,
+    const std::vector<Twistpoint>& userTallyMessages,
+    const std::vector<std::vector<Twistpoint>>& permutationCommits,
+    const std::vector<std::vector<Twistpoint>>& userTallyMaskCommits,
+    const std::vector<std::vector<Twistpoint>>& userTallyMessageCommits,
+    const std::vector<std::vector<Twistpoint>>& userTallySeedCommits) const
 {
     if (pi.empty())
         return false;
@@ -1315,8 +1315,8 @@ bool PrsonaBase::verify_user_tally_proofs(
     if (!SERVER_IS_MALICIOUS)
         return pi[0].hbc == "PROOF";
     
-    Curvepoint g = EL_GAMAL_GENERATOR;
-    Curvepoint h = elGamalBlindGenerator;
+    Twistpoint g = EL_GAMAL_GENERATOR;
+    Twistpoint h = elGamalBlindGenerator;
 
     std::stringstream oracleInput;
     oracleInput << g << h << nextGenerator;
@@ -1355,7 +1355,7 @@ bool PrsonaBase::verify_user_tally_proofs(
         {
             size_t piIndex = i * permutationCommits.size() + j + 1;
 
-            Curvepoint U1, U2, U3, U4, U5, U6, U7;
+            Twistpoint U1, U2, U3, U4, U5, U6, U7;
             U2 = pi[piIndex].curvepointUniversals[0];
             U3 = pi[piIndex].curvepointUniversals[1];
             U5 = pi[piIndex].curvepointUniversals[2];
@@ -1393,12 +1393,12 @@ bool PrsonaBase::verify_user_tally_proofs(
 
     for (size_t i = 0; i < userTallySeedCommits.size(); i++)
     {
-        Curvepoint sum = userTallySeedCommits[i][0];
+        Twistpoint sum = userTallySeedCommits[i][0];
 
         for (size_t j = 1; j < userTallySeedCommits[i].size(); j++)
             sum = sum + userTallySeedCommits[i][j];
 
-        if (sum != Curvepoint())
+        if (sum != Twistpoint())
         {
             std::cerr << "seed commits did not sum to 0, aborting." << std::endl;
             return false;
@@ -1414,7 +1414,7 @@ std::vector<Proof> PrsonaBase::generate_proof_of_reordering(
     const std::vector<std::vector<Scalar>>& permutationSeeds,
     const std::vector<std::vector<Scalar>>& productSeeds,
     const std::vector<T>& oldValues,
-    const std::vector<std::vector<Curvepoint>>& permutationCommits,
+    const std::vector<std::vector<Twistpoint>>& permutationCommits,
     const std::vector<std::vector<T>>& productCommits,
     const T& otherG,
     const T& otherH) const
@@ -1430,8 +1430,8 @@ std::vector<Proof> PrsonaBase::generate_proof_of_reordering(
     Proof first;
     retval.push_back(first);
 
-    Curvepoint g = EL_GAMAL_GENERATOR;
-    Curvepoint h = elGamalBlindGenerator;
+    Twistpoint g = EL_GAMAL_GENERATOR;
+    Twistpoint h = elGamalBlindGenerator;
 
     std::stringstream oracleInput;
     oracleInput << g << h << otherG << otherH;
@@ -1465,7 +1465,7 @@ std::vector<Proof> PrsonaBase::generate_proof_of_reordering(
             Scalar currt1;
             Scalar currt2;
 
-            Curvepoint U1;
+            Twistpoint U1;
             T U2;
 
             curra.set_random();
@@ -1519,7 +1519,7 @@ template <typename T>
 bool PrsonaBase::verify_proof_of_reordering(
     const std::vector<Proof>& pi,
     const std::vector<T>& oldValues,
-    const std::vector<std::vector<Curvepoint>>& permutationCommits,
+    const std::vector<std::vector<Twistpoint>>& permutationCommits,
     const std::vector<std::vector<T>>& productCommits,
     const T& otherG,
     const T& otherH) const
@@ -1530,8 +1530,8 @@ bool PrsonaBase::verify_proof_of_reordering(
     if (!SERVER_IS_MALICIOUS)
         return pi[0].hbc == "PROOF";
 
-    Curvepoint g = EL_GAMAL_GENERATOR;
-    Curvepoint h = elGamalBlindGenerator;
+    Twistpoint g = EL_GAMAL_GENERATOR;
+    Twistpoint h = elGamalBlindGenerator;
 
     std::stringstream oracleInput;
     oracleInput << g << h << otherG << otherH;
@@ -1555,7 +1555,7 @@ bool PrsonaBase::verify_proof_of_reordering(
         {
             size_t piIndex = i * permutationCommits.size() + j + 1;
 
-            Curvepoint U1;
+            Twistpoint U1;
             T U2;
 
             Scalar f = pi[piIndex].responseParts[0];
@@ -1590,7 +1590,7 @@ bool PrsonaBase::verify_proof_of_reordering(
  */
 
 Proof PrsonaBase::generate_valid_vote_row_proof(
-    const std::vector<CurveBipoint>& commitment) const
+    const std::vector<TwistBipoint>& commitment) const
 {
     Proof retval;
 
@@ -1611,7 +1611,7 @@ Proof PrsonaBase::generate_valid_vote_row_proof(
 }
 
 Proof PrsonaBase::generate_valid_vote_matrix_proof(
-    const std::vector<std::vector<CurveBipoint>>& commitment) const
+    const std::vector<std::vector<TwistBipoint>>& commitment) const
 {
     Proof retval;
 
@@ -1653,7 +1653,7 @@ Proof PrsonaBase::generate_valid_user_tally_proof(
 }
 
 Proof PrsonaBase::generate_valid_server_tally_proof(
-    const TwistBipoint& commitment) const
+    const CurveBipoint& commitment) const
 {
     Proof retval;
 
@@ -1673,7 +1673,7 @@ Proof PrsonaBase::generate_valid_server_tally_proof(
 }
 
 Proof PrsonaBase::generate_valid_pseudonyms_proof(
-    const std::vector<Curvepoint>& commitment) const
+    const std::vector<Twistpoint>& commitment) const
 {
     Proof retval;
 
@@ -1695,7 +1695,7 @@ Proof PrsonaBase::generate_valid_pseudonyms_proof(
 
 bool PrsonaBase::verify_valid_vote_row_proof(
     const std::vector<Proof>& pi,
-    const std::vector<CurveBipoint>& commitment) const
+    const std::vector<TwistBipoint>& commitment) const
 {
     if (pi.empty())
         return false;
@@ -1725,7 +1725,7 @@ bool PrsonaBase::verify_valid_vote_row_proof(
 
 bool PrsonaBase::verify_valid_vote_matrix_proof(
     const std::vector<Proof>& pi,
-    const std::vector<std::vector<CurveBipoint>>& commitment) const
+    const std::vector<std::vector<TwistBipoint>>& commitment) const
 {
     if (pi.empty())
         return false;
@@ -1785,7 +1785,7 @@ bool PrsonaBase::verify_valid_user_tally_proof(
 
 bool PrsonaBase::verify_valid_server_tally_proof(
     const std::vector<Proof>& pi,
-    const TwistBipoint& commitment) const
+    const CurveBipoint& commitment) const
 {
     if (pi.empty())
         return false;
@@ -1814,7 +1814,7 @@ bool PrsonaBase::verify_valid_server_tally_proof(
 
 bool PrsonaBase::verify_valid_pseudonyms_proof(
     const std::vector<Proof>& pi,
-    const std::vector<Curvepoint>& commitment) const
+    const std::vector<Twistpoint>& commitment) const
 {
     if (pi.empty())
         return false;
@@ -1842,56 +1842,56 @@ bool PrsonaBase::verify_valid_pseudonyms_proof(
     return agreement * 2 > pi.size();
 }
 
-template std::vector<Proof> PrsonaBase::generate_proof_of_reordering<Curvepoint>(
+template std::vector<Proof> PrsonaBase::generate_proof_of_reordering<Twistpoint>(
     const std::vector<std::vector<Scalar>>& permutations,
     const std::vector<std::vector<Scalar>>& permutationSeeds,
     const std::vector<std::vector<Scalar>>& productSeeds,
-    const std::vector<Curvepoint>& oldValues,
-    const std::vector<std::vector<Curvepoint>>& permutationCommits,
-    const std::vector<std::vector<Curvepoint>>& productCommits,
-    const Curvepoint& otherG,
-    const Curvepoint& otherH) const;
-
-template std::vector<Proof> PrsonaBase::generate_proof_of_reordering<CurveBipoint>(
-    const std::vector<std::vector<Scalar>>& permutations,
-    const std::vector<std::vector<Scalar>>& permutationSeeds,
-    const std::vector<std::vector<Scalar>>& productSeeds,
-    const std::vector<CurveBipoint>& oldValues,
-    const std::vector<std::vector<Curvepoint>>& permutationCommits,
-    const std::vector<std::vector<CurveBipoint>>& productCommits,
-    const CurveBipoint& otherG,
-    const CurveBipoint& otherH) const;
+    const std::vector<Twistpoint>& oldValues,
+    const std::vector<std::vector<Twistpoint>>& permutationCommits,
+    const std::vector<std::vector<Twistpoint>>& productCommits,
+    const Twistpoint& otherG,
+    const Twistpoint& otherH) const;
 
 template std::vector<Proof> PrsonaBase::generate_proof_of_reordering<TwistBipoint>(
     const std::vector<std::vector<Scalar>>& permutations,
     const std::vector<std::vector<Scalar>>& permutationSeeds,
     const std::vector<std::vector<Scalar>>& productSeeds,
     const std::vector<TwistBipoint>& oldValues,
-    const std::vector<std::vector<Curvepoint>>& permutationCommits,
+    const std::vector<std::vector<Twistpoint>>& permutationCommits,
     const std::vector<std::vector<TwistBipoint>>& productCommits,
     const TwistBipoint& otherG,
     const TwistBipoint& otherH) const;
 
-template bool PrsonaBase::verify_proof_of_reordering<Curvepoint>(
-    const std::vector<Proof>& pi,
-    const std::vector<Curvepoint>& oldValues,
-    const std::vector<std::vector<Curvepoint>>& permutationCommits,
-    const std::vector<std::vector<Curvepoint>>& productCommits,
-    const Curvepoint& otherG,
-    const Curvepoint& otherH) const;
-
-template bool PrsonaBase::verify_proof_of_reordering<CurveBipoint>(
-    const std::vector<Proof>& pi,
+template std::vector<Proof> PrsonaBase::generate_proof_of_reordering<CurveBipoint>(
+    const std::vector<std::vector<Scalar>>& permutations,
+    const std::vector<std::vector<Scalar>>& permutationSeeds,
+    const std::vector<std::vector<Scalar>>& productSeeds,
     const std::vector<CurveBipoint>& oldValues,
-    const std::vector<std::vector<Curvepoint>>& permutationCommits,
+    const std::vector<std::vector<Twistpoint>>& permutationCommits,
     const std::vector<std::vector<CurveBipoint>>& productCommits,
     const CurveBipoint& otherG,
     const CurveBipoint& otherH) const;
 
+template bool PrsonaBase::verify_proof_of_reordering<Twistpoint>(
+    const std::vector<Proof>& pi,
+    const std::vector<Twistpoint>& oldValues,
+    const std::vector<std::vector<Twistpoint>>& permutationCommits,
+    const std::vector<std::vector<Twistpoint>>& productCommits,
+    const Twistpoint& otherG,
+    const Twistpoint& otherH) const;
+
 template bool PrsonaBase::verify_proof_of_reordering<TwistBipoint>(
     const std::vector<Proof>& pi,
     const std::vector<TwistBipoint>& oldValues,
-    const std::vector<std::vector<Curvepoint>>& permutationCommits,
+    const std::vector<std::vector<Twistpoint>>& permutationCommits,
     const std::vector<std::vector<TwistBipoint>>& productCommits,
     const TwistBipoint& otherG,
     const TwistBipoint& otherH) const;
+
+template bool PrsonaBase::verify_proof_of_reordering<CurveBipoint>(
+    const std::vector<Proof>& pi,
+    const std::vector<CurveBipoint>& oldValues,
+    const std::vector<std::vector<Twistpoint>>& permutationCommits,
+    const std::vector<std::vector<CurveBipoint>>& productCommits,
+    const CurveBipoint& otherG,
+    const CurveBipoint& otherH) const;

+ 22 - 22
prsona/src/client.cpp

@@ -12,7 +12,7 @@
 
 PrsonaClient::PrsonaClient(
     const std::vector<Proof>& generatorProof,
-    const Curvepoint& elGamalBlindGenerator,
+    const Twistpoint& elGamalBlindGenerator,
     const BGNPublicKey& serverPublicKey,
     size_t numServers)
     : serverPublicKey(serverPublicKey),
@@ -32,12 +32,12 @@ PrsonaClient::PrsonaClient(
  * BASIC PUBLIC SYSTEM INFO GETTERS
  */
 
-Curvepoint PrsonaClient::get_short_term_public_key() const
+Twistpoint PrsonaClient::get_short_term_public_key() const
 {
     return currentFreshGenerator * longTermPrivateKey;
 }
 
-Curvepoint PrsonaClient::get_short_term_public_key(Proof &pi) const
+Twistpoint PrsonaClient::get_short_term_public_key(Proof &pi) const
 {
     pi = generate_ownership_proof();
     return currentFreshGenerator * longTermPrivateKey;
@@ -52,10 +52,10 @@ Curvepoint PrsonaClient::get_short_term_public_key(Proof &pi) const
  *
  * You may really want to make currentEncryptedVotes a member variable, 
  * but it doesn't behave correctly when adding new clients after this one. */
-std::vector<CurveBipoint> PrsonaClient::make_votes(
+std::vector<TwistBipoint> PrsonaClient::make_votes(
     std::vector<Proof>& validVoteProof,
     const std::vector<Proof>& serverProof,
-    const std::vector<CurveBipoint>& oldEncryptedVotes,
+    const std::vector<TwistBipoint>& oldEncryptedVotes,
     const std::vector<Scalar>& votes,
     const std::vector<bool>& replaces) const
 {
@@ -66,14 +66,14 @@ std::vector<CurveBipoint> PrsonaClient::make_votes(
     }
 
     std::vector<Scalar> seeds(oldEncryptedVotes.size());
-    std::vector<CurveBipoint> newEncryptedVotes(oldEncryptedVotes.size());
+    std::vector<TwistBipoint> newEncryptedVotes(oldEncryptedVotes.size());
 
     for (size_t i = 0; i < votes.size(); i++)
     {
         if (replaces[i])
         {
             newEncryptedVotes[i] =
-                serverPublicKey.curveEncrypt(seeds[i], votes[i]);
+                serverPublicKey.twistEncrypt(seeds[i], votes[i]);
         }
         else
         {
@@ -90,7 +90,7 @@ std::vector<CurveBipoint> PrsonaClient::make_votes(
 // Get a new fresh generator (happens at initialization and during each epoch)
 bool PrsonaClient::receive_fresh_generator(
     const std::vector<Proof>& pi,
-    const Curvepoint& freshGenerator)
+    const Twistpoint& freshGenerator)
 {
     if (!verify_generator_proof(pi, freshGenerator, numServers))
     {
@@ -121,15 +121,15 @@ bool PrsonaClient::receive_vote_tally(
 bool PrsonaClient::receive_new_user_data(
     const std::vector<Proof>& mainProof,
     const std::vector<Proof>& serverEncryptedScoreProof,
-    const TwistBipoint& serverEncryptedScore,
+    const CurveBipoint& serverEncryptedScore,
     const std::vector<Proof>& userEncryptedScoreProof,
     const EGCiphertext& userEncryptedScore,
     const std::vector<Proof>& voteMatrixProof,
-    const std::vector<std::vector<CurveBipoint>>& encryptedVoteMatrix,
+    const std::vector<std::vector<TwistBipoint>>& encryptedVoteMatrix,
     const std::vector<Proof>& pseudonymsProof,
-    const std::vector<Curvepoint>& currentPseudonyms)
+    const std::vector<Twistpoint>& currentPseudonyms)
 {
-    Curvepoint shortTermPublicKey = get_short_term_public_key();
+    Twistpoint shortTermPublicKey = get_short_term_public_key();
 
     if (!verify_valid_server_tally_proof(serverEncryptedScoreProof, serverEncryptedScore))
     {
@@ -166,10 +166,10 @@ bool PrsonaClient::receive_new_user_data(
         mainProof,
         currentFreshGenerator,
         shortTermPublicKey,
-        serverPublicKey.get_bipoint_curvegen(),
-        serverPublicKey.get_bipoint_curve_subgroup_gen(),
         serverPublicKey.get_bipoint_twistgen(),
         serverPublicKey.get_bipoint_twist_subgroup_gen(),
+        serverPublicKey.get_bipoint_curvegen(),
+        serverPublicKey.get_bipoint_curve_subgroup_gen(),
         selfIndex,
         userEncryptedScore,
         serverEncryptedScore,
@@ -209,7 +209,7 @@ std::vector<Proof> PrsonaClient::generate_reputation_proof(
 
 bool PrsonaClient::verify_reputation_proof(
     const std::vector<Proof>& pi,
-    const Curvepoint& shortTermPublicKey,
+    const Twistpoint& shortTermPublicKey,
     const Scalar& threshold,
     const std::vector<Proof>& encryptedScoreProof,
     const EGCiphertext& encryptedScore) const
@@ -240,7 +240,7 @@ Scalar PrsonaClient::get_score() const
 // Basic memoized score decryption
 Scalar PrsonaClient::decrypt_score(const EGCiphertext& score)
 {
-    Curvepoint s, hashedDecrypted;
+    Twistpoint s, hashedDecrypted;
 
     // Remove the mask portion of the ciphertext
     s = score.mask * inversePrivateKey;
@@ -253,7 +253,7 @@ Scalar PrsonaClient::decrypt_score(const EGCiphertext& score)
 
     // If not, iterate until we find it (adding everything to the memoization)
     max_checked++;
-    Curvepoint decryptionCandidate = elGamalBlindGenerator * max_checked;
+    Twistpoint decryptionCandidate = elGamalBlindGenerator * max_checked;
     while (decryptionCandidate != hashedDecrypted)
     {
         decryption_memoizer[decryptionCandidate] = max_checked;
@@ -274,7 +274,7 @@ Scalar PrsonaClient::decrypt_score(const EGCiphertext& score)
 // Prove ownership of the short term public key
 Proof PrsonaClient::generate_ownership_proof() const
 {
-    Curvepoint shortTermPublicKey = currentFreshGenerator * longTermPrivateKey;
+    Twistpoint shortTermPublicKey = currentFreshGenerator * longTermPrivateKey;
 
     return PrsonaBase::generate_ownership_proof(
         currentFreshGenerator, shortTermPublicKey, longTermPrivateKey);
@@ -286,8 +286,8 @@ Proof PrsonaClient::generate_ownership_proof() const
 
 std::vector<Proof> PrsonaClient::generate_vote_proof(
     const std::vector<bool>& replaces,
-    const std::vector<CurveBipoint>& oldEncryptedVotes,
-    const std::vector<CurveBipoint>& newEncryptedVotes,
+    const std::vector<TwistBipoint>& oldEncryptedVotes,
+    const std::vector<TwistBipoint>& newEncryptedVotes,
     const std::vector<Scalar>& seeds,
     const std::vector<Scalar>& votes) const
 {
@@ -295,8 +295,8 @@ std::vector<Proof> PrsonaClient::generate_vote_proof(
 
     return PrsonaBase::generate_vote_proof(
         pi,
-        serverPublicKey.get_bipoint_curvegen(),
-        serverPublicKey.get_bipoint_curve_subgroup_gen(),
+        serverPublicKey.get_bipoint_twistgen(),
+        serverPublicKey.get_bipoint_twist_subgroup_gen(),
         replaces,
         oldEncryptedVotes,
         newEncryptedVotes,

+ 15 - 15
prsona/src/main.cpp

@@ -37,7 +37,7 @@ void print_user_scores(const vector<PrsonaClient>& users)
 // Time how long it takes to make a proof of valid votes
 vector<double> make_votes(
     default_random_engine& generator,
-    vector<vector<CurveBipoint>>& newEncryptedVotes,
+    vector<vector<TwistBipoint>>& newEncryptedVotes,
     vector<vector<Proof>>& validVoteProofs,
     const vector<PrsonaClient>& users,
     const PrsonaServerEntity& servers,
@@ -64,9 +64,9 @@ vector<double> make_votes(
         
         Proof baseProof;
         vector<Proof> fullProof;
-        Curvepoint shortTermPublicKey =
+        Twistpoint shortTermPublicKey =
             users[i].get_short_term_public_key();
-        vector<CurveBipoint> currEncryptedVotes =
+        vector<TwistBipoint> currEncryptedVotes =
             servers.get_current_votes_by(baseProof, shortTermPublicKey);
         fullProof.push_back(baseProof);
         servers.get_other_vote_row_commitments(fullProof, shortTermPublicKey);
@@ -96,7 +96,7 @@ vector<double> make_votes(
 
 // Time how long it takes to validate a proof of valid votes
 vector<double> transmit_votes_to_servers(
-    const vector<vector<CurveBipoint>>& newEncryptedVotes,
+    const vector<vector<TwistBipoint>>& newEncryptedVotes,
     const vector<vector<Proof>>& validVoteProofs,
     const vector<PrsonaClient>& users,
     PrsonaServerEntity& servers)
@@ -108,7 +108,7 @@ vector<double> transmit_votes_to_servers(
     for (size_t i = 0; i < numUsers; i++)
     {
         Proof ownerProof;
-        Curvepoint shortTermPublicKey =
+        Twistpoint shortTermPublicKey =
             users[i].get_short_term_public_key(ownerProof);
 
         for (size_t j = 0; j < numServers; j++)
@@ -189,7 +189,7 @@ void test_reputation_proof(
     Scalar goodThreshold(thresholdDistribution(generator));
     Scalar badThreshold(aScore + 1);
 
-    Curvepoint shortTermPublicKey = a.get_short_term_public_key();
+    Twistpoint shortTermPublicKey = a.get_short_term_public_key();
     vector<Proof> goodRepProof =
         a.generate_reputation_proof(goodThreshold, servers.get_num_clients());
 
@@ -252,9 +252,9 @@ void test_vote_proof(
 
     Proof baseProof;
     vector<Proof> fullProof;
-    Curvepoint shortTermPublicKey =
+    Twistpoint shortTermPublicKey =
         user.get_short_term_public_key();
-    vector<CurveBipoint> encryptedVotes =
+    vector<TwistBipoint> encryptedVotes =
         servers.get_current_votes_by(baseProof, shortTermPublicKey);
     fullProof.push_back(baseProof);
     servers.get_other_vote_row_commitments(fullProof, shortTermPublicKey);
@@ -333,7 +333,7 @@ void check_vote_matrix_updates()
     PrsonaServerEntity servers(numServers);
     vector<Proof> elGamalBlindGeneratorProof;
     BGNPublicKey bgnPublicKey = servers.get_bgn_public_key();
-    Curvepoint elGamalBlindGenerator =
+    Twistpoint elGamalBlindGenerator =
         servers.get_blinding_generator(elGamalBlindGeneratorProof);
 
     vector<PrsonaClient> users;
@@ -349,14 +349,14 @@ void check_vote_matrix_updates()
     }
 
     Proof pseudonymsProof;
-    vector<Curvepoint> currentPseudonyms =
+    vector<Twistpoint> currentPseudonyms =
         servers.get_current_pseudonyms(pseudonymsProof);
 
     cout << "Making votes." << endl;
 
     for (size_t i = 0; i < numUsers; i++)
     {   
-        Curvepoint shortTermPublicKey =
+        Twistpoint shortTermPublicKey =
             users[i].get_short_term_public_key();
 
         size_t myIndex =
@@ -379,7 +379,7 @@ void check_vote_matrix_updates()
 
         Proof baseProof;
         vector<Proof> fullProof;
-        vector<CurveBipoint> currEncryptedVotes =
+        vector<TwistBipoint> currEncryptedVotes =
             servers.get_current_votes_by(baseProof, shortTermPublicKey);
         fullProof.push_back(baseProof);
         servers.get_other_vote_row_commitments(fullProof, shortTermPublicKey);
@@ -415,7 +415,7 @@ void check_vote_matrix_updates()
     for (size_t i = 0; i < numUsers; i++)
     {   
         Proof ownerProof;
-        Curvepoint shortTermPublicKey =
+        Twistpoint shortTermPublicKey =
             users[i].get_short_term_public_key(ownerProof);
 
         cout << "User " << i+1 << " now has the following votes:" << endl;
@@ -478,7 +478,7 @@ int main(int argc, char *argv[])
     PrsonaServerEntity servers(numServers);
     vector<Proof> elGamalBlindGeneratorProof;
     BGNPublicKey bgnPublicKey = servers.get_bgn_public_key();
-    Curvepoint elGamalBlindGenerator =
+    Twistpoint elGamalBlindGenerator =
         servers.get_blinding_generator(elGamalBlindGeneratorProof);
 
     cout << "Initialization: adding users to system" << endl << endl;
@@ -505,7 +505,7 @@ int main(int argc, char *argv[])
 
         cout << "Round " << i+1 << " of " << numRounds << ": " << endl;
         
-        vector<vector<CurveBipoint>> newEncryptedVotes;
+        vector<vector<TwistBipoint>> newEncryptedVotes;
         vector<vector<Proof>> validVoteProofs;
         timings = make_votes(
             generator,

+ 1 - 1
prsona/src/networkClient.cpp

@@ -2,7 +2,7 @@
 
 PrsonaNetworkClient::PrsonaNetworkClient(
     const std::vector<Proof>& generatorProof,
-    const Curvepoint& elGamalBlindGenerator,
+    const Twistpoint& elGamalBlindGenerator,
     const BGNPublicKey& serverPublicKey,
     size_t numServers)
 : PrsonaClient(generatorProof, elGamalBlindGenerator, serverPublicKey, numServers)

+ 2 - 2
prsona/src/proof.cpp

@@ -109,7 +109,7 @@ std::istream& operator>>(std::istream& is, Proof& input)
     is >> numElements;
     for (size_t i = 0; i < numElements; i++)
     {
-        Curvepoint x;
+        Twistpoint x;
         is >> x;
         input.curvepointUniversals.push_back(x);
     }
@@ -117,7 +117,7 @@ std::istream& operator>>(std::istream& is, Proof& input)
     is >> numElements;
     for (size_t i = 0; i < numElements; i++)
     {
-        CurveBipoint x;
+        TwistBipoint x;
         is >> x;
         input.curveBipointUniversals.push_back(x);
     }

+ 178 - 178
prsona/src/server.cpp

@@ -49,9 +49,9 @@ size_t PrsonaServer::get_num_servers() const
 
 // To calculate the current epoch's generator, start from the base generator,
 // then have every server call this function on it iteratively (in any order).
-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(
 
 // To calculate the next epoch's generator, start from the base generator,
 // then have every server call this function on it iteratively (in any order).
-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(
     // The first epoch's score for a new user will be low,
     // but will typically converge on an average score quickly
     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);
 
     // Users are defaulted to casting a neutral vote for others.
-    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(
 // Receive a new vote row from a user (identified by short term public key).
 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(
 
 // To calculate the blind generator for ElGamal, start from the base generator,
 // then have every server call this function on it iteratively (in any order).
-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()
 {
     // FOLDL
-    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()
 // The first round, going from A_0 to A_0.5
 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;
 }