|  | @@ -84,6 +84,15 @@ std::vector<CurveBipoint> PrsonaServer::get_current_votes_by(
 | 
	
		
			
				|  |  |      size_t voteSubmitter = binary_search(shortTermPublicKey);
 | 
	
		
			
				|  |  |      retval = voteMatrix[voteSubmitter];
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    // if (currentPseudonyms[voteSubmitter] != shortTermPublicKey)
 | 
	
		
			
				|  |  | +    // {
 | 
	
		
			
				|  |  | +    //     std::cout << "Query user: " << std::hex
 | 
	
		
			
				|  |  | +    //         << shortTermPublicKey << std::dec << std::endl;
 | 
	
		
			
				|  |  | +    //     for (size_t i = 0; i < currentPseudonyms.size(); i++)
 | 
	
		
			
				|  |  | +    //         std::cout << "User " << i + 1 << " of " << currentPseudonyms.size()
 | 
	
		
			
				|  |  | +    //             << ": " << std::hex << currentPseudonyms[i] << std::dec << std::endl;
 | 
	
		
			
				|  |  | +    // }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      pi = generate_valid_vote_row_proof();
 | 
	
		
			
				|  |  |      return retval;
 | 
	
		
			
				|  |  |  }
 | 
	
	
		
			
				|  | @@ -401,6 +410,79 @@ void PrsonaServer::break_down_midway_pseudonyms(
 | 
	
		
			
				|  |  |   * DATA MAINTENANCE
 | 
	
		
			
				|  |  |   */
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +bool PrsonaServer::import_new_user_update(
 | 
	
		
			
				|  |  | +    const std::vector<Proof>& pi,
 | 
	
		
			
				|  |  | +    const std::vector<TwistBipoint>& otherPreviousVoteTallies,
 | 
	
		
			
				|  |  | +    const std::vector<Curvepoint>& otherCurrentPseudonyms,
 | 
	
		
			
				|  |  | +    const std::vector<EGCiphertext>& otherCurrentUserEncryptedTallies,
 | 
	
		
			
				|  |  | +    const std::vector<std::vector<CurveBipoint>>& otherVoteMatrix)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    size_t newIndex = 0;
 | 
	
		
			
				|  |  | +    if (!currentPseudonyms.empty())
 | 
	
		
			
				|  |  | +        while (otherCurrentPseudonyms[newIndex] == currentPseudonyms[newIndex])
 | 
	
		
			
				|  |  | +            newIndex++;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    Curvepoint shortTermPublicKey = otherCurrentPseudonyms[newIndex];
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    bool flag = verify_proof_of_added_user(
 | 
	
		
			
				|  |  | +        pi,
 | 
	
		
			
				|  |  | +        currentFreshGenerator,
 | 
	
		
			
				|  |  | +        shortTermPublicKey,
 | 
	
		
			
				|  |  | +        elGamalBlindGenerator,
 | 
	
		
			
				|  |  | +        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(),
 | 
	
		
			
				|  |  | +        newIndex,
 | 
	
		
			
				|  |  | +        otherCurrentUserEncryptedTallies[newIndex],
 | 
	
		
			
				|  |  | +        otherPreviousVoteTallies[newIndex],
 | 
	
		
			
				|  |  | +        otherVoteMatrix);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if (!flag)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        std::cerr << "Other server added new user invalidly, aborting." << std::endl;
 | 
	
		
			
				|  |  | +        return false;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    for (size_t i = 0; i < otherCurrentPseudonyms.size(); i++)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        if (i == newIndex)
 | 
	
		
			
				|  |  | +            continue;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        size_t otherI = (i > newIndex ? i - 1 : i);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        flag = flag && otherCurrentPseudonyms[i] ==
 | 
	
		
			
				|  |  | +                currentPseudonyms[otherI];
 | 
	
		
			
				|  |  | +        flag = flag && otherCurrentUserEncryptedTallies[i] ==
 | 
	
		
			
				|  |  | +                currentUserEncryptedTallies[otherI];
 | 
	
		
			
				|  |  | +        flag = flag && otherPreviousVoteTallies[i] ==
 | 
	
		
			
				|  |  | +                previousVoteTallies[otherI];
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        for (size_t j = 0; j < otherCurrentPseudonyms.size(); j++)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            if (j == newIndex)
 | 
	
		
			
				|  |  | +                continue;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            size_t otherJ = (j > newIndex ? j - 1 : j);
 | 
	
		
			
				|  |  | +            flag = flag && otherVoteMatrix[i][j] ==
 | 
	
		
			
				|  |  | +                    voteMatrix[otherI][otherJ];
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if (!flag)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        std::cerr << "Other server illicitly changed other value during new user add." << std::endl;
 | 
	
		
			
				|  |  | +        return false;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    previousVoteTallies = otherPreviousVoteTallies;
 | 
	
		
			
				|  |  | +    currentPseudonyms = otherCurrentPseudonyms;
 | 
	
		
			
				|  |  | +    currentUserEncryptedTallies = otherCurrentUserEncryptedTallies;
 | 
	
		
			
				|  |  | +    voteMatrix = otherVoteMatrix;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    return true;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  void PrsonaServer::import_updates(
 | 
	
		
			
				|  |  |      const Proof& pi,
 | 
	
		
			
				|  |  |      const std::vector<TwistBipoint>& otherPreviousVoteTallies,
 |