Browse Source

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

tristangurtler 3 years ago
parent
commit
da32b7a842

+ 3 - 3
prsona/inc/EGCiphertext.hpp

@@ -6,9 +6,9 @@
 class EGCiphertext {
 class EGCiphertext {
     public:
     public:
         EGCiphertext();
         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;
         bool operator==(const EGCiphertext& other) const;
         friend std::ostream& operator<<(std::ostream& os, const EGCiphertext& output);
         friend std::ostream& operator<<(std::ostream& os, const EGCiphertext& output);

+ 72 - 72
prsona/inc/base.hpp

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

+ 14 - 14
prsona/inc/client.hpp

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

+ 1 - 1
prsona/inc/networkClient.hpp

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

+ 2 - 2
prsona/inc/proof.hpp

@@ -23,8 +23,8 @@ class Proof {
         std::string hbc;
         std::string hbc;
 
 
         // Malicious security
         // 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> challengeParts;
         std::vector<Scalar> responseParts;
         std::vector<Scalar> responseParts;
 
 

+ 100 - 100
prsona/inc/server.hpp

@@ -23,42 +23,42 @@ class PrsonaServer : public PrsonaBase {
         size_t get_num_servers() const;
         size_t get_num_servers() const;
         
         
         // FRESH GENERATOR CALCULATION
         // FRESH GENERATOR CALCULATION
-        Curvepoint add_curr_seed_to_generator(
+        Twistpoint add_curr_seed_to_generator(
             std::vector<Proof>& pi,
             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,
             std::vector<Proof>& pi,
-            const Curvepoint& currGenerator) const;
+            const Twistpoint& currGenerator) const;
 
 
         // ENCRYPTED DATA GETTERS
         // 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;
             Proof& pi) const;
         EGCiphertext get_current_user_encrypted_tally(
         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 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_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;
         Proof get_pseudonyms_commitment() const;
 
 
         // CLIENT INTERACTIONS
         // CLIENT INTERACTIONS
         void add_new_client(
         void add_new_client(
             std::vector<Proof>& proofOfValidAddition,
             std::vector<Proof>& proofOfValidAddition,
             const Proof& proofOfValidKey,
             const Proof& proofOfValidKey,
-            const Curvepoint& shortTermPublicKey);
+            const Twistpoint& shortTermPublicKey);
         bool receive_vote(
         bool receive_vote(
             const std::vector<Proof>& pi,
             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:
     private:
         // constants for servers
         // constants for servers
@@ -72,11 +72,11 @@ class PrsonaServer : public PrsonaBase {
         Scalar nextSeed;
         Scalar nextSeed;
 
 
         // The actual data, which is collaboratively updated by all servers
         // 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<EGCiphertext> currentUserEncryptedTallies;
-        std::vector<std::vector<CurveBipoint>> voteMatrix;
+        std::vector<std::vector<TwistBipoint>> voteMatrix;
 
 
         /**
         /**
          * NOTE: voteMatrix structure:
          * NOTE: voteMatrix structure:
@@ -93,13 +93,13 @@ class PrsonaServer : public PrsonaBase {
         const BGN& get_bgn_details() const;
         const BGN& get_bgn_details() const;
         bool initialize_fresh_generator(
         bool initialize_fresh_generator(
             const std::vector<Proof>& pi,
             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,
             std::vector<Proof>& pi,
-            const Curvepoint& currGenerator) const;
+            const Twistpoint& currGenerator) const;
         bool set_EG_blind_generator(
         bool set_EG_blind_generator(
             const std::vector<Proof>& pi,
             const std::vector<Proof>& pi,
-            const Curvepoint& currGenerator);
+            const Twistpoint& currGenerator);
         
         
         // SCORE TALLYING
         // SCORE TALLYING
         std::vector<Scalar> tally_scores();
         std::vector<Scalar> tally_scores();
@@ -108,85 +108,85 @@ class PrsonaServer : public PrsonaBase {
         // EPOCH ROUNDS
         // EPOCH ROUNDS
         void build_up_midway_pseudonyms(
         void build_up_midway_pseudonyms(
             std::vector<std::vector<std::vector<Proof>>>& pi,
             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(
         void break_down_midway_pseudonyms(
             std::vector<Proof>& generatorProof,
             std::vector<Proof>& generatorProof,
             std::vector<std::vector<std::vector<Proof>>>& pi,
             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
         // EPOCH HELPERS
         std::vector<std::vector<Proof>> epoch_calculations(
         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 Scalar& power,
-            const Curvepoint& nextGenerator,
+            const Twistpoint& nextGenerator,
             bool doUserTallies);
             bool doUserTallies);
 
 
         bool accept_epoch_updates(
         bool accept_epoch_updates(
             const std::vector<std::vector<Proof>>& pi,
             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 doUserTallies);
 
 
         std::vector<std::vector<Scalar>> generate_permutation_matrix(
         std::vector<std::vector<Scalar>> generate_permutation_matrix(
             const Scalar& reorderSeed
             const Scalar& reorderSeed
         ) const;
         ) const;
-        std::vector<std::vector<Curvepoint>> generate_commitment_matrix(
+        std::vector<std::vector<Twistpoint>> generate_commitment_matrix(
             const std::vector<std::vector<Scalar>>& permutations,
             const std::vector<std::vector<Scalar>>& permutations,
             std::vector<std::vector<Scalar>>& seeds
             std::vector<std::vector<Scalar>>& seeds
         ) const;
         ) 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 std::vector<std::vector<Scalar>>& permutations,
             const Scalar& power,
             const Scalar& power,
             std::vector<std::vector<Scalar>>& seeds,
             std::vector<std::vector<Scalar>>& seeds,
-            std::vector<std::vector<Curvepoint>>& seedCommits
+            std::vector<std::vector<Twistpoint>>& seedCommits
         ) const;
         ) 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,
             const std::vector<std::vector<Scalar>>& permutations,
             std::vector<std::vector<Scalar>>& seeds
             std::vector<std::vector<Scalar>>& seeds
         ) const;
         ) 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<Scalar>>& permutations,
-            const std::vector<std::vector<CurveBipoint>>& currVoteMatrix,
+            const std::vector<std::vector<TwistBipoint>>& currVoteMatrix,
             std::vector<std::vector<std::vector<Scalar>>>& seeds,
             std::vector<std::vector<std::vector<Scalar>>>& seeds,
             bool inverted
             bool inverted
         ) const;
         ) 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;
         ) const;
 
 
         void generate_vote_tensor_proofs(
         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>>& permutations,
             const std::vector<std::vector<Scalar>>& permutationSeeds,
             const std::vector<std::vector<Scalar>>& permutationSeeds,
             const std::vector<std::vector<std::vector<Scalar>>>& matrixSeeds,
             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
             bool inverted
         ) const;
         ) const;
         bool verify_vote_tensor_proofs(
         bool verify_vote_tensor_proofs(
             const std::vector<std::vector<Proof>>& pi,
             const std::vector<std::vector<Proof>>& pi,
             size_t start_offset,
             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
             bool inverted
         ) const;
         ) const;
 
 
         void generate_user_tally_matrix(
         void generate_user_tally_matrix(
             const std::vector<std::vector<Scalar>>& permutations,
             const std::vector<std::vector<Scalar>>& permutations,
             const Scalar& power,
             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<Scalar>>& userTallySeeds,
-            std::vector<std::vector<Curvepoint>>& userTallySeedCommits
+            std::vector<std::vector<Twistpoint>>& userTallySeedCommits
         ) const;
         ) const;
 
 
         template <typename T>
         template <typename T>
@@ -227,7 +227,7 @@ class PrsonaServer : public PrsonaBase {
             const Scalar& power,
             const Scalar& power,
             const std::vector<T>& oldValues,
             const std::vector<T>& oldValues,
             std::vector<std::vector<Scalar>>& seeds,
             std::vector<std::vector<Scalar>>& seeds,
-            std::vector<std::vector<Curvepoint>>& seedCommits,
+            std::vector<std::vector<Twistpoint>>& seedCommits,
             const T& h
             const T& h
         ) const;
         ) const;
 
 
@@ -246,12 +246,12 @@ class PrsonaServer : public PrsonaBase {
         ) const;
         ) const;
 
 
         std::vector<size_t> sort_data(
         std::vector<size_t> sort_data(
-            const std::vector<Curvepoint>& inputs
+            const std::vector<Twistpoint>& inputs
         ) const;
         ) const;
 
 
         // A helper class for "ordering" data and for binary search
         // A helper class for "ordering" data and for binary search
         struct SortingType {
         struct SortingType {
-            Curvepoint pseudonym;
+            Twistpoint pseudonym;
             size_t index;
             size_t index;
 
 
             bool operator<( const SortingType& rhs ) const
             bool operator<( const SortingType& rhs ) const
@@ -267,36 +267,36 @@ class PrsonaServer : public PrsonaBase {
         ) const;
         ) const;
 
 
         bool update_data(
         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(
         bool pseudonyms_sorted(
-            const std::vector<Curvepoint> newPseudonyms
+            const std::vector<Twistpoint> newPseudonyms
         ) const;
         ) const;
 
 
         // DATA MAINTENANCE
         // DATA MAINTENANCE
         bool import_new_user_update(
         bool import_new_user_update(
             const std::vector<Proof>& pi,
             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<EGCiphertext>& otherCurrentUserEncryptedTallies,
-            const std::vector<std::vector<CurveBipoint>>& otherVoteMatrix);
+            const std::vector<std::vector<TwistBipoint>>& otherVoteMatrix);
 
 
         // DATA SAFEKEEPING
         // DATA SAFEKEEPING
         std::vector<size_t> order_data();
         std::vector<size_t> order_data();
         
         
         // BINARY SEARCH
         // BINARY SEARCH
-        size_t binary_search(const Curvepoint& index) const;
+        size_t binary_search(const Twistpoint& index) const;
 
 
         // VALID VOTE PROOFS
         // VALID VOTE PROOFS
         bool verify_vote_proof(
         bool verify_vote_proof(
             const std::vector<Proof>& pi,
             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;
         ) const;
 }; 
 }; 
 
 

+ 37 - 37
prsona/inc/serverEntity.hpp

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

+ 1 - 1
prsona/src/EGCiphertext.cpp

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

+ 151 - 151
prsona/src/base.cpp

@@ -4,13 +4,13 @@
 #include "base.hpp"
 #include "base.hpp"
 
 
 extern const scalar_t bn_n;
 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,
 /* These lines need to be here so these static variables are defined,
  * but in C++ putting code here doesn't actually execute
  * 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)
  * (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. */
  * 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::SCALAR_N = Scalar();
 Scalar PrsonaBase::DEFAULT_TALLY = Scalar();
 Scalar PrsonaBase::DEFAULT_TALLY = Scalar();
 Scalar PrsonaBase::DEFAULT_VOTE = 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
 // Must be called once before any usage of this class
 void PrsonaBase::init()
 void PrsonaBase::init()
 {
 {
-    EL_GAMAL_GENERATOR = Curvepoint(bn_curvegen);
+    EL_GAMAL_GENERATOR = Twistpoint(bn_twistgen);
     SCALAR_N = Scalar(bn_n);
     SCALAR_N = Scalar(bn_n);
     DEFAULT_TALLY = Scalar(1);
     DEFAULT_TALLY = Scalar(1);
     DEFAULT_VOTE = Scalar(1);
     DEFAULT_VOTE = Scalar(1);
@@ -75,12 +75,12 @@ size_t PrsonaBase::get_max_allowed_vote()
     return MAX_ALLOWED_VOTE;
     return MAX_ALLOWED_VOTE;
 }
 }
 
 
-Curvepoint PrsonaBase::get_blinding_generator() const
+Twistpoint PrsonaBase::get_blinding_generator() const
 {
 {
     return elGamalBlindGenerator;
     return elGamalBlindGenerator;
 }
 }
 
 
-Curvepoint PrsonaBase::get_blinding_generator(std::vector<Proof>& pi) const
+Twistpoint PrsonaBase::get_blinding_generator(std::vector<Proof>& pi) const
 {
 {
     pi = elGamalBlindGeneratorProof;
     pi = elGamalBlindGeneratorProof;
 
 
@@ -97,7 +97,7 @@ Curvepoint PrsonaBase::get_blinding_generator(std::vector<Proof>& pi) const
 
 
 bool PrsonaBase::set_EG_blind_generator(
 bool PrsonaBase::set_EG_blind_generator(
     const std::vector<Proof>& pi,
     const std::vector<Proof>& pi,
-    const Curvepoint& currGenerator,
+    const Twistpoint& currGenerator,
     size_t numServers)
     size_t numServers)
 {
 {
     if (!verify_generator_proof(pi, currGenerator, 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>?
  * There might be a standard function for this in <algorithms>?
  * But it returns an iterator, not a size_t, so less useful. */
  * But it returns an iterator, not a size_t, so less useful. */
 size_t PrsonaBase::binary_search(
 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;
     size_t lo, hi;
     lo = 0;
     lo = 0;
@@ -142,8 +142,8 @@ size_t PrsonaBase::binary_search(
  */
  */
 
 
 Proof PrsonaBase::schnorr_generation(
 Proof PrsonaBase::schnorr_generation(
-    const Curvepoint& generator,
-    const Curvepoint& commitment,
+    const Twistpoint& generator,
+    const Twistpoint& commitment,
     const Scalar& log) const
     const Scalar& log) const
 {
 {
     Proof retval;
     Proof retval;
@@ -153,7 +153,7 @@ Proof PrsonaBase::schnorr_generation(
     Scalar u;
     Scalar u;
     u.set_random();
     u.set_random();
     
     
-    Curvepoint U = generator * u;
+    Twistpoint U = generator * u;
     oracleInput << generator << commitment << U;
     oracleInput << generator << commitment << U;
 
 
     Scalar x = oracle(oracleInput.str());
     Scalar x = oracle(oracleInput.str());
@@ -166,12 +166,12 @@ Proof PrsonaBase::schnorr_generation(
 }
 }
 
 
 bool PrsonaBase::schnorr_verification(
 bool PrsonaBase::schnorr_verification(
-    const Curvepoint& generator,
-    const Curvepoint& commitment,
+    const Twistpoint& generator,
+    const Twistpoint& commitment,
     const Scalar& x,
     const Scalar& x,
     const Scalar& z) const
     const Scalar& z) const
 {
 {
-    Curvepoint U = generator * z - commitment * x;
+    Twistpoint U = generator * z - commitment * x;
 
 
     std::stringstream oracleInput;
     std::stringstream oracleInput;
     oracleInput << generator << commitment << U;
     oracleInput << generator << commitment << U;
@@ -185,8 +185,8 @@ bool PrsonaBase::schnorr_verification(
 
 
 // Prove ownership of the short term public key
 // Prove ownership of the short term public key
 Proof PrsonaBase::generate_ownership_proof(
 Proof PrsonaBase::generate_ownership_proof(
-    const Curvepoint& generator,
-    const Curvepoint& commitment,
+    const Twistpoint& generator,
+    const Twistpoint& commitment,
     const Scalar& log) const
     const Scalar& log) const
 {
 {
     if (!CLIENT_IS_MALICIOUS)
     if (!CLIENT_IS_MALICIOUS)
@@ -202,8 +202,8 @@ Proof PrsonaBase::generate_ownership_proof(
 
 
 bool PrsonaBase::verify_ownership_proof(
 bool PrsonaBase::verify_ownership_proof(
     const Proof& pi,
     const Proof& pi,
-    const Curvepoint& generator,
-    const Curvepoint& commitment) const
+    const Twistpoint& generator,
+    const Twistpoint& commitment) const
 {
 {
     if (!CLIENT_IS_MALICIOUS)
     if (!CLIENT_IS_MALICIOUS)
         return pi.hbc == "PROOF";
         return pi.hbc == "PROOF";
@@ -219,7 +219,7 @@ bool PrsonaBase::verify_ownership_proof(
  */
  */
 
 
 Proof PrsonaBase::add_to_generator_proof(
 Proof PrsonaBase::add_to_generator_proof(
-    const Curvepoint& currGenerator, 
+    const Twistpoint& currGenerator, 
     const Scalar& seed) const
     const Scalar& seed) const
 {
 {
     Proof retval;
     Proof retval;
@@ -229,7 +229,7 @@ Proof PrsonaBase::add_to_generator_proof(
         return retval;
         return retval;
     }
     }
 
 
-    Curvepoint nextGenerator = currGenerator * seed;
+    Twistpoint nextGenerator = currGenerator * seed;
     retval = schnorr_generation(currGenerator, nextGenerator, seed);
     retval = schnorr_generation(currGenerator, nextGenerator, seed);
 
 
     retval.curvepointUniversals.push_back(currGenerator);
     retval.curvepointUniversals.push_back(currGenerator);
@@ -238,7 +238,7 @@ Proof PrsonaBase::add_to_generator_proof(
 
 
 bool PrsonaBase::verify_generator_proof(
 bool PrsonaBase::verify_generator_proof(
     const std::vector<Proof>& pi,
     const std::vector<Proof>& pi,
-    const Curvepoint& currGenerator,
+    const Twistpoint& currGenerator,
     size_t numServers) const
     size_t numServers) const
 {
 {
     if (pi.size() != numServers || numServers == 0)
     if (pi.size() != numServers || numServers == 0)
@@ -259,8 +259,8 @@ bool PrsonaBase::verify_generator_proof(
 
 
     for (size_t i = 0; i < pi.size(); i++)
     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 :
                                     currGenerator :
                                     pi[i + 1].curvepointUniversals[0]);
                                     pi[i + 1].curvepointUniversals[0]);
         Scalar c = pi[i].challengeParts[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++)
     for (size_t i = 0; i < proofBits; i++)
     {
     {
         Proof currProof;
         Proof currProof;
-        Curvepoint g, h, C, C_a, C_b;
+        Twistpoint g, h, C, C_a, C_b;
         g = commitment.mask;
         g = commitment.mask;
         h = elGamalBlindGenerator;
         h = elGamalBlindGenerator;
     
     
@@ -375,8 +375,8 @@ std::vector<Proof> PrsonaBase::generate_reputation_proof(
 // A pretty straightforward range proof (verification)
 // A pretty straightforward range proof (verification)
 bool PrsonaBase::verify_reputation_proof(
 bool PrsonaBase::verify_reputation_proof(
     const std::vector<Proof>& pi,
     const std::vector<Proof>& pi,
-    const Curvepoint& generator,
-    const Curvepoint& owner,
+    const Twistpoint& generator,
+    const Twistpoint& owner,
     const EGCiphertext& commitment,
     const EGCiphertext& commitment,
     const Scalar& threshold) const
     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
     // X is the thing we're going to be checking in on throughout
     // to try to get our score commitment back in the end.
     // to try to get our score commitment back in the end.
-    Curvepoint X;
+    Twistpoint X;
     for (size_t i = 1; i < pi.size(); i++)
     for (size_t i = 1; i < pi.size(); i++)
     {
     {
-        Curvepoint C, g, h;
+        Twistpoint C, g, h;
         C = pi[i].curvepointUniversals[0];
         C = pi[i].curvepointUniversals[0];
         g = commitment.mask;
         g = commitment.mask;
         h = elGamalBlindGenerator;
         h = elGamalBlindGenerator;
@@ -428,7 +428,7 @@ bool PrsonaBase::verify_reputation_proof(
         z_b = pi[i].responseParts[2];
         z_b = pi[i].responseParts[2];
 
 
         // Taken from Fig. 1 in https://eprint.iacr.org/2014/764.pdf
         // 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_a = g * z_a + h * f - C * x;
         C_b = g * z_b - C * (x - f);
         C_b = g * z_b - C * (x - f);
 
 
@@ -442,7 +442,7 @@ bool PrsonaBase::verify_reputation_proof(
         }
         }
     }
     }
 
 
-    Curvepoint scoreCommitment =
+    Twistpoint scoreCommitment =
         commitment.encryptedMessage +
         commitment.encryptedMessage +
         elGamalBlindGenerator * -threshold;
         elGamalBlindGenerator * -threshold;
     
     
@@ -455,11 +455,11 @@ bool PrsonaBase::verify_reputation_proof(
 
 
 std::vector<Proof> PrsonaBase::generate_vote_proof(
 std::vector<Proof> PrsonaBase::generate_vote_proof(
     const Proof& ownershipProof,
     const Proof& ownershipProof,
-    const CurveBipoint& g,
-    const CurveBipoint& h,
+    const TwistBipoint& g,
+    const TwistBipoint& h,
     const std::vector<bool>& replaces,
     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>& seeds,
     const std::vector<Scalar>& votes) const
     const std::vector<Scalar>& votes) const
 {
 {
@@ -504,17 +504,17 @@ std::vector<Proof> PrsonaBase::generate_vote_proof(
             t_1.set_random();
             t_1.set_random();
             t_2.set_random();
             t_2.set_random();
 
 
-            CurveBipoint U = h * z_r +
+            TwistBipoint U = h * z_r +
                                 oldEncryptedVotes[i] * x_r -
                                 oldEncryptedVotes[i] * x_r -
                                 newEncryptedVotes[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);
             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);
             currProof.curveBipointUniversals.push_back(C_b);
 
 
-            CurveBipoint C_c = g * (a * a * m) +
+            TwistBipoint C_c = g * (a * a * m) +
                                 h * t_2;
                                 h * t_2;
 
 
             oracleInput << U << C_a << C_b << C_c;
             oracleInput << U << C_a << C_b << C_c;
@@ -550,16 +550,16 @@ std::vector<Proof> PrsonaBase::generate_vote_proof(
             z_nb.set_random();
             z_nb.set_random();
             f.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 -
                 h * z_na -
                 newEncryptedVotes[i] * x_n;
                 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);
             currProof.curveBipointUniversals.push_back(C_b);
 
 
-            CurveBipoint C_c =
+            TwistBipoint C_c =
                 h * z_nb -
                 h * z_nb -
                 newEncryptedVotes[i] * ((f - x_n) * (x_n + x_n - f)) -
                 newEncryptedVotes[i] * ((f - x_n) * (x_n + x_n - f)) -
                 C_b * x_n;
                 C_b * x_n;
@@ -585,13 +585,13 @@ std::vector<Proof> PrsonaBase::generate_vote_proof(
 }
 }
 
 
 bool PrsonaBase::verify_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<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
     // Reject outright if there's no proof to check
     if (pi.empty())
     if (pi.empty())
@@ -621,7 +621,7 @@ bool PrsonaBase::verify_vote_proof(
     for (size_t i = 1; i < pi.size(); i++)
     for (size_t i = 1; i < pi.size(); i++)
     {
     {
         size_t voteIndex = i - 1;
         size_t voteIndex = i - 1;
-        CurveBipoint C_b;
+        TwistBipoint C_b;
         C_b = pi[i].curveBipointUniversals[0];
         C_b = pi[i].curveBipointUniversals[0];
 
 
         Scalar x_r, x_n, z_r, f, z_na, z_nb;
         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_na = pi[i].responseParts[2];
         z_nb = pi[i].responseParts[3];
         z_nb = pi[i].responseParts[3];
 
 
-        CurveBipoint U, C_a, C_c;
+        TwistBipoint U, C_a, C_c;
         U = h * z_r +
         U = h * z_r +
             oldEncryptedVotes[voteIndex] * x_r -
             oldEncryptedVotes[voteIndex] * x_r -
             newEncryptedVotes[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(
 bool PrsonaBase::verify_proof_of_added_user(
     const std::vector<Proof>& pi,
     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,
     size_t selfIndex,
     const EGCiphertext& userEncryptedScore,
     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())
     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++)
     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];
         currSeed = pi[2].responseParts[i];
 
 
         if (i == selfIndex)
         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++)
     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];
         currSeed = pi[3].responseParts[i];
 
 
         if (i != selfIndex)
         if (i != selfIndex)
@@ -790,7 +790,7 @@ bool PrsonaBase::verify_proof_of_added_user(
 std::vector<Proof> PrsonaBase::generate_valid_permutation_proof(
 std::vector<Proof> PrsonaBase::generate_valid_permutation_proof(
     const std::vector<std::vector<Scalar>>& permutations,
     const std::vector<std::vector<Scalar>>& permutations,
     const std::vector<std::vector<Scalar>>& seeds,
     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;
     std::vector<Proof> retval;
 
 
@@ -800,7 +800,7 @@ std::vector<Proof> PrsonaBase::generate_valid_permutation_proof(
         return retval;
         return retval;
     }
     }
 
 
-    Curvepoint g, h;
+    Twistpoint g, h;
     g = EL_GAMAL_GENERATOR;
     g = EL_GAMAL_GENERATOR;
     h = elGamalBlindGenerator;
     h = elGamalBlindGenerator;
 
 
@@ -834,7 +834,7 @@ std::vector<Proof> PrsonaBase::generate_valid_permutation_proof(
     {
     {
         for (size_t j = 0; j < permutations[i].size(); j++)
         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;
             Scalar p, r;
             a[i][j].set_random();
             a[i][j].set_random();
@@ -880,7 +880,7 @@ std::vector<Proof> PrsonaBase::generate_valid_permutation_proof(
 
 
 bool PrsonaBase::verify_valid_permutation_proof(
 bool PrsonaBase::verify_valid_permutation_proof(
     const std::vector<Proof>& pi,
     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
    // Reject outright if there's no proof to check
     if (pi.empty())
     if (pi.empty())
@@ -892,7 +892,7 @@ bool PrsonaBase::verify_valid_permutation_proof(
     if (!SERVER_IS_MALICIOUS)
     if (!SERVER_IS_MALICIOUS)
         return pi[0].hbc == "PROOF";
         return pi[0].hbc == "PROOF";
 
 
-    Curvepoint g, h;
+    Twistpoint g, h;
     g = EL_GAMAL_GENERATOR;
     g = EL_GAMAL_GENERATOR;
     h = elGamalBlindGenerator;
     h = elGamalBlindGenerator;
 
 
@@ -911,7 +911,7 @@ bool PrsonaBase::verify_valid_permutation_proof(
         {
         {
             size_t piIndex = i * commits.size() + j + 1;
             size_t piIndex = i * commits.size() + j + 1;
 
 
-            Curvepoint C, C_a, C_b;
+            Twistpoint C, C_a, C_b;
 
 
             C = commits[i][j];
             C = commits[i][j];
 
 
@@ -936,7 +936,7 @@ bool PrsonaBase::verify_valid_permutation_proof(
 
 
     for (size_t i = 0; i < commits.size(); i++)
     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++)
         for (size_t j = 1; j < commits[i].size(); j++)
             sum = sum + commits[i][j];
             sum = sum + commits[i][j];
@@ -956,10 +956,10 @@ std::vector<Proof> PrsonaBase::generate_proof_of_reordering_plus_power(
     const Scalar& power,
     const Scalar& power,
     const std::vector<std::vector<Scalar>>& permutationSeeds,
     const std::vector<std::vector<Scalar>>& permutationSeeds,
     const std::vector<std::vector<Scalar>>& productSeeds,
     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;
     std::vector<Proof> retval;
 
 
@@ -972,8 +972,8 @@ std::vector<Proof> PrsonaBase::generate_proof_of_reordering_plus_power(
     Proof first;
     Proof first;
     retval.push_back(first);
     retval.push_back(first);
     
     
-    Curvepoint g = EL_GAMAL_GENERATOR;
-    Curvepoint h = elGamalBlindGenerator;
+    Twistpoint g = EL_GAMAL_GENERATOR;
+    Twistpoint h = elGamalBlindGenerator;
 
 
     std::stringstream oracleInput;
     std::stringstream oracleInput;
     oracleInput << g << h;
     oracleInput << g << h;
@@ -1013,7 +1013,7 @@ std::vector<Proof> PrsonaBase::generate_proof_of_reordering_plus_power(
             Scalar currt1;
             Scalar currt1;
             Scalar currt2;
             Scalar currt2;
 
 
-            Curvepoint U1, U2, U3, U4;
+            Twistpoint U1, U2, U3, U4;
 
 
             currb2.set_random();
             currb2.set_random();
             currt1.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(
 bool PrsonaBase::verify_proof_of_reordering_plus_power(
     const std::vector<Proof>& pi,
     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())
     if (pi.empty())
         return false;
         return false;
@@ -1079,8 +1079,8 @@ bool PrsonaBase::verify_proof_of_reordering_plus_power(
     if (!SERVER_IS_MALICIOUS)
     if (!SERVER_IS_MALICIOUS)
         return pi[0].hbc == "PROOF";
         return pi[0].hbc == "PROOF";
     
     
-    Curvepoint g = EL_GAMAL_GENERATOR;
-    Curvepoint h = elGamalBlindGenerator;
+    Twistpoint g = EL_GAMAL_GENERATOR;
+    Twistpoint h = elGamalBlindGenerator;
 
 
     std::stringstream oracleInput;
     std::stringstream oracleInput;
     oracleInput << g << h;
     oracleInput << g << h;
@@ -1109,7 +1109,7 @@ bool PrsonaBase::verify_proof_of_reordering_plus_power(
         {
         {
             size_t piIndex = i * permutationCommits.size() + j + 1;
             size_t piIndex = i * permutationCommits.size() + j + 1;
 
 
-            Curvepoint U1, U2, U3, U4;
+            Twistpoint U1, U2, U3, U4;
             U2 = pi[piIndex].curvepointUniversals[0];
             U2 = pi[piIndex].curvepointUniversals[0];
 
 
             Scalar f2 = pi[piIndex].responseParts[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++)
     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++)
         for (size_t j = 1; j < seedCommits[i].size(); j++)
             sum = sum + seedCommits[i][j];
             sum = sum + seedCommits[i][j];
 
 
-        if (sum != Curvepoint())
+        if (sum != Twistpoint())
         {
         {
             std::cerr << "seed commits did not sum to 0, aborting." << std::endl;
             std::cerr << "seed commits did not sum to 0, aborting." << std::endl;
             return false;
             return false;
@@ -1155,16 +1155,16 @@ bool PrsonaBase::verify_proof_of_reordering_plus_power(
 std::vector<Proof> PrsonaBase::generate_user_tally_proofs(
 std::vector<Proof> PrsonaBase::generate_user_tally_proofs(
     const std::vector<std::vector<Scalar>>& permutations,
     const std::vector<std::vector<Scalar>>& permutations,
     const Scalar& power,
     const Scalar& power,
-    const Curvepoint& nextGenerator,
+    const Twistpoint& nextGenerator,
     const std::vector<std::vector<Scalar>>& permutationSeeds,
     const std::vector<std::vector<Scalar>>& permutationSeeds,
     const std::vector<std::vector<Scalar>>& userTallySeeds,
     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;
     std::vector<Proof> retval;
 
 
@@ -1177,8 +1177,8 @@ std::vector<Proof> PrsonaBase::generate_user_tally_proofs(
     Proof first;
     Proof first;
     retval.push_back(first);
     retval.push_back(first);
     
     
-    Curvepoint g = EL_GAMAL_GENERATOR;
-    Curvepoint h = elGamalBlindGenerator;
+    Twistpoint g = EL_GAMAL_GENERATOR;
+    Twistpoint h = elGamalBlindGenerator;
 
 
     std::stringstream oracleInput;
     std::stringstream oracleInput;
     oracleInput << g << h << nextGenerator;
     oracleInput << g << h << nextGenerator;
@@ -1228,7 +1228,7 @@ std::vector<Proof> PrsonaBase::generate_user_tally_proofs(
             Scalar currt1;
             Scalar currt1;
             Scalar currt2;
             Scalar currt2;
 
 
-            Curvepoint U1, U2, U3, U4, U5, U6, U7;
+            Twistpoint U1, U2, U3, U4, U5, U6, U7;
 
 
             currb2.set_random();
             currb2.set_random();
             currt1.set_random();
             currt1.set_random();
@@ -1300,14 +1300,14 @@ std::vector<Proof> PrsonaBase::generate_user_tally_proofs(
 
 
 bool PrsonaBase::verify_user_tally_proofs(
 bool PrsonaBase::verify_user_tally_proofs(
     const std::vector<Proof>& pi,
     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())
     if (pi.empty())
         return false;
         return false;
@@ -1315,8 +1315,8 @@ bool PrsonaBase::verify_user_tally_proofs(
     if (!SERVER_IS_MALICIOUS)
     if (!SERVER_IS_MALICIOUS)
         return pi[0].hbc == "PROOF";
         return pi[0].hbc == "PROOF";
     
     
-    Curvepoint g = EL_GAMAL_GENERATOR;
-    Curvepoint h = elGamalBlindGenerator;
+    Twistpoint g = EL_GAMAL_GENERATOR;
+    Twistpoint h = elGamalBlindGenerator;
 
 
     std::stringstream oracleInput;
     std::stringstream oracleInput;
     oracleInput << g << h << nextGenerator;
     oracleInput << g << h << nextGenerator;
@@ -1355,7 +1355,7 @@ bool PrsonaBase::verify_user_tally_proofs(
         {
         {
             size_t piIndex = i * permutationCommits.size() + j + 1;
             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];
             U2 = pi[piIndex].curvepointUniversals[0];
             U3 = pi[piIndex].curvepointUniversals[1];
             U3 = pi[piIndex].curvepointUniversals[1];
             U5 = pi[piIndex].curvepointUniversals[2];
             U5 = pi[piIndex].curvepointUniversals[2];
@@ -1393,12 +1393,12 @@ bool PrsonaBase::verify_user_tally_proofs(
 
 
     for (size_t i = 0; i < userTallySeedCommits.size(); i++)
     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++)
         for (size_t j = 1; j < userTallySeedCommits[i].size(); j++)
             sum = sum + userTallySeedCommits[i][j];
             sum = sum + userTallySeedCommits[i][j];
 
 
-        if (sum != Curvepoint())
+        if (sum != Twistpoint())
         {
         {
             std::cerr << "seed commits did not sum to 0, aborting." << std::endl;
             std::cerr << "seed commits did not sum to 0, aborting." << std::endl;
             return false;
             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>>& permutationSeeds,
     const std::vector<std::vector<Scalar>>& productSeeds,
     const std::vector<std::vector<Scalar>>& productSeeds,
     const std::vector<T>& oldValues,
     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 std::vector<std::vector<T>>& productCommits,
     const T& otherG,
     const T& otherG,
     const T& otherH) const
     const T& otherH) const
@@ -1430,8 +1430,8 @@ std::vector<Proof> PrsonaBase::generate_proof_of_reordering(
     Proof first;
     Proof first;
     retval.push_back(first);
     retval.push_back(first);
 
 
-    Curvepoint g = EL_GAMAL_GENERATOR;
-    Curvepoint h = elGamalBlindGenerator;
+    Twistpoint g = EL_GAMAL_GENERATOR;
+    Twistpoint h = elGamalBlindGenerator;
 
 
     std::stringstream oracleInput;
     std::stringstream oracleInput;
     oracleInput << g << h << otherG << otherH;
     oracleInput << g << h << otherG << otherH;
@@ -1465,7 +1465,7 @@ std::vector<Proof> PrsonaBase::generate_proof_of_reordering(
             Scalar currt1;
             Scalar currt1;
             Scalar currt2;
             Scalar currt2;
 
 
-            Curvepoint U1;
+            Twistpoint U1;
             T U2;
             T U2;
 
 
             curra.set_random();
             curra.set_random();
@@ -1519,7 +1519,7 @@ template <typename T>
 bool PrsonaBase::verify_proof_of_reordering(
 bool PrsonaBase::verify_proof_of_reordering(
     const std::vector<Proof>& pi,
     const std::vector<Proof>& pi,
     const std::vector<T>& oldValues,
     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 std::vector<std::vector<T>>& productCommits,
     const T& otherG,
     const T& otherG,
     const T& otherH) const
     const T& otherH) const
@@ -1530,8 +1530,8 @@ bool PrsonaBase::verify_proof_of_reordering(
     if (!SERVER_IS_MALICIOUS)
     if (!SERVER_IS_MALICIOUS)
         return pi[0].hbc == "PROOF";
         return pi[0].hbc == "PROOF";
 
 
-    Curvepoint g = EL_GAMAL_GENERATOR;
-    Curvepoint h = elGamalBlindGenerator;
+    Twistpoint g = EL_GAMAL_GENERATOR;
+    Twistpoint h = elGamalBlindGenerator;
 
 
     std::stringstream oracleInput;
     std::stringstream oracleInput;
     oracleInput << g << h << otherG << otherH;
     oracleInput << g << h << otherG << otherH;
@@ -1555,7 +1555,7 @@ bool PrsonaBase::verify_proof_of_reordering(
         {
         {
             size_t piIndex = i * permutationCommits.size() + j + 1;
             size_t piIndex = i * permutationCommits.size() + j + 1;
 
 
-            Curvepoint U1;
+            Twistpoint U1;
             T U2;
             T U2;
 
 
             Scalar f = pi[piIndex].responseParts[0];
             Scalar f = pi[piIndex].responseParts[0];
@@ -1590,7 +1590,7 @@ bool PrsonaBase::verify_proof_of_reordering(
  */
  */
 
 
 Proof PrsonaBase::generate_valid_vote_row_proof(
 Proof PrsonaBase::generate_valid_vote_row_proof(
-    const std::vector<CurveBipoint>& commitment) const
+    const std::vector<TwistBipoint>& commitment) const
 {
 {
     Proof retval;
     Proof retval;
 
 
@@ -1611,7 +1611,7 @@ Proof PrsonaBase::generate_valid_vote_row_proof(
 }
 }
 
 
 Proof PrsonaBase::generate_valid_vote_matrix_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;
     Proof retval;
 
 
@@ -1653,7 +1653,7 @@ Proof PrsonaBase::generate_valid_user_tally_proof(
 }
 }
 
 
 Proof PrsonaBase::generate_valid_server_tally_proof(
 Proof PrsonaBase::generate_valid_server_tally_proof(
-    const TwistBipoint& commitment) const
+    const CurveBipoint& commitment) const
 {
 {
     Proof retval;
     Proof retval;
 
 
@@ -1673,7 +1673,7 @@ Proof PrsonaBase::generate_valid_server_tally_proof(
 }
 }
 
 
 Proof PrsonaBase::generate_valid_pseudonyms_proof(
 Proof PrsonaBase::generate_valid_pseudonyms_proof(
-    const std::vector<Curvepoint>& commitment) const
+    const std::vector<Twistpoint>& commitment) const
 {
 {
     Proof retval;
     Proof retval;
 
 
@@ -1695,7 +1695,7 @@ Proof PrsonaBase::generate_valid_pseudonyms_proof(
 
 
 bool PrsonaBase::verify_valid_vote_row_proof(
 bool PrsonaBase::verify_valid_vote_row_proof(
     const std::vector<Proof>& pi,
     const std::vector<Proof>& pi,
-    const std::vector<CurveBipoint>& commitment) const
+    const std::vector<TwistBipoint>& commitment) const
 {
 {
     if (pi.empty())
     if (pi.empty())
         return false;
         return false;
@@ -1725,7 +1725,7 @@ bool PrsonaBase::verify_valid_vote_row_proof(
 
 
 bool PrsonaBase::verify_valid_vote_matrix_proof(
 bool PrsonaBase::verify_valid_vote_matrix_proof(
     const std::vector<Proof>& pi,
     const std::vector<Proof>& pi,
-    const std::vector<std::vector<CurveBipoint>>& commitment) const
+    const std::vector<std::vector<TwistBipoint>>& commitment) const
 {
 {
     if (pi.empty())
     if (pi.empty())
         return false;
         return false;
@@ -1785,7 +1785,7 @@ bool PrsonaBase::verify_valid_user_tally_proof(
 
 
 bool PrsonaBase::verify_valid_server_tally_proof(
 bool PrsonaBase::verify_valid_server_tally_proof(
     const std::vector<Proof>& pi,
     const std::vector<Proof>& pi,
-    const TwistBipoint& commitment) const
+    const CurveBipoint& commitment) const
 {
 {
     if (pi.empty())
     if (pi.empty())
         return false;
         return false;
@@ -1814,7 +1814,7 @@ bool PrsonaBase::verify_valid_server_tally_proof(
 
 
 bool PrsonaBase::verify_valid_pseudonyms_proof(
 bool PrsonaBase::verify_valid_pseudonyms_proof(
     const std::vector<Proof>& pi,
     const std::vector<Proof>& pi,
-    const std::vector<Curvepoint>& commitment) const
+    const std::vector<Twistpoint>& commitment) const
 {
 {
     if (pi.empty())
     if (pi.empty())
         return false;
         return false;
@@ -1842,56 +1842,56 @@ bool PrsonaBase::verify_valid_pseudonyms_proof(
     return agreement * 2 > pi.size();
     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>>& permutations,
     const std::vector<std::vector<Scalar>>& permutationSeeds,
     const std::vector<std::vector<Scalar>>& permutationSeeds,
     const std::vector<std::vector<Scalar>>& productSeeds,
     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>(
 template std::vector<Proof> PrsonaBase::generate_proof_of_reordering<TwistBipoint>(
     const std::vector<std::vector<Scalar>>& permutations,
     const std::vector<std::vector<Scalar>>& permutations,
     const std::vector<std::vector<Scalar>>& permutationSeeds,
     const std::vector<std::vector<Scalar>>& permutationSeeds,
     const std::vector<std::vector<Scalar>>& productSeeds,
     const std::vector<std::vector<Scalar>>& productSeeds,
     const std::vector<TwistBipoint>& oldValues,
     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 std::vector<std::vector<TwistBipoint>>& productCommits,
     const TwistBipoint& otherG,
     const TwistBipoint& otherG,
     const TwistBipoint& otherH) const;
     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<CurveBipoint>& oldValues,
-    const std::vector<std::vector<Curvepoint>>& permutationCommits,
+    const std::vector<std::vector<Twistpoint>>& permutationCommits,
     const std::vector<std::vector<CurveBipoint>>& productCommits,
     const std::vector<std::vector<CurveBipoint>>& productCommits,
     const CurveBipoint& otherG,
     const CurveBipoint& otherG,
     const CurveBipoint& otherH) const;
     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>(
 template bool PrsonaBase::verify_proof_of_reordering<TwistBipoint>(
     const std::vector<Proof>& pi,
     const std::vector<Proof>& pi,
     const std::vector<TwistBipoint>& oldValues,
     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 std::vector<std::vector<TwistBipoint>>& productCommits,
     const TwistBipoint& otherG,
     const TwistBipoint& otherG,
     const TwistBipoint& otherH) const;
     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(
 PrsonaClient::PrsonaClient(
     const std::vector<Proof>& generatorProof,
     const std::vector<Proof>& generatorProof,
-    const Curvepoint& elGamalBlindGenerator,
+    const Twistpoint& elGamalBlindGenerator,
     const BGNPublicKey& serverPublicKey,
     const BGNPublicKey& serverPublicKey,
     size_t numServers)
     size_t numServers)
     : serverPublicKey(serverPublicKey),
     : serverPublicKey(serverPublicKey),
@@ -32,12 +32,12 @@ PrsonaClient::PrsonaClient(
  * BASIC PUBLIC SYSTEM INFO GETTERS
  * BASIC PUBLIC SYSTEM INFO GETTERS
  */
  */
 
 
-Curvepoint PrsonaClient::get_short_term_public_key() const
+Twistpoint PrsonaClient::get_short_term_public_key() const
 {
 {
     return currentFreshGenerator * longTermPrivateKey;
     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();
     pi = generate_ownership_proof();
     return currentFreshGenerator * longTermPrivateKey;
     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, 
  * You may really want to make currentEncryptedVotes a member variable, 
  * but it doesn't behave correctly when adding new clients after this one. */
  * 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,
     std::vector<Proof>& validVoteProof,
     const std::vector<Proof>& serverProof,
     const std::vector<Proof>& serverProof,
-    const std::vector<CurveBipoint>& oldEncryptedVotes,
+    const std::vector<TwistBipoint>& oldEncryptedVotes,
     const std::vector<Scalar>& votes,
     const std::vector<Scalar>& votes,
     const std::vector<bool>& replaces) const
     const std::vector<bool>& replaces) const
 {
 {
@@ -66,14 +66,14 @@ std::vector<CurveBipoint> PrsonaClient::make_votes(
     }
     }
 
 
     std::vector<Scalar> seeds(oldEncryptedVotes.size());
     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++)
     for (size_t i = 0; i < votes.size(); i++)
     {
     {
         if (replaces[i])
         if (replaces[i])
         {
         {
             newEncryptedVotes[i] =
             newEncryptedVotes[i] =
-                serverPublicKey.curveEncrypt(seeds[i], votes[i]);
+                serverPublicKey.twistEncrypt(seeds[i], votes[i]);
         }
         }
         else
         else
         {
         {
@@ -90,7 +90,7 @@ std::vector<CurveBipoint> PrsonaClient::make_votes(
 // Get a new fresh generator (happens at initialization and during each epoch)
 // Get a new fresh generator (happens at initialization and during each epoch)
 bool PrsonaClient::receive_fresh_generator(
 bool PrsonaClient::receive_fresh_generator(
     const std::vector<Proof>& pi,
     const std::vector<Proof>& pi,
-    const Curvepoint& freshGenerator)
+    const Twistpoint& freshGenerator)
 {
 {
     if (!verify_generator_proof(pi, freshGenerator, numServers))
     if (!verify_generator_proof(pi, freshGenerator, numServers))
     {
     {
@@ -121,15 +121,15 @@ bool PrsonaClient::receive_vote_tally(
 bool PrsonaClient::receive_new_user_data(
 bool PrsonaClient::receive_new_user_data(
     const std::vector<Proof>& mainProof,
     const std::vector<Proof>& mainProof,
     const std::vector<Proof>& serverEncryptedScoreProof,
     const std::vector<Proof>& serverEncryptedScoreProof,
-    const TwistBipoint& serverEncryptedScore,
+    const CurveBipoint& serverEncryptedScore,
     const std::vector<Proof>& userEncryptedScoreProof,
     const std::vector<Proof>& userEncryptedScoreProof,
     const EGCiphertext& userEncryptedScore,
     const EGCiphertext& userEncryptedScore,
     const std::vector<Proof>& voteMatrixProof,
     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<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))
     if (!verify_valid_server_tally_proof(serverEncryptedScoreProof, serverEncryptedScore))
     {
     {
@@ -166,10 +166,10 @@ bool PrsonaClient::receive_new_user_data(
         mainProof,
         mainProof,
         currentFreshGenerator,
         currentFreshGenerator,
         shortTermPublicKey,
         shortTermPublicKey,
-        serverPublicKey.get_bipoint_curvegen(),
-        serverPublicKey.get_bipoint_curve_subgroup_gen(),
         serverPublicKey.get_bipoint_twistgen(),
         serverPublicKey.get_bipoint_twistgen(),
         serverPublicKey.get_bipoint_twist_subgroup_gen(),
         serverPublicKey.get_bipoint_twist_subgroup_gen(),
+        serverPublicKey.get_bipoint_curvegen(),
+        serverPublicKey.get_bipoint_curve_subgroup_gen(),
         selfIndex,
         selfIndex,
         userEncryptedScore,
         userEncryptedScore,
         serverEncryptedScore,
         serverEncryptedScore,
@@ -209,7 +209,7 @@ std::vector<Proof> PrsonaClient::generate_reputation_proof(
 
 
 bool PrsonaClient::verify_reputation_proof(
 bool PrsonaClient::verify_reputation_proof(
     const std::vector<Proof>& pi,
     const std::vector<Proof>& pi,
-    const Curvepoint& shortTermPublicKey,
+    const Twistpoint& shortTermPublicKey,
     const Scalar& threshold,
     const Scalar& threshold,
     const std::vector<Proof>& encryptedScoreProof,
     const std::vector<Proof>& encryptedScoreProof,
     const EGCiphertext& encryptedScore) const
     const EGCiphertext& encryptedScore) const
@@ -240,7 +240,7 @@ Scalar PrsonaClient::get_score() const
 // Basic memoized score decryption
 // Basic memoized score decryption
 Scalar PrsonaClient::decrypt_score(const EGCiphertext& score)
 Scalar PrsonaClient::decrypt_score(const EGCiphertext& score)
 {
 {
-    Curvepoint s, hashedDecrypted;
+    Twistpoint s, hashedDecrypted;
 
 
     // Remove the mask portion of the ciphertext
     // Remove the mask portion of the ciphertext
     s = score.mask * inversePrivateKey;
     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)
     // If not, iterate until we find it (adding everything to the memoization)
     max_checked++;
     max_checked++;
-    Curvepoint decryptionCandidate = elGamalBlindGenerator * max_checked;
+    Twistpoint decryptionCandidate = elGamalBlindGenerator * max_checked;
     while (decryptionCandidate != hashedDecrypted)
     while (decryptionCandidate != hashedDecrypted)
     {
     {
         decryption_memoizer[decryptionCandidate] = max_checked;
         decryption_memoizer[decryptionCandidate] = max_checked;
@@ -274,7 +274,7 @@ Scalar PrsonaClient::decrypt_score(const EGCiphertext& score)
 // Prove ownership of the short term public key
 // Prove ownership of the short term public key
 Proof PrsonaClient::generate_ownership_proof() const
 Proof PrsonaClient::generate_ownership_proof() const
 {
 {
-    Curvepoint shortTermPublicKey = currentFreshGenerator * longTermPrivateKey;
+    Twistpoint shortTermPublicKey = currentFreshGenerator * longTermPrivateKey;
 
 
     return PrsonaBase::generate_ownership_proof(
     return PrsonaBase::generate_ownership_proof(
         currentFreshGenerator, shortTermPublicKey, longTermPrivateKey);
         currentFreshGenerator, shortTermPublicKey, longTermPrivateKey);
@@ -286,8 +286,8 @@ Proof PrsonaClient::generate_ownership_proof() const
 
 
 std::vector<Proof> PrsonaClient::generate_vote_proof(
 std::vector<Proof> PrsonaClient::generate_vote_proof(
     const std::vector<bool>& replaces,
     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>& seeds,
     const std::vector<Scalar>& votes) const
     const std::vector<Scalar>& votes) const
 {
 {
@@ -295,8 +295,8 @@ std::vector<Proof> PrsonaClient::generate_vote_proof(
 
 
     return PrsonaBase::generate_vote_proof(
     return PrsonaBase::generate_vote_proof(
         pi,
         pi,
-        serverPublicKey.get_bipoint_curvegen(),
-        serverPublicKey.get_bipoint_curve_subgroup_gen(),
+        serverPublicKey.get_bipoint_twistgen(),
+        serverPublicKey.get_bipoint_twist_subgroup_gen(),
         replaces,
         replaces,
         oldEncryptedVotes,
         oldEncryptedVotes,
         newEncryptedVotes,
         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
 // Time how long it takes to make a proof of valid votes
 vector<double> make_votes(
 vector<double> make_votes(
     default_random_engine& generator,
     default_random_engine& generator,
-    vector<vector<CurveBipoint>>& newEncryptedVotes,
+    vector<vector<TwistBipoint>>& newEncryptedVotes,
     vector<vector<Proof>>& validVoteProofs,
     vector<vector<Proof>>& validVoteProofs,
     const vector<PrsonaClient>& users,
     const vector<PrsonaClient>& users,
     const PrsonaServerEntity& servers,
     const PrsonaServerEntity& servers,
@@ -64,9 +64,9 @@ vector<double> make_votes(
         
         
         Proof baseProof;
         Proof baseProof;
         vector<Proof> fullProof;
         vector<Proof> fullProof;
-        Curvepoint shortTermPublicKey =
+        Twistpoint shortTermPublicKey =
             users[i].get_short_term_public_key();
             users[i].get_short_term_public_key();
-        vector<CurveBipoint> currEncryptedVotes =
+        vector<TwistBipoint> currEncryptedVotes =
             servers.get_current_votes_by(baseProof, shortTermPublicKey);
             servers.get_current_votes_by(baseProof, shortTermPublicKey);
         fullProof.push_back(baseProof);
         fullProof.push_back(baseProof);
         servers.get_other_vote_row_commitments(fullProof, shortTermPublicKey);
         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
 // Time how long it takes to validate a proof of valid votes
 vector<double> transmit_votes_to_servers(
 vector<double> transmit_votes_to_servers(
-    const vector<vector<CurveBipoint>>& newEncryptedVotes,
+    const vector<vector<TwistBipoint>>& newEncryptedVotes,
     const vector<vector<Proof>>& validVoteProofs,
     const vector<vector<Proof>>& validVoteProofs,
     const vector<PrsonaClient>& users,
     const vector<PrsonaClient>& users,
     PrsonaServerEntity& servers)
     PrsonaServerEntity& servers)
@@ -108,7 +108,7 @@ vector<double> transmit_votes_to_servers(
     for (size_t i = 0; i < numUsers; i++)
     for (size_t i = 0; i < numUsers; i++)
     {
     {
         Proof ownerProof;
         Proof ownerProof;
-        Curvepoint shortTermPublicKey =
+        Twistpoint shortTermPublicKey =
             users[i].get_short_term_public_key(ownerProof);
             users[i].get_short_term_public_key(ownerProof);
 
 
         for (size_t j = 0; j < numServers; j++)
         for (size_t j = 0; j < numServers; j++)
@@ -189,7 +189,7 @@ void test_reputation_proof(
     Scalar goodThreshold(thresholdDistribution(generator));
     Scalar goodThreshold(thresholdDistribution(generator));
     Scalar badThreshold(aScore + 1);
     Scalar badThreshold(aScore + 1);
 
 
-    Curvepoint shortTermPublicKey = a.get_short_term_public_key();
+    Twistpoint shortTermPublicKey = a.get_short_term_public_key();
     vector<Proof> goodRepProof =
     vector<Proof> goodRepProof =
         a.generate_reputation_proof(goodThreshold, servers.get_num_clients());
         a.generate_reputation_proof(goodThreshold, servers.get_num_clients());
 
 
@@ -252,9 +252,9 @@ void test_vote_proof(
 
 
     Proof baseProof;
     Proof baseProof;
     vector<Proof> fullProof;
     vector<Proof> fullProof;
-    Curvepoint shortTermPublicKey =
+    Twistpoint shortTermPublicKey =
         user.get_short_term_public_key();
         user.get_short_term_public_key();
-    vector<CurveBipoint> encryptedVotes =
+    vector<TwistBipoint> encryptedVotes =
         servers.get_current_votes_by(baseProof, shortTermPublicKey);
         servers.get_current_votes_by(baseProof, shortTermPublicKey);
     fullProof.push_back(baseProof);
     fullProof.push_back(baseProof);
     servers.get_other_vote_row_commitments(fullProof, shortTermPublicKey);
     servers.get_other_vote_row_commitments(fullProof, shortTermPublicKey);
@@ -333,7 +333,7 @@ void check_vote_matrix_updates()
     PrsonaServerEntity servers(numServers);
     PrsonaServerEntity servers(numServers);
     vector<Proof> elGamalBlindGeneratorProof;
     vector<Proof> elGamalBlindGeneratorProof;
     BGNPublicKey bgnPublicKey = servers.get_bgn_public_key();
     BGNPublicKey bgnPublicKey = servers.get_bgn_public_key();
-    Curvepoint elGamalBlindGenerator =
+    Twistpoint elGamalBlindGenerator =
         servers.get_blinding_generator(elGamalBlindGeneratorProof);
         servers.get_blinding_generator(elGamalBlindGeneratorProof);
 
 
     vector<PrsonaClient> users;
     vector<PrsonaClient> users;
@@ -349,14 +349,14 @@ void check_vote_matrix_updates()
     }
     }
 
 
     Proof pseudonymsProof;
     Proof pseudonymsProof;
-    vector<Curvepoint> currentPseudonyms =
+    vector<Twistpoint> currentPseudonyms =
         servers.get_current_pseudonyms(pseudonymsProof);
         servers.get_current_pseudonyms(pseudonymsProof);
 
 
     cout << "Making votes." << endl;
     cout << "Making votes." << endl;
 
 
     for (size_t i = 0; i < numUsers; i++)
     for (size_t i = 0; i < numUsers; i++)
     {   
     {   
-        Curvepoint shortTermPublicKey =
+        Twistpoint shortTermPublicKey =
             users[i].get_short_term_public_key();
             users[i].get_short_term_public_key();
 
 
         size_t myIndex =
         size_t myIndex =
@@ -379,7 +379,7 @@ void check_vote_matrix_updates()
 
 
         Proof baseProof;
         Proof baseProof;
         vector<Proof> fullProof;
         vector<Proof> fullProof;
-        vector<CurveBipoint> currEncryptedVotes =
+        vector<TwistBipoint> currEncryptedVotes =
             servers.get_current_votes_by(baseProof, shortTermPublicKey);
             servers.get_current_votes_by(baseProof, shortTermPublicKey);
         fullProof.push_back(baseProof);
         fullProof.push_back(baseProof);
         servers.get_other_vote_row_commitments(fullProof, shortTermPublicKey);
         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++)
     for (size_t i = 0; i < numUsers; i++)
     {   
     {   
         Proof ownerProof;
         Proof ownerProof;
-        Curvepoint shortTermPublicKey =
+        Twistpoint shortTermPublicKey =
             users[i].get_short_term_public_key(ownerProof);
             users[i].get_short_term_public_key(ownerProof);
 
 
         cout << "User " << i+1 << " now has the following votes:" << endl;
         cout << "User " << i+1 << " now has the following votes:" << endl;
@@ -478,7 +478,7 @@ int main(int argc, char *argv[])
     PrsonaServerEntity servers(numServers);
     PrsonaServerEntity servers(numServers);
     vector<Proof> elGamalBlindGeneratorProof;
     vector<Proof> elGamalBlindGeneratorProof;
     BGNPublicKey bgnPublicKey = servers.get_bgn_public_key();
     BGNPublicKey bgnPublicKey = servers.get_bgn_public_key();
-    Curvepoint elGamalBlindGenerator =
+    Twistpoint elGamalBlindGenerator =
         servers.get_blinding_generator(elGamalBlindGeneratorProof);
         servers.get_blinding_generator(elGamalBlindGeneratorProof);
 
 
     cout << "Initialization: adding users to system" << endl << endl;
     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;
         cout << "Round " << i+1 << " of " << numRounds << ": " << endl;
         
         
-        vector<vector<CurveBipoint>> newEncryptedVotes;
+        vector<vector<TwistBipoint>> newEncryptedVotes;
         vector<vector<Proof>> validVoteProofs;
         vector<vector<Proof>> validVoteProofs;
         timings = make_votes(
         timings = make_votes(
             generator,
             generator,

+ 1 - 1
prsona/src/networkClient.cpp

@@ -2,7 +2,7 @@
 
 
 PrsonaNetworkClient::PrsonaNetworkClient(
 PrsonaNetworkClient::PrsonaNetworkClient(
     const std::vector<Proof>& generatorProof,
     const std::vector<Proof>& generatorProof,
-    const Curvepoint& elGamalBlindGenerator,
+    const Twistpoint& elGamalBlindGenerator,
     const BGNPublicKey& serverPublicKey,
     const BGNPublicKey& serverPublicKey,
     size_t numServers)
     size_t numServers)
 : PrsonaClient(generatorProof, elGamalBlindGenerator, serverPublicKey, 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;
     is >> numElements;
     for (size_t i = 0; i < numElements; i++)
     for (size_t i = 0; i < numElements; i++)
     {
     {
-        Curvepoint x;
+        Twistpoint x;
         is >> x;
         is >> x;
         input.curvepointUniversals.push_back(x);
         input.curvepointUniversals.push_back(x);
     }
     }
@@ -117,7 +117,7 @@ std::istream& operator>>(std::istream& is, Proof& input)
     is >> numElements;
     is >> numElements;
     for (size_t i = 0; i < numElements; i++)
     for (size_t i = 0; i < numElements; i++)
     {
     {
-        CurveBipoint x;
+        TwistBipoint x;
         is >> x;
         is >> x;
         input.curveBipointUniversals.push_back(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,
 // 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).
 // 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,
     std::vector<Proof>& pi,
-    const Curvepoint& currGenerator) const
+    const Twistpoint& currGenerator) const
 {
 {
     pi.push_back(add_to_generator_proof(currGenerator, currentSeed));
     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,
 // 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).
 // 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,
     std::vector<Proof>& pi,
-    const Curvepoint& currGenerator) const
+    const Twistpoint& currGenerator) const
 {
 {
     pi.push_back(add_to_generator_proof(currGenerator, nextSeed));
     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).
  * (who is identified by their short term public key).
  * In practice, this is intended for clients,
  * In practice, this is intended for clients,
  * who need to know their current votes in order to rerandomize them. */
  * 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);
     size_t voteSubmitter = binary_search(shortTermPublicKey);
     retval = voteMatrix[voteSubmitter];
     retval = voteMatrix[voteSubmitter];
 
 
@@ -88,7 +88,7 @@ std::vector<CurveBipoint> PrsonaServer::get_current_votes_by(
     return retval;
     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
     Proof& pi) const
 {
 {
     pi = generate_valid_vote_matrix_proof(voteMatrix);
     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
  * In practice, this is intended for clients, so that the servers vouch
  * for their ciphertexts being valid as part of their reputation proofs. */
  * for their ciphertexts being valid as part of their reputation proofs. */
 EGCiphertext PrsonaServer::get_current_user_encrypted_tally(
 EGCiphertext PrsonaServer::get_current_user_encrypted_tally(
-    Proof& pi, const Curvepoint& shortTermPublicKey) const
+    Proof& pi, const Twistpoint& shortTermPublicKey) const
 {
 {
     EGCiphertext retval;
     EGCiphertext retval;
     size_t tallyOwner = binary_search(shortTermPublicKey);
     size_t tallyOwner = binary_search(shortTermPublicKey);
@@ -110,10 +110,10 @@ EGCiphertext PrsonaServer::get_current_user_encrypted_tally(
     return retval;
     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);
     size_t tallyOwner = binary_search(shortTermPublicKey);
     retval = previousVoteTallies[tallyOwner];
     retval = previousVoteTallies[tallyOwner];
     
     
@@ -121,7 +121,7 @@ TwistBipoint PrsonaServer::get_current_server_encrypted_tally(
     return retval;
     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);
     pi = generate_valid_pseudonyms_proof(currentPseudonyms);
     return currentPseudonyms;
     return currentPseudonyms;
@@ -131,7 +131,7 @@ std::vector<Curvepoint> PrsonaServer::get_current_pseudonyms(Proof& pi) const
  * PROOF COMMITMENT GETTERS
  * 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);
     size_t requestID = binary_search(request);
     return generate_valid_vote_row_proof(voteMatrix[requestID]);
     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);
     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);
     size_t requestID = binary_search(request);
     return generate_valid_user_tally_proof(currentUserEncryptedTallies[requestID]);
     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);
     size_t requestID = binary_search(request);
     return generate_valid_server_tally_proof(previousVoteTallies[requestID]);
     return generate_valid_server_tally_proof(previousVoteTallies[requestID]);
@@ -169,7 +169,7 @@ Proof PrsonaServer::get_pseudonyms_commitment() const
 void PrsonaServer::add_new_client(
 void PrsonaServer::add_new_client(
     std::vector<Proof>& proofOfValidAddition,
     std::vector<Proof>& proofOfValidAddition,
     const Proof& proofOfValidKey,
     const Proof& proofOfValidKey,
-    const Curvepoint& shortTermPublicKey)
+    const Twistpoint& shortTermPublicKey)
 {
 {
     if (!verify_ownership_proof(
     if (!verify_ownership_proof(
             proofOfValidKey, currentFreshGenerator, shortTermPublicKey))
             proofOfValidKey, currentFreshGenerator, shortTermPublicKey))
@@ -183,8 +183,8 @@ void PrsonaServer::add_new_client(
     // The first epoch's score for a new user will be low,
     // The first epoch's score for a new user will be low,
     // but will typically converge on an average score quickly
     // but will typically converge on an average score quickly
     Scalar tallySeed;
     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);
     previousVoteTallies.push_back(encryptedDefaultTally);
 
 
     Scalar seedForUserTally;
     Scalar seedForUserTally;
@@ -197,14 +197,14 @@ void PrsonaServer::add_new_client(
     currentUserEncryptedTallies.push_back(newUserEncryptedTally);
     currentUserEncryptedTallies.push_back(newUserEncryptedTally);
 
 
     // Users are defaulted to casting a neutral vote for others.
     // Users are defaulted to casting a neutral vote for others.
-    CurveBipoint encryptedDefaultVote, encryptedSelfVote;
+    TwistBipoint encryptedDefaultVote, encryptedSelfVote;
     Scalar currDefaultSeed, currSelfSeed;
     Scalar currDefaultSeed, currSelfSeed;
     encryptedDefaultVote = 
     encryptedDefaultVote = 
-        bgnSystem.get_public_key().curveEncrypt(currDefaultSeed, DEFAULT_VOTE);
+        bgnSystem.get_public_key().twistEncrypt(currDefaultSeed, DEFAULT_VOTE);
     encryptedSelfVote =
     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> userVoteSeeds;
     std::vector<Scalar> otherVoteSeeds;
     std::vector<Scalar> otherVoteSeeds;
     for (size_t i = 0; i < voteMatrix.size(); i++)
     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).
 // Receive a new vote row from a user (identified by short term public key).
 bool PrsonaServer::receive_vote(
 bool PrsonaServer::receive_vote(
     const std::vector<Proof>& pi,
     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);
     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))
     if (!verify_vote_proof(pi, oldVotes, newVotes, shortTermPublicKey))
         return false;
         return false;
@@ -286,7 +286,7 @@ const BGN& PrsonaServer::get_bgn_details() const
 
 
 bool PrsonaServer::initialize_fresh_generator(
 bool PrsonaServer::initialize_fresh_generator(
     const std::vector<Proof>& pi,
     const std::vector<Proof>& pi,
-    const Curvepoint& firstGenerator)
+    const Twistpoint& firstGenerator)
 {
 {
     if (!verify_generator_proof(pi, firstGenerator, numServers))
     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,
 // 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).
 // 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,
     std::vector<Proof>& pi,
-    const Curvepoint& currGenerator) const
+    const Twistpoint& currGenerator) const
 {
 {
     Scalar lambda;
     Scalar lambda;
     lambda.set_random();
     lambda.set_random();
@@ -314,7 +314,7 @@ Curvepoint PrsonaServer::add_rand_seed_to_generator(
 
 
 bool PrsonaServer::set_EG_blind_generator(
 bool PrsonaServer::set_EG_blind_generator(
     const std::vector<Proof>& pi,
     const std::vector<Proof>& pi,
-    const Curvepoint& currGenerator)
+    const Twistpoint& currGenerator)
 {
 {
     return PrsonaBase::set_EG_blind_generator(pi, currGenerator, numServers);
     return PrsonaBase::set_EG_blind_generator(pi, currGenerator, numServers);
 }
 }
@@ -341,7 +341,7 @@ std::vector<Scalar> PrsonaServer::tally_scores()
         {
         {
             Quadripoint curr =
             Quadripoint curr =
                 bgnSystem.homomorphic_multiplication_no_rerandomize(
                 bgnSystem.homomorphic_multiplication_no_rerandomize(
-                    voteMatrix[j][i], previousVoteTallies[j]);
+                    previousVoteTallies[j], voteMatrix[j][i]);
 
 
             weightedVotes.push_back(curr);
             weightedVotes.push_back(curr);
         }
         }
@@ -370,7 +370,7 @@ std::vector<Scalar> PrsonaServer::tally_scores()
 Scalar PrsonaServer::get_max_possible_score()
 Scalar PrsonaServer::get_max_possible_score()
 {
 {
     // FOLDL
     // FOLDL
-    TwistBipoint currEncryptedVal = previousVoteTallies[0];
+    CurveBipoint currEncryptedVal = previousVoteTallies[0];
     for (size_t i = 1; i < previousVoteTallies.size(); i++)
     for (size_t i = 1; i < previousVoteTallies.size(); i++)
     {
     {
         currEncryptedVal =
         currEncryptedVal =
@@ -391,25 +391,25 @@ Scalar PrsonaServer::get_max_possible_score()
 // The first round, going from A_0 to A_0.5
 // The first round, going from A_0 to A_0.5
 void PrsonaServer::build_up_midway_pseudonyms(
 void PrsonaServer::build_up_midway_pseudonyms(
     std::vector<std::vector<std::vector<Proof>>>& pi,
     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();
     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(
     pi.push_back(epoch_calculations(
         currPermutationCommits,
         currPermutationCommits,
         currFreshPseudonymCommits,
         currFreshPseudonymCommits,
@@ -443,16 +443,16 @@ void PrsonaServer::build_up_midway_pseudonyms(
 void PrsonaServer::break_down_midway_pseudonyms(
 void PrsonaServer::break_down_midway_pseudonyms(
     std::vector<Proof>& generatorProof,
     std::vector<Proof>& generatorProof,
     std::vector<std::vector<std::vector<Proof>>>& pi,
     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))
     if (!initialize_fresh_generator(generatorProof, nextGenerator))
     {
     {
@@ -462,15 +462,15 @@ void PrsonaServer::break_down_midway_pseudonyms(
 
 
     Scalar inverseSeed = currentSeed.curveMultInverse();
     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(
     pi.push_back(epoch_calculations(
         currPermutationCommits,
         currPermutationCommits,
         currFreshPseudonymCommits,
         currFreshPseudonymCommits,
@@ -503,17 +503,17 @@ void PrsonaServer::break_down_midway_pseudonyms(
  */
  */
 
 
 std::vector<std::vector<Proof>> PrsonaServer::epoch_calculations(
 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 Scalar& power,
-    const Curvepoint& nextGenerator,
+    const Twistpoint& nextGenerator,
     bool doUserTallies)
     bool doUserTallies)
 {
 {
     std::vector<std::vector<Proof>> retval;
     std::vector<std::vector<Proof>> retval;
@@ -558,15 +558,15 @@ std::vector<std::vector<Proof>> PrsonaServer::epoch_calculations(
             serverTallySeeds);
             serverTallySeeds);
 
 
     retval.push_back(
     retval.push_back(
-        generate_proof_of_reordering<TwistBipoint>(
+        generate_proof_of_reordering<CurveBipoint>(
             permutations,
             permutations,
             permutationSeeds,
             permutationSeeds,
             serverTallySeeds,
             serverTallySeeds,
             previousVoteTallies,
             previousVoteTallies,
             permutationCommits,
             permutationCommits,
             serverTallyCommits,
             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>>> partwayVoteMatrixSeeds;
     std::vector<std::vector<std::vector<Scalar>>> finalVoteMatrixSeeds;
     std::vector<std::vector<std::vector<Scalar>>> finalVoteMatrixSeeds;
@@ -577,7 +577,7 @@ std::vector<std::vector<Proof>> PrsonaServer::epoch_calculations(
         partwayVoteMatrixSeeds,
         partwayVoteMatrixSeeds,
         false);
         false);
 
 
-    std::vector<std::vector<CurveBipoint>> partialVoteMatrix = 
+    std::vector<std::vector<TwistBipoint>> partialVoteMatrix = 
         calculate_next_vote_matrix(partwayVoteMatrixCommits);
         calculate_next_vote_matrix(partwayVoteMatrixCommits);
 
 
     finalVoteMatrixCommits.clear();
     finalVoteMatrixCommits.clear();
@@ -609,8 +609,8 @@ std::vector<std::vector<Proof>> PrsonaServer::epoch_calculations(
 
 
     if (doUserTallies)
     if (doUserTallies)
     {
     {
-        std::vector<Curvepoint> userTallyMasks;
-        std::vector<Curvepoint> userTallyMessages;
+        std::vector<Twistpoint> userTallyMasks;
+        std::vector<Twistpoint> userTallyMessages;
         std::vector<std::vector<Scalar>> userTallySeeds;
         std::vector<std::vector<Scalar>> userTallySeeds;
         userTallyMaskCommits.clear();
         userTallyMaskCommits.clear();
         userTallyMessageCommits.clear();
         userTallyMessageCommits.clear();
@@ -656,16 +656,16 @@ std::vector<std::vector<Proof>> PrsonaServer::epoch_calculations(
 
 
 bool PrsonaServer::accept_epoch_updates(
 bool PrsonaServer::accept_epoch_updates(
     const std::vector<std::vector<Proof>>& pi,
     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 doUserTallies)
 {
 {
     bool verification;
     bool verification;
@@ -705,13 +705,13 @@ bool PrsonaServer::accept_epoch_updates(
     }
     }
 
 
     verification = 
     verification = 
-        verify_proof_of_reordering<TwistBipoint>(
+        verify_proof_of_reordering<CurveBipoint>(
             pi[currOffset],
             pi[currOffset],
             previousVoteTallies,
             previousVoteTallies,
             permutationCommits,
             permutationCommits,
             serverTallyCommits,
             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++;
     currOffset++;
     if (!verification)
     if (!verification)
     {
     {
@@ -733,7 +733,7 @@ bool PrsonaServer::accept_epoch_updates(
         return false;
         return false;
     }
     }
 
 
-    std::vector<std::vector<CurveBipoint>> partialVoteMatrix =
+    std::vector<std::vector<TwistBipoint>> partialVoteMatrix =
         calculate_next_vote_matrix(partwayVoteMatrixCommits);
         calculate_next_vote_matrix(partwayVoteMatrixCommits);
     verification = verify_vote_tensor_proofs(
     verification = verify_vote_tensor_proofs(
         pi,
         pi,
@@ -751,8 +751,8 @@ bool PrsonaServer::accept_epoch_updates(
 
 
     if (doUserTallies)
     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++)
         for (size_t i = 0; i < currentUserEncryptedTallies.size(); i++)
         {
         {
             userTallyMasks.push_back(currentUserEncryptedTallies[i].mask);
             userTallyMasks.push_back(currentUserEncryptedTallies[i].mask);
@@ -800,7 +800,7 @@ std::vector<std::vector<Scalar>> PrsonaServer::generate_permutation_matrix(
         retval.push_back(currRow);
         retval.push_back(currRow);
     }
     }
 
 
-    std::vector<Curvepoint> nextPseudonyms;
+    std::vector<Twistpoint> nextPseudonyms;
     for (size_t i = 0; i < currentPseudonyms.size(); i++)
     for (size_t i = 0; i < currentPseudonyms.size(); i++)
         nextPseudonyms.push_back(currentPseudonyms[i] * reorderSeed);
         nextPseudonyms.push_back(currentPseudonyms[i] * reorderSeed);
 
 
@@ -820,13 +820,13 @@ std::vector<std::vector<Scalar>> PrsonaServer::generate_permutation_matrix(
     return retval;
     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,
     const std::vector<std::vector<Scalar>>& permutations,
     std::vector<std::vector<Scalar>>& seeds) const
     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();
     seeds.clear();
     for (size_t i = 0; i < permutations.size(); i++)
     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++)
     for (size_t i = 0; i < permutations.size(); i++)
     {
     {
-        std::vector<Curvepoint> currRow;
+        std::vector<Twistpoint> currRow;
 
 
         size_t last = permutations[i].size() - 1;
         size_t last = permutations[i].size() - 1;
         for (size_t j = 0; j < permutations[i].size(); j++)
         for (size_t j = 0; j < permutations[i].size(); j++)
         {
         {
-            Curvepoint element;
+            Twistpoint element;
 
 
             if (j != last)
             if (j != last)
             {
             {
@@ -864,13 +864,13 @@ std::vector<std::vector<Curvepoint>> PrsonaServer::generate_commitment_matrix(
     return retval;
     return retval;
 }
 }
 
 
-std::vector<std::vector<Curvepoint>> PrsonaServer::generate_pseudonym_matrix(
+std::vector<std::vector<Twistpoint>> PrsonaServer::generate_pseudonym_matrix(
     const std::vector<std::vector<Scalar>>& permutations,
     const std::vector<std::vector<Scalar>>& permutations,
     const Scalar& power,
     const Scalar& power,
     std::vector<std::vector<Scalar>>& seeds,
     std::vector<std::vector<Scalar>>& seeds,
-    std::vector<std::vector<Curvepoint>>& seedCommits) const
+    std::vector<std::vector<Twistpoint>>& seedCommits) const
 {
 {
-    return generate_reordered_plus_power_matrix<Curvepoint>(
+    return generate_reordered_plus_power_matrix<Twistpoint>(
         permutations,
         permutations,
         power,
         power,
         currentPseudonyms,
         currentPseudonyms,
@@ -879,31 +879,31 @@ std::vector<std::vector<Curvepoint>> PrsonaServer::generate_pseudonym_matrix(
         elGamalBlindGenerator);
         elGamalBlindGenerator);
 }
 }
 
 
-std::vector<std::vector<TwistBipoint>> PrsonaServer::generate_server_tally_matrix(
+std::vector<std::vector<CurveBipoint>> PrsonaServer::generate_server_tally_matrix(
     const std::vector<std::vector<Scalar>>& permutations,
     const std::vector<std::vector<Scalar>>& permutations,
     std::vector<std::vector<Scalar>>& seeds) const
     std::vector<std::vector<Scalar>>& seeds) const
 {
 {
-    return generate_reordered_matrix<TwistBipoint>(
+    return generate_reordered_matrix<CurveBipoint>(
         permutations,
         permutations,
         previousVoteTallies,
         previousVoteTallies,
         seeds,
         seeds,
-        bgnSystem.get_public_key().get_bipoint_twist_subgroup_gen(),
+        bgnSystem.get_public_key().get_bipoint_curve_subgroup_gen(),
         false);
         false);
 }
 }
 
 
-std::vector<std::vector<std::vector<CurveBipoint>>> PrsonaServer::generate_vote_tensor(
+std::vector<std::vector<std::vector<TwistBipoint>>> PrsonaServer::generate_vote_tensor(
     const std::vector<std::vector<Scalar>>& permutations,
     const std::vector<std::vector<Scalar>>& permutations,
-    const std::vector<std::vector<CurveBipoint>>& currVoteMatrix,
+    const std::vector<std::vector<TwistBipoint>>& currVoteMatrix,
     std::vector<std::vector<std::vector<Scalar>>>& seeds,
     std::vector<std::vector<std::vector<Scalar>>>& seeds,
     bool inverted) const
     bool inverted) const
 {
 {
-    std::vector<std::vector<std::vector<CurveBipoint>>> retval;
+    std::vector<std::vector<std::vector<TwistBipoint>>> retval;
 
 
     for (size_t i = 0; i < currVoteMatrix.size(); i++)
     for (size_t i = 0; i < currVoteMatrix.size(); i++)
     {
     {
         std::vector<std::vector<Scalar>> currSeeds;
         std::vector<std::vector<Scalar>> currSeeds;
 
 
-        std::vector<CurveBipoint> inputRow;
+        std::vector<TwistBipoint> inputRow;
         if (inverted)
         if (inverted)
         {
         {
             for (size_t j = 0; j < currVoteMatrix.size(); j++)
             for (size_t j = 0; j < currVoteMatrix.size(); j++)
@@ -914,11 +914,11 @@ std::vector<std::vector<std::vector<CurveBipoint>>> PrsonaServer::generate_vote_
             inputRow = currVoteMatrix[i];
             inputRow = currVoteMatrix[i];
         }
         }
         
         
-        retval.push_back(generate_reordered_matrix<CurveBipoint>(
+        retval.push_back(generate_reordered_matrix<TwistBipoint>(
             permutations,
             permutations,
             inputRow,
             inputRow,
             currSeeds,
             currSeeds,
-            bgnSystem.get_public_key().get_bipoint_curve_subgroup_gen(),
+            bgnSystem.get_public_key().get_bipoint_twist_subgroup_gen(),
             false));
             false));
 
 
         seeds.push_back(currSeeds);
         seeds.push_back(currSeeds);
@@ -927,17 +927,17 @@ std::vector<std::vector<std::vector<CurveBipoint>>> PrsonaServer::generate_vote_
     return retval;
     return retval;
 }
 }
 
 
-std::vector<std::vector<CurveBipoint>> PrsonaServer::calculate_next_vote_matrix(
-    const std::vector<std::vector<std::vector<CurveBipoint>>>& voteTensor) const
+std::vector<std::vector<TwistBipoint>> PrsonaServer::calculate_next_vote_matrix(
+    const std::vector<std::vector<std::vector<TwistBipoint>>>& voteTensor) const
 {
 {
-    std::vector<std::vector<CurveBipoint>> retval;
+    std::vector<std::vector<TwistBipoint>> retval;
 
 
     for (size_t i = 0; i < voteTensor.size(); i++)
     for (size_t i = 0; i < voteTensor.size(); i++)
     {
     {
-        std::vector<CurveBipoint> currRow;
+        std::vector<TwistBipoint> currRow;
         for (size_t j = 0; j < voteTensor[i].size(); j++)
         for (size_t j = 0; j < voteTensor[i].size(); j++)
         {
         {
-            CurveBipoint sum = voteTensor[i][j][0];
+            TwistBipoint sum = voteTensor[i][j][0];
             
             
             for (size_t k = 1; k < voteTensor[i][j].size(); k++)
             for (size_t k = 1; k < voteTensor[i][j].size(); k++)
                 sum = sum + voteTensor[i][j][k];
                 sum = sum + voteTensor[i][j][k];
@@ -955,14 +955,14 @@ void PrsonaServer::generate_vote_tensor_proofs(
     const std::vector<std::vector<Scalar>>& permutations,
     const std::vector<std::vector<Scalar>>& permutations,
     const std::vector<std::vector<Scalar>>& permutationSeeds,
     const std::vector<std::vector<Scalar>>& permutationSeeds,
     const std::vector<std::vector<std::vector<Scalar>>>& matrixSeeds,
     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 inverted) const
 {
 {
     for (size_t i = 0; i < currMatrix.size(); i++)
     for (size_t i = 0; i < currMatrix.size(); i++)
     {
     {
-        std::vector<CurveBipoint> inputRow;
+        std::vector<TwistBipoint> inputRow;
         if (inverted)
         if (inverted)
         {
         {
             for (size_t j = 0; j < currMatrix.size(); j++)
             for (size_t j = 0; j < currMatrix.size(); j++)
@@ -973,31 +973,31 @@ void PrsonaServer::generate_vote_tensor_proofs(
             inputRow = currMatrix[i];
             inputRow = currMatrix[i];
         }
         }
         
         
-        pi.push_back(generate_proof_of_reordering<CurveBipoint>(
+        pi.push_back(generate_proof_of_reordering<TwistBipoint>(
             permutations,
             permutations,
             permutationSeeds,
             permutationSeeds,
             matrixSeeds[i],
             matrixSeeds[i],
             inputRow,
             inputRow,
             permutationCommits,
             permutationCommits,
             matrixCommits[i],
             matrixCommits[i],
-            bgnSystem.get_public_key().get_bipoint_curvegen(),
-            bgnSystem.get_public_key().get_bipoint_curve_subgroup_gen()));
+            bgnSystem.get_public_key().get_bipoint_twistgen(),
+            bgnSystem.get_public_key().get_bipoint_twist_subgroup_gen()));
     }
     }
 }
 }
 
 
 bool PrsonaServer::verify_vote_tensor_proofs(
 bool PrsonaServer::verify_vote_tensor_proofs(
     const std::vector<std::vector<Proof>>& pi,
     const std::vector<std::vector<Proof>>& pi,
     size_t start_offset,
     size_t start_offset,
-    const std::vector<std::vector<CurveBipoint>>& currMatrix,
-    const std::vector<std::vector<Curvepoint>>& permutationCommits,
-    const std::vector<std::vector<std::vector<CurveBipoint>>>& matrixCommits,
+    const std::vector<std::vector<TwistBipoint>>& currMatrix,
+    const std::vector<std::vector<Twistpoint>>& permutationCommits,
+    const std::vector<std::vector<std::vector<TwistBipoint>>>& matrixCommits,
     bool inverted) const
     bool inverted) const
 {
 {
     bool retval = true;
     bool retval = true;
 
 
     for (size_t i = 0; i < currMatrix.size(); i++)
     for (size_t i = 0; i < currMatrix.size(); i++)
     {
     {
-        std::vector<CurveBipoint> inputRow;
+        std::vector<TwistBipoint> inputRow;
         if (inverted)
         if (inverted)
         {
         {
             for (size_t j = 0; j < currMatrix.size(); j++)
             for (size_t j = 0; j < currMatrix.size(); j++)
@@ -1009,13 +1009,13 @@ bool PrsonaServer::verify_vote_tensor_proofs(
         }
         }
 
 
         size_t whichProof = i + start_offset;
         size_t whichProof = i + start_offset;
-        retval = retval && verify_proof_of_reordering<CurveBipoint>(
+        retval = retval && verify_proof_of_reordering<TwistBipoint>(
             pi[whichProof],
             pi[whichProof],
             inputRow,
             inputRow,
             permutationCommits,
             permutationCommits,
             matrixCommits[i],
             matrixCommits[i],
-            bgnSystem.get_public_key().get_bipoint_curvegen(),
-            bgnSystem.get_public_key().get_bipoint_curve_subgroup_gen());
+            bgnSystem.get_public_key().get_bipoint_twistgen(),
+            bgnSystem.get_public_key().get_bipoint_twist_subgroup_gen());
     }
     }
 
 
     return retval;
     return retval;
@@ -1024,14 +1024,14 @@ bool PrsonaServer::verify_vote_tensor_proofs(
 void PrsonaServer::generate_user_tally_matrix(
 void PrsonaServer::generate_user_tally_matrix(
     const std::vector<std::vector<Scalar>>& permutations,
     const std::vector<std::vector<Scalar>>& permutations,
     const Scalar& power,
     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<Scalar>>& userTallySeeds,
-    std::vector<std::vector<Curvepoint>>& userTallySeedCommits) const
+    std::vector<std::vector<Twistpoint>>& userTallySeedCommits) const
 {
 {
     masks.clear();
     masks.clear();
     messages.clear();
     messages.clear();
@@ -1049,11 +1049,11 @@ void PrsonaServer::generate_user_tally_matrix(
     for (size_t i = 0; i < permutations.size(); i++)
     for (size_t i = 0; i < permutations.size(); i++)
     {
     {
         std::vector<Scalar> currSeeds;
         std::vector<Scalar> currSeeds;
-        std::vector<Curvepoint> currRow;
+        std::vector<Twistpoint> currRow;
         for (size_t j = 0; j < permutations[i].size(); j++)
         for (size_t j = 0; j < permutations[i].size(); j++)
         {
         {
             currSeeds.push_back(Scalar(0));
             currSeeds.push_back(Scalar(0));
-            currRow.push_back(Curvepoint());
+            currRow.push_back(Twistpoint());
         }
         }
         userTallySeeds.push_back(currSeeds);
         userTallySeeds.push_back(currSeeds);
         maskCommits.push_back(currRow);
         maskCommits.push_back(currRow);
@@ -1096,7 +1096,7 @@ std::vector<std::vector<T>> PrsonaServer::generate_reordered_plus_power_matrix(
     const Scalar& power,
     const Scalar& power,
     const std::vector<T>& oldValues,
     const std::vector<T>& oldValues,
     std::vector<std::vector<Scalar>>& seeds,
     std::vector<std::vector<Scalar>>& seeds,
-    std::vector<std::vector<Curvepoint>>& seedCommits,
+    std::vector<std::vector<Twistpoint>>& seedCommits,
     const T& h) const
     const T& h) const
 {
 {
     std::vector<std::vector<Scalar>> permutation_plus_power;
     std::vector<std::vector<Scalar>> permutation_plus_power;
@@ -1105,11 +1105,11 @@ std::vector<std::vector<T>> PrsonaServer::generate_reordered_plus_power_matrix(
     for (size_t i = 0; i < permutations.size(); i++)
     for (size_t i = 0; i < permutations.size(); i++)
     {
     {
         std::vector<Scalar> currPermutations;
         std::vector<Scalar> currPermutations;
-        std::vector<Curvepoint> currSeedCommits;
+        std::vector<Twistpoint> currSeedCommits;
         for (size_t j = 0; j < permutations[i].size(); j++)
         for (size_t j = 0; j < permutations[i].size(); j++)
         {
         {
             currPermutations.push_back(permutations[i][j] * power);
             currPermutations.push_back(permutations[i][j] * power);
-            currSeedCommits.push_back(Curvepoint());
+            currSeedCommits.push_back(Twistpoint());
         }
         }
         permutation_plus_power.push_back(currPermutations);
         permutation_plus_power.push_back(currPermutations);
         seedCommits.push_back(currSeedCommits);
         seedCommits.push_back(currSeedCommits);
@@ -1176,7 +1176,7 @@ std::vector<std::vector<T>> PrsonaServer::generate_reordered_matrix(
     return retval;
     return retval;
 }
 }
 
 
-std::vector<size_t> PrsonaServer::sort_data(const std::vector<Curvepoint>& inputs) const
+std::vector<size_t> PrsonaServer::sort_data(const std::vector<Twistpoint>& inputs) const
 {
 {
     std::vector<size_t> retval;
     std::vector<size_t> retval;
 
 
@@ -1200,22 +1200,22 @@ std::vector<size_t> PrsonaServer::sort_data(const std::vector<Curvepoint>& input
 }
 }
 
 
 bool PrsonaServer::update_data(
 bool PrsonaServer::update_data(
-    const std::vector<std::vector<Curvepoint>>& freshPseudonymCommits,
-    const std::vector<std::vector<TwistBipoint>>& serverTallyCommits,
-    const std::vector<std::vector<std::vector<CurveBipoint>>>& voteMatrixCommits,
-    const std::vector<std::vector<Curvepoint>>& userTallyMaskCommits,
-    const std::vector<std::vector<Curvepoint>>& userTallyMessageCommits)
+    const std::vector<std::vector<Twistpoint>>& freshPseudonymCommits,
+    const std::vector<std::vector<CurveBipoint>>& serverTallyCommits,
+    const std::vector<std::vector<std::vector<TwistBipoint>>>& voteMatrixCommits,
+    const std::vector<std::vector<Twistpoint>>& userTallyMaskCommits,
+    const std::vector<std::vector<Twistpoint>>& userTallyMessageCommits)
 {
 {
-    std::vector<Curvepoint> newPseudonyms;
-    std::vector<TwistBipoint> newVoteTallies;
+    std::vector<Twistpoint> newPseudonyms;
+    std::vector<CurveBipoint> newVoteTallies;
     std::vector<EGCiphertext> newUserTallies;
     std::vector<EGCiphertext> newUserTallies;
 
 
     for (size_t i = 0; i < freshPseudonymCommits.size(); i++)
     for (size_t i = 0; i < freshPseudonymCommits.size(); i++)
     {
     {
-        Curvepoint pseudonymSum = freshPseudonymCommits[i][0];
-        TwistBipoint voteTallySum = serverTallyCommits[i][0];
+        Twistpoint pseudonymSum = freshPseudonymCommits[i][0];
+        CurveBipoint voteTallySum = serverTallyCommits[i][0];
 
 
-        Curvepoint userTallyMask, userTallyMessage;
+        Twistpoint userTallyMask, userTallyMessage;
         if (!userTallyMaskCommits.empty())
         if (!userTallyMaskCommits.empty())
         {
         {
             userTallyMask = userTallyMaskCommits[i][0];
             userTallyMask = userTallyMaskCommits[i][0];
@@ -1261,7 +1261,7 @@ bool PrsonaServer::update_data(
 }
 }
 
 
 bool PrsonaServer::pseudonyms_sorted(
 bool PrsonaServer::pseudonyms_sorted(
-    const std::vector<Curvepoint> newPseudonyms) const
+    const std::vector<Twistpoint> newPseudonyms) const
 {
 {
     bool retval = true;
     bool retval = true;
     
     
@@ -1277,26 +1277,26 @@ bool PrsonaServer::pseudonyms_sorted(
 
 
 bool PrsonaServer::import_new_user_update(
 bool PrsonaServer::import_new_user_update(
     const std::vector<Proof>& pi,
     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<EGCiphertext>& otherCurrentUserEncryptedTallies,
-    const std::vector<std::vector<CurveBipoint>>& otherVoteMatrix)
+    const std::vector<std::vector<TwistBipoint>>& otherVoteMatrix)
 {
 {
     size_t newIndex = 0;
     size_t newIndex = 0;
     if (!currentPseudonyms.empty())
     if (!currentPseudonyms.empty())
         while (otherCurrentPseudonyms[newIndex] == currentPseudonyms[newIndex])
         while (otherCurrentPseudonyms[newIndex] == currentPseudonyms[newIndex])
             newIndex++;
             newIndex++;
 
 
-    Curvepoint shortTermPublicKey = otherCurrentPseudonyms[newIndex];
+    Twistpoint shortTermPublicKey = otherCurrentPseudonyms[newIndex];
 
 
     bool flag = verify_proof_of_added_user(
     bool flag = verify_proof_of_added_user(
         pi,
         pi,
         currentFreshGenerator,
         currentFreshGenerator,
         shortTermPublicKey,
         shortTermPublicKey,
-        bgnSystem.get_public_key().get_bipoint_curvegen(),
-        bgnSystem.get_public_key().get_bipoint_curve_subgroup_gen(),
         bgnSystem.get_public_key().get_bipoint_twistgen(),
         bgnSystem.get_public_key().get_bipoint_twistgen(),
         bgnSystem.get_public_key().get_bipoint_twist_subgroup_gen(),
         bgnSystem.get_public_key().get_bipoint_twist_subgroup_gen(),
+        bgnSystem.get_public_key().get_bipoint_curvegen(),
+        bgnSystem.get_public_key().get_bipoint_curve_subgroup_gen(),
         newIndex,
         newIndex,
         otherCurrentUserEncryptedTallies[newIndex],
         otherCurrentUserEncryptedTallies[newIndex],
         otherPreviousVoteTallies[newIndex],
         otherPreviousVoteTallies[newIndex],
@@ -1360,10 +1360,10 @@ std::vector<size_t> PrsonaServer::order_data()
     std::vector<size_t> retval = sort_data(currentPseudonyms);
     std::vector<size_t> retval = sort_data(currentPseudonyms);
 
 
     // Order all other data in the same way, for consistency
     // Order all other data in the same way, for consistency
-    std::vector<Curvepoint> newPseudonyms;
-    std::vector<TwistBipoint> newVoteTallies;
+    std::vector<Twistpoint> newPseudonyms;
+    std::vector<CurveBipoint> newVoteTallies;
     std::vector<EGCiphertext> newUserEncryptedTallies;
     std::vector<EGCiphertext> newUserEncryptedTallies;
-    std::vector<std::vector<CurveBipoint>> newVoteMatrix;
+    std::vector<std::vector<TwistBipoint>> newVoteMatrix;
 
 
     for (size_t i = 0; i < retval.size(); i++)
     for (size_t i = 0; i < retval.size(); i++)
     {
     {
@@ -1376,7 +1376,7 @@ std::vector<size_t> PrsonaServer::order_data()
                 currentUserEncryptedTallies[retval[i]]);
                 currentUserEncryptedTallies[retval[i]]);
         }
         }
 
 
-        std::vector<CurveBipoint> currNewRow;
+        std::vector<TwistBipoint> currNewRow;
         for (size_t j = 0; j < currentPseudonyms.size(); j++)
         for (size_t j = 0; j < currentPseudonyms.size(); j++)
         {
         {
             currNewRow.push_back(
             currNewRow.push_back(
@@ -1398,7 +1398,7 @@ std::vector<size_t> PrsonaServer::order_data()
  */
  */
 
 
 // Completely normal binary search
 // Completely normal binary search
-size_t PrsonaServer::binary_search(const Curvepoint& index) const
+size_t PrsonaServer::binary_search(const Twistpoint& index) const
 {
 {
     return PrsonaBase::binary_search(currentPseudonyms, index);
     return PrsonaBase::binary_search(currentPseudonyms, index);
 }
 }
@@ -1409,14 +1409,14 @@ size_t PrsonaServer::binary_search(const Curvepoint& index) const
 
 
 bool PrsonaServer::verify_vote_proof(
 bool PrsonaServer::verify_vote_proof(
     const std::vector<Proof>& pi,
     const std::vector<Proof>& pi,
-    const std::vector<CurveBipoint>& oldVotes,
-    const std::vector<CurveBipoint>& newVotes,
-    const Curvepoint& shortTermPublicKey) const
+    const std::vector<TwistBipoint>& oldVotes,
+    const std::vector<TwistBipoint>& newVotes,
+    const Twistpoint& shortTermPublicKey) const
 {
 {
     const BGNPublicKey& pubKey = bgnSystem.get_public_key();
     const BGNPublicKey& pubKey = bgnSystem.get_public_key();
     return PrsonaBase::verify_vote_proof(
     return PrsonaBase::verify_vote_proof(
-        pubKey.get_bipoint_curvegen(),
-        pubKey.get_bipoint_curve_subgroup_gen(),
+        pubKey.get_bipoint_twistgen(),
+        pubKey.get_bipoint_twist_subgroup_gen(),
         pi,
         pi,
         oldVotes,
         oldVotes,
         newVotes,
         newVotes,
@@ -1424,7 +1424,7 @@ bool PrsonaServer::verify_vote_proof(
         shortTermPublicKey);
         shortTermPublicKey);
 }
 }
 
 
-void PrsonaServer::print_scores(const std::vector<TwistBipoint>& scores)
+void PrsonaServer::print_scores(const std::vector<CurveBipoint>& scores)
 {
 {
     std::cout << "[";
     std::cout << "[";
     for (size_t i = 0; i < scores.size(); i++)
     for (size_t i = 0; i < scores.size(); i++)

+ 73 - 73
prsona/src/serverEntity.cpp

@@ -30,7 +30,7 @@ PrsonaServerEntity::PrsonaServerEntity(size_t numServers)
     // After all servers have made their seeds,
     // After all servers have made their seeds,
     // make sure they have the initial fresh generator
     // make sure they have the initial fresh generator
     std::vector<Proof> pi;
     std::vector<Proof> pi;
-    Curvepoint firstGenerator = get_fresh_generator(pi);
+    Twistpoint firstGenerator = get_fresh_generator(pi);
     for (size_t i = 0; i < numServers; i++)
     for (size_t i = 0; i < numServers; i++)
         servers[i].initialize_fresh_generator(pi, firstGenerator);
         servers[i].initialize_fresh_generator(pi, firstGenerator);
 
 
@@ -38,7 +38,7 @@ PrsonaServerEntity::PrsonaServerEntity(size_t numServers)
 
 
     // It's important that no server knows the DLOG between g and h for ElGamal,
     // It's important that no server knows the DLOG between g and h for ElGamal,
     // so have each server collaborate to make h.
     // so have each server collaborate to make h.
-    Curvepoint blindGenerator = PrsonaServer::EL_GAMAL_GENERATOR;
+    Twistpoint blindGenerator = PrsonaServer::EL_GAMAL_GENERATOR;
     for (size_t i = 0; i < numServers; i++)
     for (size_t i = 0; i < numServers; i++)
     {
     {
         blindGenerator =
         blindGenerator =
@@ -62,68 +62,68 @@ BGNPublicKey PrsonaServerEntity::get_bgn_public_key(size_t which) const
     return servers[which].get_bgn_public_key();
     return servers[which].get_bgn_public_key();
 }
 }
 
 
-Curvepoint PrsonaServerEntity::get_blinding_generator() const
+Twistpoint PrsonaServerEntity::get_blinding_generator() const
 {
 {
     return get_blinding_generator(0);
     return get_blinding_generator(0);
 }
 }
 
 
-Curvepoint PrsonaServerEntity::get_blinding_generator(size_t which) const
+Twistpoint PrsonaServerEntity::get_blinding_generator(size_t which) const
 {
 {
     std::vector<Proof> pi;
     std::vector<Proof> pi;
-    Curvepoint retval = get_blinding_generator(pi, which);
+    Twistpoint retval = get_blinding_generator(pi, which);
 
 
     if (!servers[which].verify_generator_proof(
     if (!servers[which].verify_generator_proof(
             pi, retval, servers[which].get_num_servers()))
             pi, retval, servers[which].get_num_servers()))
     {
     {
         std::cerr << "Error making the generator, aborting." << std::endl;
         std::cerr << "Error making the generator, aborting." << std::endl;
-        return Curvepoint();
+        return Twistpoint();
     }
     }
 
 
     return retval;
     return retval;
 }
 }
 
 
-Curvepoint PrsonaServerEntity::get_blinding_generator(
+Twistpoint PrsonaServerEntity::get_blinding_generator(
     std::vector<Proof>& pi) const
     std::vector<Proof>& pi) const
 {
 {
     return get_blinding_generator(pi, 0);
     return get_blinding_generator(pi, 0);
 }
 }
 
 
-Curvepoint PrsonaServerEntity::get_blinding_generator(
+Twistpoint PrsonaServerEntity::get_blinding_generator(
     std::vector<Proof>& pi, size_t which) const
     std::vector<Proof>& pi, size_t which) const
 {
 {
     return servers[which].get_blinding_generator(pi);
     return servers[which].get_blinding_generator(pi);
 }
 }
 
 
-Curvepoint PrsonaServerEntity::get_fresh_generator() const
+Twistpoint PrsonaServerEntity::get_fresh_generator() const
 {
 {
     return get_fresh_generator(0);
     return get_fresh_generator(0);
 }
 }
 
 
-Curvepoint PrsonaServerEntity::get_fresh_generator(size_t which) const
+Twistpoint PrsonaServerEntity::get_fresh_generator(size_t which) const
 {
 {
     std::vector<Proof> pi;
     std::vector<Proof> pi;
-    Curvepoint retval = get_fresh_generator(pi, which);
+    Twistpoint retval = get_fresh_generator(pi, which);
 
 
     if (!servers[which].verify_generator_proof(
     if (!servers[which].verify_generator_proof(
             pi, retval, servers[which].get_num_servers()))
             pi, retval, servers[which].get_num_servers()))
     {
     {
         std::cerr << "Error making the generator, aborting." << std::endl;
         std::cerr << "Error making the generator, aborting." << std::endl;
-        return Curvepoint();
+        return Twistpoint();
     }
     }
 
 
     return retval;
     return retval;
 }
 }
 
 
-Curvepoint PrsonaServerEntity::get_fresh_generator(
+Twistpoint PrsonaServerEntity::get_fresh_generator(
     std::vector<Proof>& pi) const
     std::vector<Proof>& pi) const
 {
 {
     return get_fresh_generator(pi, 0);
     return get_fresh_generator(pi, 0);
 }
 }
 
 
-Curvepoint PrsonaServerEntity::get_fresh_generator(
+Twistpoint PrsonaServerEntity::get_fresh_generator(
     std::vector<Proof>& pi, size_t which) const
     std::vector<Proof>& pi, size_t which) const
 {
 {
-    Curvepoint retval = PrsonaServer::EL_GAMAL_GENERATOR;
+    Twistpoint retval = PrsonaServer::EL_GAMAL_GENERATOR;
 
 
     pi.clear();   
     pi.clear();   
     for (size_t j = 0; j < servers[which].get_num_servers(); j++)
     for (size_t j = 0; j < servers[which].get_num_servers(); j++)
@@ -159,8 +159,8 @@ size_t PrsonaServerEntity::get_num_servers(size_t which) const
  * ENCRYPTED DATA GETTERS
  * ENCRYPTED DATA GETTERS
  */
  */
 
 
-std::vector<CurveBipoint> PrsonaServerEntity::get_current_votes_by(
-    Proof& pi, const Curvepoint& shortTermPublicKey) const
+std::vector<TwistBipoint> PrsonaServerEntity::get_current_votes_by(
+    Proof& pi, const Twistpoint& shortTermPublicKey) const
 {
 {
     return get_current_votes_by(pi, shortTermPublicKey, 0);
     return get_current_votes_by(pi, shortTermPublicKey, 0);
 }
 }
@@ -169,57 +169,57 @@ std::vector<CurveBipoint> PrsonaServerEntity::get_current_votes_by(
  * (who is identified by their short term public key).
  * (who is identified by their short term public key).
  * In practice, this is intended for clients,
  * In practice, this is intended for clients,
  * who need to know their current votes in order to rerandomize them. */
  * who need to know their current votes in order to rerandomize them. */
-std::vector<CurveBipoint> PrsonaServerEntity::get_current_votes_by(
-    Proof& pi, const Curvepoint& shortTermPublicKey, size_t which) const
+std::vector<TwistBipoint> PrsonaServerEntity::get_current_votes_by(
+    Proof& pi, const Twistpoint& shortTermPublicKey, size_t which) const
 {
 {
     return servers[which].get_current_votes_by(pi, shortTermPublicKey);
     return servers[which].get_current_votes_by(pi, shortTermPublicKey);
 }
 }
 
 
-std::vector<std::vector<CurveBipoint>> PrsonaServerEntity::get_all_current_votes(
+std::vector<std::vector<TwistBipoint>> PrsonaServerEntity::get_all_current_votes(
     Proof& pi) const
     Proof& pi) const
 {
 {
     return get_all_current_votes(pi, 0);
     return get_all_current_votes(pi, 0);
 }
 }
 
 
-std::vector<std::vector<CurveBipoint>> PrsonaServerEntity::get_all_current_votes(
+std::vector<std::vector<TwistBipoint>> PrsonaServerEntity::get_all_current_votes(
     Proof& pi, size_t which) const
     Proof& pi, size_t which) const
 {
 {
     return servers[which].get_all_current_votes(pi);
     return servers[which].get_all_current_votes(pi);
 }
 }
 
 
 EGCiphertext PrsonaServerEntity::get_current_user_encrypted_tally(
 EGCiphertext PrsonaServerEntity::get_current_user_encrypted_tally(
-    Proof& pi, const Curvepoint& shortTermPublicKey) const
+    Proof& pi, const Twistpoint& shortTermPublicKey) const
 {
 {
     return get_current_user_encrypted_tally(pi, shortTermPublicKey, 0);
     return get_current_user_encrypted_tally(pi, shortTermPublicKey, 0);
 }
 }
 
 
 EGCiphertext PrsonaServerEntity::get_current_user_encrypted_tally(
 EGCiphertext PrsonaServerEntity::get_current_user_encrypted_tally(
-    Proof& pi, const Curvepoint& shortTermPublicKey, size_t which) const
+    Proof& pi, const Twistpoint& shortTermPublicKey, size_t which) const
 {
 {
     return servers[which].get_current_user_encrypted_tally(
     return servers[which].get_current_user_encrypted_tally(
         pi, shortTermPublicKey);
         pi, shortTermPublicKey);
 }
 }
 
 
-TwistBipoint PrsonaServerEntity::get_current_server_encrypted_tally(
-    Proof& pi, const Curvepoint& shortTermPublicKey) const
+CurveBipoint PrsonaServerEntity::get_current_server_encrypted_tally(
+    Proof& pi, const Twistpoint& shortTermPublicKey) const
 {
 {
     return get_current_server_encrypted_tally(pi, shortTermPublicKey, 0);
     return get_current_server_encrypted_tally(pi, shortTermPublicKey, 0);
 }
 }
 
 
-TwistBipoint PrsonaServerEntity::get_current_server_encrypted_tally(
-    Proof& pi, const Curvepoint& shortTermPublicKey, size_t which) const
+CurveBipoint PrsonaServerEntity::get_current_server_encrypted_tally(
+    Proof& pi, const Twistpoint& shortTermPublicKey, size_t which) const
 {
 {
     return servers[which].get_current_server_encrypted_tally(
     return servers[which].get_current_server_encrypted_tally(
         pi, shortTermPublicKey);
         pi, shortTermPublicKey);
 }
 }
 
 
-std::vector<Curvepoint> PrsonaServerEntity::get_current_pseudonyms(
+std::vector<Twistpoint> PrsonaServerEntity::get_current_pseudonyms(
     Proof& pi) const
     Proof& pi) const
 {
 {
     return get_current_pseudonyms(pi, 0);
     return get_current_pseudonyms(pi, 0);
 }
 }
 
 
-std::vector<Curvepoint> PrsonaServerEntity::get_current_pseudonyms(
+std::vector<Twistpoint> PrsonaServerEntity::get_current_pseudonyms(
     Proof& pi, size_t which) const
     Proof& pi, size_t which) const
 {
 {
     return servers[which].get_current_pseudonyms(pi);
     return servers[which].get_current_pseudonyms(pi);
@@ -230,13 +230,13 @@ std::vector<Curvepoint> PrsonaServerEntity::get_current_pseudonyms(
  */
  */
 
 
 void PrsonaServerEntity::get_other_vote_row_commitments(
 void PrsonaServerEntity::get_other_vote_row_commitments(
-    std::vector<Proof>& pi, const Curvepoint& request) const
+    std::vector<Proof>& pi, const Twistpoint& request) const
 {
 {
     get_other_vote_row_commitments(pi, request, 0);
     get_other_vote_row_commitments(pi, request, 0);
 }
 }
 
 
 void PrsonaServerEntity::get_other_vote_row_commitments(
 void PrsonaServerEntity::get_other_vote_row_commitments(
-    std::vector<Proof>& pi, const Curvepoint& request, size_t whichNot) const
+    std::vector<Proof>& pi, const Twistpoint& request, size_t whichNot) const
 {
 {
     for (size_t i = 0; i < servers.size(); i++)
     for (size_t i = 0; i < servers.size(); i++)
     {
     {
@@ -266,13 +266,13 @@ void PrsonaServerEntity::get_other_vote_matrix_commitments(
 }
 }
 
 
 void PrsonaServerEntity::get_other_user_tally_commitments(
 void PrsonaServerEntity::get_other_user_tally_commitments(
-    std::vector<Proof>& pi, const Curvepoint& request) const
+    std::vector<Proof>& pi, const Twistpoint& request) const
 {
 {
     get_other_user_tally_commitments(pi, request, 0);
     get_other_user_tally_commitments(pi, request, 0);
 }
 }
 
 
 void PrsonaServerEntity::get_other_user_tally_commitments(
 void PrsonaServerEntity::get_other_user_tally_commitments(
-    std::vector<Proof>& pi, const Curvepoint& request, size_t whichNot) const
+    std::vector<Proof>& pi, const Twistpoint& request, size_t whichNot) const
 {
 {
     for (size_t i = 0; i < servers.size(); i++)
     for (size_t i = 0; i < servers.size(); i++)
     {
     {
@@ -284,13 +284,13 @@ void PrsonaServerEntity::get_other_user_tally_commitments(
 }
 }
 
 
 void PrsonaServerEntity::get_other_server_tally_commitments(
 void PrsonaServerEntity::get_other_server_tally_commitments(
-    std::vector<Proof>& pi, const Curvepoint& request) const
+    std::vector<Proof>& pi, const Twistpoint& request) const
 {
 {
     get_other_server_tally_commitments(pi, request, 0);
     get_other_server_tally_commitments(pi, request, 0);
 }
 }
 
 
 void PrsonaServerEntity::get_other_server_tally_commitments(
 void PrsonaServerEntity::get_other_server_tally_commitments(
-    std::vector<Proof>& pi, const Curvepoint& request, size_t whichNot) const
+    std::vector<Proof>& pi, const Twistpoint& request, size_t whichNot) const
 {
 {
     for (size_t i = 0; i < servers.size(); i++)
     for (size_t i = 0; i < servers.size(); i++)
     {
     {
@@ -335,13 +335,13 @@ void PrsonaServerEntity::add_new_client(PrsonaClient& newUser, size_t which)
 {
 {
     Proof proofOfValidSTPK, proofOfValidVotes;
     Proof proofOfValidSTPK, proofOfValidVotes;
     std::vector<Proof> proofOfValidGenerator, proofOfCorrectAddition;
     std::vector<Proof> proofOfValidGenerator, proofOfCorrectAddition;
-    Curvepoint freshGenerator =
+    Twistpoint freshGenerator =
         get_fresh_generator(proofOfValidGenerator, which);
         get_fresh_generator(proofOfValidGenerator, which);
 
 
     // Users can't actually announce a short term public key
     // Users can't actually announce a short term public key
     // if they don't know the fresh generator.
     // if they don't know the fresh generator.
     newUser.receive_fresh_generator(proofOfValidGenerator, freshGenerator);
     newUser.receive_fresh_generator(proofOfValidGenerator, freshGenerator);
-    Curvepoint shortTermPublicKey = newUser.get_short_term_public_key(
+    Twistpoint shortTermPublicKey = newUser.get_short_term_public_key(
                                         proofOfValidSTPK);
                                         proofOfValidSTPK);
 
 
     // Do the actual work of adding the client to the first server
     // Do the actual work of adding the client to the first server
@@ -349,10 +349,10 @@ void PrsonaServerEntity::add_new_client(PrsonaClient& newUser, size_t which)
         proofOfCorrectAddition, proofOfValidSTPK, shortTermPublicKey);
         proofOfCorrectAddition, proofOfValidSTPK, shortTermPublicKey);
 
 
     // Then, export the data to the rest of the servers
     // Then, export the data to the rest of the servers
-    std::vector<TwistBipoint> previousVoteTallies;
-    std::vector<Curvepoint> currentPseudonyms;
+    std::vector<CurveBipoint> previousVoteTallies;
+    std::vector<Twistpoint> currentPseudonyms;
     std::vector<EGCiphertext> currentUserEncryptedTallies;
     std::vector<EGCiphertext> currentUserEncryptedTallies;
-    std::vector<std::vector<CurveBipoint>> voteMatrix;
+    std::vector<std::vector<TwistBipoint>> voteMatrix;
 
 
     previousVoteTallies = servers[which].previousVoteTallies;
     previousVoteTallies = servers[which].previousVoteTallies;
     currentPseudonyms = servers[which].currentPseudonyms;
     currentPseudonyms = servers[which].currentPseudonyms;
@@ -378,16 +378,16 @@ void PrsonaServerEntity::add_new_client(PrsonaClient& newUser, size_t which)
 // Receive a new vote row from a user (identified by short term public key).
 // Receive a new vote row from a user (identified by short term public key).
 bool PrsonaServerEntity::receive_vote(
 bool PrsonaServerEntity::receive_vote(
     const std::vector<Proof>& pi,
     const std::vector<Proof>& pi,
-    const std::vector<CurveBipoint>& newVotes,
-    const Curvepoint& shortTermPublicKey)
+    const std::vector<TwistBipoint>& newVotes,
+    const Twistpoint& shortTermPublicKey)
 {
 {
     return receive_vote(pi, newVotes, shortTermPublicKey, 0);
     return receive_vote(pi, newVotes, shortTermPublicKey, 0);
 }
 }
 
 
 bool PrsonaServerEntity::receive_vote(
 bool PrsonaServerEntity::receive_vote(
     const std::vector<Proof>& pi,
     const std::vector<Proof>& pi,
-    const std::vector<CurveBipoint>& newVotes,
-    const Curvepoint& shortTermPublicKey,
+    const std::vector<TwistBipoint>& newVotes,
+    const Twistpoint& shortTermPublicKey,
     size_t which)
     size_t which)
 {
 {
     bool retval = true;
     bool retval = true;
@@ -412,12 +412,12 @@ void PrsonaServerEntity::transmit_new_user_data(
 void PrsonaServerEntity::transmit_new_user_data(
 void PrsonaServerEntity::transmit_new_user_data(
     const std::vector<Proof>& pi, PrsonaClient& newUser, size_t which) const
     const std::vector<Proof>& pi, PrsonaClient& newUser, size_t which) const
 {
 {
-    Curvepoint shortTermPublicKey =
+    Twistpoint shortTermPublicKey =
         newUser.get_short_term_public_key();
         newUser.get_short_term_public_key();
 
 
     Proof baseProof;
     Proof baseProof;
     std::vector<Proof> serverEncryptedScoreProof;
     std::vector<Proof> serverEncryptedScoreProof;
-    TwistBipoint serverEncryptedScore =
+    CurveBipoint serverEncryptedScore =
         get_current_server_encrypted_tally(baseProof, shortTermPublicKey, which);
         get_current_server_encrypted_tally(baseProof, shortTermPublicKey, which);
     serverEncryptedScoreProof.push_back(baseProof);
     serverEncryptedScoreProof.push_back(baseProof);
     get_other_server_tally_commitments(serverEncryptedScoreProof, shortTermPublicKey, which);
     get_other_server_tally_commitments(serverEncryptedScoreProof, shortTermPublicKey, which);
@@ -431,14 +431,14 @@ void PrsonaServerEntity::transmit_new_user_data(
 
 
     baseProof.clear();
     baseProof.clear();
     std::vector<Proof> voteMatrixProof;
     std::vector<Proof> voteMatrixProof;
-    std::vector<std::vector<CurveBipoint>> voteMatrix =
+    std::vector<std::vector<TwistBipoint>> voteMatrix =
         get_all_current_votes(baseProof, which);
         get_all_current_votes(baseProof, which);
     voteMatrixProof.push_back(baseProof);
     voteMatrixProof.push_back(baseProof);
     get_other_vote_matrix_commitments(voteMatrixProof, which);
     get_other_vote_matrix_commitments(voteMatrixProof, which);
 
 
     baseProof.clear();
     baseProof.clear();
     std::vector<Proof> pseudonymsProof;
     std::vector<Proof> pseudonymsProof;
-    std::vector<Curvepoint> currentPseudonyms =
+    std::vector<Twistpoint> currentPseudonyms =
         get_current_pseudonyms(baseProof, which);
         get_current_pseudonyms(baseProof, which);
     pseudonymsProof.push_back(baseProof);
     pseudonymsProof.push_back(baseProof);
     get_other_pseudonyms_commitments(pseudonymsProof, which);
     get_other_pseudonyms_commitments(pseudonymsProof, which);
@@ -467,7 +467,7 @@ void PrsonaServerEntity::transmit_updates(
 {
 {
     Proof proofOfValidSTPK, proofOfScore, proofOfCorrectVotes;
     Proof proofOfValidSTPK, proofOfScore, proofOfCorrectVotes;
     std::vector<Proof> proofOfValidGenerator;
     std::vector<Proof> proofOfValidGenerator;
-    Curvepoint freshGenerator =
+    Twistpoint freshGenerator =
         get_fresh_generator(proofOfValidGenerator, which);
         get_fresh_generator(proofOfValidGenerator, which);
 
 
     // Get users the next fresh generator so they can correctly
     // Get users the next fresh generator so they can correctly
@@ -476,7 +476,7 @@ void PrsonaServerEntity::transmit_updates(
 
 
     Proof baseProof;
     Proof baseProof;
     std::vector<Proof> fullProof;
     std::vector<Proof> fullProof;
-    Curvepoint shortTermPublicKey =
+    Twistpoint shortTermPublicKey =
         currUser.get_short_term_public_key();
         currUser.get_short_term_public_key();
     EGCiphertext encryptedScore =
     EGCiphertext encryptedScore =
         get_current_user_encrypted_tally(baseProof, shortTermPublicKey, which);
         get_current_user_encrypted_tally(baseProof, shortTermPublicKey, which);
@@ -498,18 +498,18 @@ void PrsonaServerEntity::epoch()
 // Do the epoch process
 // Do the epoch process
 void PrsonaServerEntity::epoch(size_t which)
 void PrsonaServerEntity::epoch(size_t which)
 {
 {
-    Curvepoint nextGenerator = PrsonaServer::EL_GAMAL_GENERATOR;
+    Twistpoint nextGenerator = PrsonaServer::EL_GAMAL_GENERATOR;
     
     
     std::vector<std::vector<std::vector<Proof>>> pi;
     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;
+    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;
 
 
     std::vector<std::vector<Proof>> generator_proof_holder(1);
     std::vector<std::vector<Proof>> generator_proof_holder(1);
     pi.push_back(generator_proof_holder);
     pi.push_back(generator_proof_holder);
@@ -531,9 +531,9 @@ void PrsonaServerEntity::epoch(size_t which)
 
 
         for (size_t j = 1; j < servers[which].get_num_servers(); j++)
         for (size_t j = 1; j < servers[which].get_num_servers(); j++)
         {
         {
-            std::vector<std::vector<Curvepoint>> currUserTallyMaskCommits;
-            std::vector<std::vector<Curvepoint>> currUserTallyMessageCommits;
-            std::vector<std::vector<Curvepoint>> currUserTallySeedCommits;
+            std::vector<std::vector<Twistpoint>> currUserTallyMaskCommits;
+            std::vector<std::vector<Twistpoint>> currUserTallyMessageCommits;
+            std::vector<std::vector<Twistpoint>> currUserTallySeedCommits;
 
 
             size_t realJ = (realI + j) % servers[which].get_num_servers();
             size_t realJ = (realI + j) % servers[which].get_num_servers();
 
 
@@ -567,7 +567,7 @@ void PrsonaServerEntity::epoch(size_t which)
      * knows. Everyone else then adds a mask and proves they added a secret mask
      * knows. Everyone else then adds a mask and proves they added a secret mask
      * to the committed values. */
      * to the committed values. */
     std::vector<EGCiphertext> currentUserEncryptedTallies;
     std::vector<EGCiphertext> currentUserEncryptedTallies;
-    std::vector<TwistBipoint> currentServerEncryptedTallies;
+    std::vector<CurveBipoint> currentServerEncryptedTallies;
     tally_scores(
     tally_scores(
         nextGenerator,
         nextGenerator,
         currentUserEncryptedTallies,
         currentUserEncryptedTallies,
@@ -620,7 +620,7 @@ void PrsonaServerEntity::epoch(size_t which)
 void PrsonaServerEntity::print_scores() const
 void PrsonaServerEntity::print_scores() const
 {
 {
     BGN bgnSystem = servers[0].bgnSystem;
     BGN bgnSystem = servers[0].bgnSystem;
-    std::vector<TwistBipoint> scores = servers[0].previousVoteTallies;
+    std::vector<CurveBipoint> scores = servers[0].previousVoteTallies;
 
 
     std::cout << "[";
     std::cout << "[";
     for (size_t i = 0; i < scores.size(); i++)
     for (size_t i = 0; i < scores.size(); i++)
@@ -634,7 +634,7 @@ void PrsonaServerEntity::print_scores() const
 void PrsonaServerEntity::print_votes() const
 void PrsonaServerEntity::print_votes() const
 {
 {
     BGN bgnSystem = servers[0].bgnSystem;
     BGN bgnSystem = servers[0].bgnSystem;
-    std::vector<std::vector<CurveBipoint>> voteMatrix = servers[0].voteMatrix;
+    std::vector<std::vector<TwistBipoint>> voteMatrix = servers[0].voteMatrix;
 
 
     for (size_t i = 0; i < voteMatrix.size(); i++)
     for (size_t i = 0; i < voteMatrix.size(); i++)
     {
     {
@@ -650,12 +650,12 @@ void PrsonaServerEntity::print_votes() const
 }
 }
 
 
 void PrsonaServerEntity::print_current_votes_by(
 void PrsonaServerEntity::print_current_votes_by(
-    const Curvepoint& index) const
+    const Twistpoint& index) const
 {
 {
     BGN bgnSystem = servers[0].bgnSystem;
     BGN bgnSystem = servers[0].bgnSystem;
     size_t realIndex =
     size_t realIndex =
         servers[0].binary_search(index);
         servers[0].binary_search(index);
-    std::vector<CurveBipoint> scores = servers[0].voteMatrix[realIndex];
+    std::vector<TwistBipoint> scores = servers[0].voteMatrix[realIndex];
 
 
     std::cout << "[";
     std::cout << "[";
     for (size_t i = 0; i < scores.size(); i++)
     for (size_t i = 0; i < scores.size(); i++)
@@ -680,9 +680,9 @@ void PrsonaServerEntity::print_current_votes_by(
  * We're treating it as if we are one server, so that server gets the updated
  * We're treating it as if we are one server, so that server gets the updated
  * weights to be sent to all other servers for the next epoch. */
  * weights to be sent to all other servers for the next epoch. */
 void PrsonaServerEntity::tally_scores(
 void PrsonaServerEntity::tally_scores(
-    const Curvepoint& nextGenerator,
+    const Twistpoint& nextGenerator,
     std::vector<EGCiphertext>& userTallyScores,
     std::vector<EGCiphertext>& userTallyScores,
-    std::vector<TwistBipoint>& serverTallyScores,
+    std::vector<CurveBipoint>& serverTallyScores,
     size_t which)
     size_t which)
 {
 {
     std::vector<EGCiphertext> retval;
     std::vector<EGCiphertext> retval;
@@ -705,7 +705,7 @@ void PrsonaServerEntity::tally_scores(
 
 
         EGCiphertext currCiphertext;
         EGCiphertext currCiphertext;
         userTallyScores.push_back(currCiphertext);
         userTallyScores.push_back(currCiphertext);
-        TwistBipoint currServerScore;
+        CurveBipoint currServerScore;
         serverTallyScores.push_back(currServerScore);
         serverTallyScores.push_back(currServerScore);
         Scalar currMask;
         Scalar currMask;
         currMask.set_random();
         currMask.set_random();
@@ -724,7 +724,7 @@ void PrsonaServerEntity::tally_scores(
 
 
 void PrsonaServerEntity::distribute_tallied_scores(
 void PrsonaServerEntity::distribute_tallied_scores(
     const std::vector<EGCiphertext>& userScores,
     const std::vector<EGCiphertext>& userScores,
-    const std::vector<TwistBipoint>& serverScores)
+    const std::vector<CurveBipoint>& serverScores)
 {
 {
     for (size_t i = 0; i < servers[0].get_num_servers(); i++)
     for (size_t i = 0; i < servers[0].get_num_servers(); i++)
     {
     {
@@ -740,7 +740,7 @@ void PrsonaServerEntity::distribute_tallied_scores(
 
 
 // Completely normal binary search
 // Completely normal binary search
 size_t PrsonaServerEntity::binary_search(
 size_t PrsonaServerEntity::binary_search(
-    const Curvepoint& shortTermPublicKey, size_t which) const
+    const Twistpoint& shortTermPublicKey, size_t which) const
 {
 {
     return servers[which].binary_search(shortTermPublicKey);
     return servers[which].binary_search(shortTermPublicKey);
 }
 }