\section{Introduction}\label{intro}
Electronic voting has significant advantages in comparison with the more commonplace physical voting:
it is faster, it reduces costs, it is more sustainable,
and in addition it may increase voters' participation. In the past two years, due to the COVID-19 pandemic and the need for social distancing, e-voting platforms have become even more essential.
One of the main challenges in holding e-voting is to secure the voting process:
namely, to make sure that it is secure against attempted manipulations so that the computed results are consistent with the cast ballots,
and that the privacy of the voters is preserved.

The usual meaning of voter privacy is that the voters remain anonymous. Namely, even though the ballots are revealed (as is the case when opening the ballot box at the end of an election day), no ballot can be traced back to the voter who cast it. We go one step further and consider perfect ballot secrecy, or full privacy~\cite{chaum1988}, i.e., given any coalition of voters, the protocol does not reveal any information on the ballots, beyond what can be inferred from the published results.
Such perfect secrecy may increase the voters' confidence and, consequently, encourage them to vote according to their true preferences.

There are various families of voting rules that can be used in elections. For example, in {\em score-based} voting rules, a score for each candidate is computed subject to the specifications of the underlying voting rule, and then the winning candidate is the one whose aggregated score is highest.
In this study we focus on {\em order-based} (a.k.a {\em pairwise-comparison}) voting rules, where the relative order of the candidates is considered by the underlying voting rule ~\cite{brandt2005decentralized}.

\textbf{Our contributions.} We consider a scenario in which there is a set of voters that hold an election over a given set of candidates.
We devise a fully private protocol for computing the results of elections that are governed by order-based voting rules.
The output of the election is a ranking of the candidates, from which the winning candidate(s) can be determined. Our protocol, which is based on cryptographic tools of multiparty computation, is lightweight and can be readily implemented in virtual elections.

The bulk of this study is devoted to two rules in this family -- {\sc Copeland}~\cite{copeland1951reasonable}, and
{\sc Maximin}~\cite{simpson1969defining} (a.k.a {\sc Kramer-Simpson}),
which are formally defined in
Section \ref{formaldef}. In Section \ref{other} we describe two other rules in this family, {\sc Kemeny-Young} ~\cite{kemeny1959mathematics,young1995optimal} and {\sc Modal Ranking}~\cite{caragiannis2014modal}, and describe the extension of our methods for those rules
as well.

The paper is structured as follows.
We first present related work in Section \ref{related}. Then,
in Section \ref{background}, we explain the cryptographic foundations on which our protocol is based.
In Section \ref{semihonest} we present our secure voting protocol
for {\sc Copeland} and {\sc Maximin} rules
and then, in Section \ref{costanalysis}, we evaluate its computational costs. In Section \ref{other} we discuss secure protocols for
{\sc Kemeny-Young} and {\sc Modal Ranking} rules.
Our concluding discussion is given in Section \ref{conc}.

\section{Related work}\label{related}
Secure e-voting can be approached using various cryptographic techniques.
The earliest suggestion is that of Chaum~\cite{chaum1981untraceable}, who suggested to use a mix network (mixnet). The idea is to treat the ballots as ciphertexts.
Voters encrypt their ballots
and agents collect and shuffle these messages and thus anonymity of the ballots is preserved. Other studies followed and improved this model, e.g.~\cite{sako1995receipt, adida2008helios, boneh2002almost,jakobsson2002making,lee2003providing,neff2001verifiable}.
However, while this system preserves anonymity, the talliers are exposed to the actual ballots. The mere anonymity of the ballots might not provide sufficient security and this may encourage voters to abstain or vote untruthfully
\cite{dery2021fear}.

Homomorphic encryption is an encryption that allows performing computations on encrypted values without decrypting them first. The most common ciphers of that class are additively homomorphic, in the sense that the product of several ciphertexts is the encryption of the sum of the corresponding plaintexts.
Such encryptions are suitable for secure voting, as was first suggested by
Benaloh
\cite{Benaloh86a}.
The main idea here is to encrypt the ballots, using a public-key homomorphic cipher.
An agent aggregates the encrypted ballots and then sends an aggregated encrypted value to the tallier. The tallier who decrypts the received ciphertext recovers the aggregation of the ballots, but not the ballots themselves. Secure voting protocols that are based on homomorphic encryption were presented in e.g.~\cite{cramer1997secure, damgaard2010generalization, yang2018secure, fan2020hse, rezaeibagha2019provably, priya2018blockchain}.

While most studies on secure voting offered protocols for securing the voting process, only few studies considered the question of private execution of the computation that the underlying voting rule dictates.
Canard et al.~\cite{canard2018practical} considered
the {\sc Majority Judgment} (MJ) voting rule ~\cite{balinski2007theory}.
They first translated the complex control flow and branching instructions that the MJ rule entails into a branchless algorithm; then they devised a privacy-preserving implementation of it using homomorphic encryption, distributed decryption schemes, distributed evaluation of Boolean gates, and distributed comparisons.
Nair et al.~\cite{NairBK15}
suggested to use secret sharing for the
tallying process in {\sc Plurality} voting \cite{brandt2016handbook}. Their protocol provides anonymity but does not provide
perfect secrecy as it reveals the final aggregated score of each candidate. In addition, their protocol is vulnerable to cheating attacks, as it does not include means for detecting illegal votes.
Yang et al.~\cite{yang2018secure} suggested using homomorphic encryption specifically for {\sc Approval} voting~\cite{brandt2016handbook}.
Lastly, Dery et al.~\cite{dery2021fear} offered a solution based on multiparty computation in order to securely determine the winners in elections governed by score-based voting rules.

To the best of our knowledge, no study so far addressed the question of securely computing election results where the governing voting rule is order-based. We undertake this challenge herein.

\section{Cryptographic preliminaries}\label{background}
Our protocol relies heavily on cryptographic machinery. This section provides the required cryptographic background and an explanation on how the presented techniques are implemented in our protocol.
In Section \ref{ssharing} we provide a brief introduction to secret sharing.
In Section \ref{mpc} we discuss the concept of secure multiparty computation (MPC). In the next subsections we discuss solutions to specific problems of MPC, which are used in our protocol: secure comparisons (Section \ref{secure_comparison}), secure testing of positivity (Section \ref{positivity}), and secure testing of equality to zero (Section \ref{is-zero}).

\subsection{Secret sharing}\label{ssharing}
Secret sharing methods ~\cite{Shamir79} enable distributing a secret among a group of participants. Each participant
is given a random share of the secret so that: (a) the secret can be reconstructed only by combining the shares given to specific {\em authorized} subsets of participants, and (b) combinations of shares belonging to unauthorized subsets of participants reveal zero information on the underlying secret.

The notion of secret sharing was introduced, independently, by Shamir~\cite{Shamir79} and Blakley~\cite{Blakley}, for the case of threshold secret sharing. Let $D$ be the number of participants and let $D'\leq D$ be some threshold. Then the authorized subsets in Shamir's and in Blakley's schemes
are those of size at least $D'$. Such secret sharing schemes are called $D'$-out-of-$D$.

Shamir's $D'$-out-of-$D$ secret sharing scheme operates over a finite field ${\bf Z}_p$, where $p>D$ is a prime sufficiently large so that all possible secrets may be represented in ${\bf Z}_p$.
It has two procedures: {\sf Share} and {\sf Reconstruct}:

\smallskip
$\bullet$ ${\sf Share}_{D',D}(x)$.
    The procedure samples a uniformly random polynomial $g(\cdot)$ over ${\bf Z}_p$, of degree at most $D'-1$, where the free coefficient is the secret $s$. That is, $g(x)=s+a_1 x + a_2 x^2 + \ldots + a_{D'-1} x^{D'-1}$, where $a_j$, $1 \leq j \leq D'-1$, are selected independently and uniformly at random from ${\bf Z}_p$. The procedure outputs $D$ values, $s_d=g(d)$, $d \in [D]:=\{1,\ldots,D\}$, where $s_d$ is the share given to the $d$th participant, $d \in [D]$.

\smallskip
$\bullet$ ${\sf Reconstruct}_{D'}(s_1,\ldots,s_D)$. The procedure is given any selection of $D'$ shares out of $\{ s_1,\ldots,s_D \}$; it then interpolates a polynomial $g(\cdot)$ of degree at most $D'-1$ using the given points, and outputs $s=g(0)$.
Clearly, any selection of $D'$ shares out of the $D$ shares
will yield the same polynomial $g(\cdot)$ that was used to generate the shares, as $D'$ point values determine a unique polynomial of degree at most $D'-1$. Hence, any selection of $D'$ shares will issue the secret $s$.
On the other hand, any selection of $D'-1$ shares reveals nothing about the secret $s$.

\bigskip
Our protocol involves a set of third parties, $\{T_1,\ldots,T_D\}$, which are called {\em talliers}.
In the protocol, each voter creates shares of his private ballot and distributes them to the $D$ talliers.
As those ballots are matrices (see the definitions in Section \ref{semihonest}),
the secret sharing is
carried out for each entry independently, so that each of the talliers receives a share matrix in each ballot matrix.
The talliers then verify the legality of the cast ballots and, at the end the election period, compute the desired election results. Those computations are executed based only on the shares that the talliers had received, i.e., without actually recovering the private ballots. Such a computation, that depends on secret inputs that cannot be disclosed, is called {\em secure multiparty computation}; we elaborate on that topic in Section \ref{mpc} below.

We will use Shamir's $D'$-out-of-$D$ secret sharing with $D' := \lfloor (D+1)/2 \rfloor$ (namely, the value $(D+1)/2$ rounded down to the nearest integer).
With that setting, at least half of the talliers would need to collude in order to recover the secret ballots. If the set of the talliers is trusted to have an {\em honest majority}, then such a betrayal scenario is impossible. Namely, if more than half of the talliers are honest, in the sense that they would not attempt cheating, then even if all other dishonest talliers attempt to recover the secret ballots from the shares that they hold, they will not be able to extract any information on the ballots. The secret sharing mechanism prevents such unauthorized subsets from inferring any information on the shared secrets from the shares that they hold.

Higher values of $D$ (and consequently of
$D' := \lfloor (D+1)/2 \rfloor$)
will imply greater security against coalitions of corrupted talliers, but at the same time they will also imply
higher costs.

\subsection{Secure multiparty computation}\label{mpc}
As described above, the talliers hold shares in the voters' ballots and perform computations on those shares. First, they need to verify that the shares for each cast ballot correspond to a legal ballot
(see Section \ref{legal} where we explain what constitutes a legal ballot).
Then, they need to compute the identity of the $K$ winning candidates, as dictated by the rule. Those two tasks would be easy if the talliers could use their shares in order to recover the ballots. However, they must not do so, in order to protect the voters' privacy. Instead, they must perform those computations on the distributed shares,
without revealing the shares to each other.
As shown in Section \ref{semihonest}, both of those computations boil down to arithmetic computations only (namely, to computations of additions and multiplications of secret-shared values).

To do so, the talliers execute sub-protocols of secure multiparty computation (MPC) ~\cite{yao}.
An MPC protocol allows a set of parties, $T_1,\ldots,T_D$, to compute any function $f$ over private inputs that they hold, $x_1,\ldots,x_D$, where $x_d$ is known only to $T_d$, $d \in [D]$, so that at the end of the protocol everyone learns $f(x_1,\ldots,x_D)$, but nothing
beyond that value and what can be naturally inferred from it.
In cases where the desired function $f$ may be expressed as an arithmetic function of the inputs, then one may represent $f$ by an arithmetic circuit $C$ such that for every set of inputs, $x_1,\ldots,x_D$, the output of the circuit, $C(x_1,\ldots,x_D)$, equals $f(x_1,\ldots,x_D)$.

The circuit has several input wires and a single output wire. Each input wire is fed with a single secret value by one of the parties. The output wire determines a single value that is revealed to all parties.
Between the input and output wires there are multiple layers of arithmetic gates that connect them.
An arithmetic gate can be either addition or multiplication.
Each gate is fed by exactly two input wires, and it produces one output wire such that the output of a gate in layer
$k$ can be given as input to multiple gates in layer $k+1$.
For illustration, consider the arithmetic function $f(x_1,x_2,x_3)=x_1\cdot x_2+x_2\cdot x_3 \cdot (x_2+x_3)$. The circuit $C$ in Figure \ref{circuit} evaluates that function. It consists of three layers.
The first layer has two multiplication gates that compute $x_1\cdot x_2$ and $x_2\cdot x_3$, and one addition gate that computes $x_2+x_3$. The second layer has a single multiplication gate for computing $x_2\cdot x_3 \cdot (x_2+x_3)$. Finally, the third and last layer has a single addition gate that issues the desired output.

\begin{figure*

    \begin{center}
    \includegraphics[scale=0.4]{circuit.png}
    \caption{An arithmetic circuit $C$ that realizes the function $f(x_1,x_2,x_3)=x_1\cdot x_2+x_2\cdot x_3 \cdot (x_2+x_3)$.}
    \label{circuit}
    \end{center}
\end{figure*}

In a secret-sharing-based MPC protocol, all values along all wires are secret shared among the $D$ parties (as described in Section \ref{ssharing}); in particular, they are never reconstructed and thus remain secret. Only the value on the final output wire is reconstructed: when reaching the output gate, each party broadcasts the corresponding share
that he\footnote{For the sake of simplicity, we keep referring to parties by the pronoun ``he''. In our context, those parties may be voters, who are humans of any gender, or talliers, that are typically (genderless) servers.} holds in the output wire, and subsequently everyone can use the broadcast shares in order to reconstruct the
output.

The computational challenge in this context is how to emulate the operation of an arithmetic circuit when operating on shared values. As an arithmetic circuit consists of two types of gates -- addition and multiplication, the challenge is as follows: given $D'$-out-of-$D$ shares in two secret values $u,v \in {\bf Z}_p$, how can the parties compute $D'$-out-of-$D$
shares
in $u+v$ and in $u \cdot v$, without reconstructing any of those values.
In the circuit shown in Figure \ref{circuit}, the parties have $D'$-out-of-$D$ shares in each of the input values $x_1,x_2,x_3$. With those shares they proceed to emulate the circuit layer by layer, by computing proper
$D'$-out-of-$D$ shares in the output wires of the three gates in the first layer, then proceeding to computing $D'$-out-of-$D$ shares in the output of the multiplication gate in the second layer, using the already computed shares in the output wires of two of the gates in the first layer, and finally computing $D'$-out-of-$D$ shares in the output wire using the computed shares in the output wires of the multiplication gate in the second layer and the first multiplication gate in the first layer.

Let $u_d$ and $v_d$ denote the shares held by $T_d$, $d \in [D]$, in the two input values $u$ and $v$, respectively.
Emulating addition gates is easy: the linearity of secret sharing implies that for any two public field elements $a,b \in {\bf Z}_p$, the values $au_d+bv_d$, $d \in [D]$, are proper $D'$-out-of-$D$ shares in $au+bv$. In particular, each party may compute his share in the output wire from his shares in the input wires without any interaction with the other parties.

Emulating multiplication gates is trickier. Here, in order to compute proper $D'$-out-of-$D$ shares in the output wire $u\cdot v$, the parties need to interact, and the required computation is more involved.
In our protocol we use the construction proposed by Damg{\aa}rd and Nielsen
\cite{DN07}, enhanced by a work by Chida et al.~\cite{ChidaGHIKLN18} that demonstrates some performance optimizations. The details of this computation are not essential for understanding our secure voting protocol, but for the sake of completeness we describe the computation in Appendix \ref{multip}.

\subsection{Secure Comparison}\label{secure_comparison}
When computing election results, it is essential to repeatedly compare scores of two candidates in order to determine which is larger.
In our protocol, those scores are kept hidden from all parties, but
the talliers hold secret shares in them.
Of course, the talliers could use those shares in order to recover the scores and then compare them. However, for the sake of achieving perfect ballot secrecy, our goal is to determine which of two given scores
is larger without explicitly recovering those scores. To that end, we consider the problem of secure comparison, which is defined below.

Assume that the $D$ parties, $T_1,\ldots,T_D$, hold $D'$-out-of-$D$ shares in two integers $a$ and $b$, where both $a$ and $b$ are smaller than $p$, which is the size of the underlying field ${\bf Z}_p$. The parties wish to compute
$D'$-out-of-$D$ secret shares in the binary variable, denoted $1_{a<b}$, which equals 1 if $a<b$ and 0 otherwise\footnote{Hereinafter,
for any predicate $\Pi$, we let $1_{ \Pi }$ denote the binary variable that equals 1 if and only if the predicate $\Pi$ holds.}, without learning any other information on $a$ and $b$.
A protocol that does that is called {\em secure comparison}.

Nishide and Ohta~\cite{NO07} presented a method for secure comparison that is based on the following simple observation.
Let us denote the bits (i.e., binary variables) $1_{a<\frac{p}{2}}$, $1_{b<\frac{p}{2}}$, $1_{[(a-b) \mod p ]< \frac{p}{2}}$, and $1_{a<b}$ by $w$, $x$, $y$, $z$, respectively.
Then
\begin{equation}\label{indirect_comparison}
z = w\bar{x}\lor \bar{w}\bar{x}\bar{y}\lor wx\bar{y} \,.
\end{equation}
The equality in Eq. (\ref{indirect_comparison}) can be confirmed by the
truth table in Table \ref{tab:indirect-compare}.
\begin{table}[h!]
\centering
\begin{tabular}{|c|c|c|c|}
\hline
{$w=1_{a<\frac{p}{2}}$} & {$x=1_{b<\frac{p}{2}}$} & {$y=1_{[(a-b) \mod p ]< \frac{p}{2}}$} &
{$z=1_{a<b}$} \\ \hline
T & F & * & T \\ \hline
F & T & * & F \\ \hline
F & F & F & T \\ \hline
F & F & T & F \\ \hline
T & T & F & T \\ \hline
T & T & T & F \\ \hline
\end{tabular}
\caption{Truth table for indirectly comparing $a$ and $b$ using Eq. (\ref{indirect_comparison}).}
\label{tab:indirect-compare}
\end{table}

Next, we translate the Boolean expression in Eq. (\ref{indirect_comparison}) to an equivalent arithmetic expression:
\begin{equation}\label{comparison_arithmetic}
\begin{aligned}
z & = w(1-x)+(1-w)(1-x)(1-y)+wx(1-y) \\
  & = 1-x-y+xy+w(x+y-2xy)\,.
\end{aligned}
\end{equation}

Hence, we reduced the problem of comparing two secret shared values, $a$ and $b$, to computing three other comparison bits --- $w,x,y$, and then evaluating an arithmetic function of them, Eq. (\ref{comparison_arithmetic}). What makes this alternative expression efficiently computable is the fact that in the three comparison bits,
$w=1_{a<\frac{p}{2}}$, $x=1_{b<\frac{p}{2}}$, and $y=1_{[(a-b) \mod p ]< \frac{p}{2}}$, the right-hand side is $\frac{p}{2}$, as we proceed to explain.

\begin{lemma}\label{lemma2q}
Given a finite field ${\bf Z}_p$ and a field element $q \in {\bf Z}_p$, then $q < \frac{p}{2}$ if and only if the least significant bit (LSB) of ($2q$ mod $p$) is zero.
\end{lemma}

\begin{proof}
If $q < \frac{p}{2}$ then $2q<p$. Hence, $2q$ mod $p = 2q$ (there is no modular reduction) and therefore, as $2q$ is even, its LSB is 0.
On the other hand, if $q > \frac{p}{2}$ then $2q>p$. Hence, $2q$ mod $p = 2q-p$. Since that number is odd, its LSB is 1.
\end{proof}

In view of Lemma \ref{lemma2q}, the parties may compute $D'$-out-of-$D$ shares in
$w=1_{a < \frac{p}{2}}$ (and similarly for $x=1_{b<\frac{p}{2}}$, and $y=1_{[(a-b) \mod p ]< \frac{p}{2}}$) as follows: each party $T_d$ will translate the share he holds in $a$ to a share in $2a$ by multiplying the share by 2; then, all parties will use their shares in $2a$ in order to compute shares in the LSB of $2a$.
The reader is referred to Nishide and Ohta ~\cite{NO07} for the details of that last step in the computation.

We conclude this section by commenting on the complexity of the above described secure comparison protocol.
Computing shares in the LSB of a shared value requires $13$ rounds of communication and $93\ell+1$ multiplications, where hereinafter $\ell=\log_2(p)$.
Since we have to compute three such bits (i.e., $w$, $x$, and $y$) then we can compute shares of those three bits in 13 rounds and a total of
$279 \ell+3$ multiplications.
Finally, we should evaluate the expression in Eq. (\ref{comparison_arithmetic}), which entails two additional rounds and two additional multiplications. Hence, the total complexity is $15$ rounds and $ 279\ell+5$ multiplications.

\subsection{Secure testing of positivity}\label{positivity}
Let $x$ be an integer in the range $[-N,N]$.
Assume that $T_1,\ldots,T_D$ hold $D'$-out-of-$D$ shares in $x$, where the underlying field is ${\bf Z}_p$, and $p>2N$. Our goal here is to design an MPC protocol that will issue to $T_1,\ldots,T_D$ $D'$-out-of-$D$ shares in the bit $1_{x>0}$, without learning any further information on $x$.

One way of solving such a problem would be to
set $y=x+N$ and then test whether $N<y$ using the protocol of secure comparison that we described in Section \ref{secure_comparison} (with $a=N$ and $b=y$). In order to execute the secure comparison protocol, the parties need to have secret shares in the two compared values.
It is easy to see that
$\{N,\ldots,N\}$
are $D'$-out-of-$D$ shares in $a=N$.
In addition, if we denote by $\{x_1,\ldots,x_D\}$ the $D'$-out-of-$D$ shares in $x$, then
$\{x_1+N,\ldots,x_D+N\}$ are $D'$-out-of-$D$ shares in $b=y$.

However, we would like to propose here a more efficient way of solving the problem of positivity testing. To that end we state and prove the following lemma.

\begin{lemma}\label{lemmapositiv}
Under the above assumptions, $x>0$ if and only if the LSB of $(-2x \mod p)$ is 1.
\end{lemma}

\begin{proof}
Recall that $x \in [-N,N]$ and $N< \frac{p}{2}$.
Assume that $x>0$, namely, that $x \in (0,N]$. Hence, $-2x \in [-2N,0)$. Therefore, as $2N<p$, $(-2x \mod p) = -2x+p $. As that number is odd, its LSB is 1.
If, on the other hand, $x \leq 0$, then $x \in [-N,0]$.
Hence, $-2x \in [0,2N] \subset [0,p-1]$. Therefore, $(-2x \mod p) = -2x $. As that number is even, its LSB is 0.
\end{proof}

Hence, while the secure comparison of two secret values required computing the LSB of three values, testing the positivity of a secret requires the computation of an LSB of just one value. Hence, the computational cost of that task is $13$ rounds of communication and $93\ell+1$ multiplications (as opposed to
$15$ rounds and $ 279\ell+5$ multiplications for secure comparison of two secrets).

\subsection{Secure testing of equality to zero}\label{is-zero}
Let $x$ be an integer in the range $[-N,N]$.
Assume that $T_1,\ldots,T_D$ hold $D'$-out-of-$D$ shares in $x$, where the underlying field is ${\bf Z}_p$, and $p>2N$.
Our goal here is to design an MPC protocol that will issue to $T_1,\ldots,T_D$ $D'$-out-of-$D$ shares in the bit $1_{x=0}$, without learning any further information on $x$.
It is possible to solve that problem by implementing the MPC positivity testing that we described above in Section \ref{positivity}, once for $x$ and once for $-x$. Clearly, $x=0$ if and only if both of those tests fail. However, we can solve that problem in a much more efficient manner, as we proceed to describe.

Fermat's little theorem states that if $x \in {\bf Z}_p \setminus \{0\}$ then $x^{p-1}=1$ mod $p$. Hence, $ 1_{x\neq 0} = \left( x^{p-1} \mod p \right)$. Therefore, shares in the bit $ 1_{x\neq 0}$ can be obtained by simply computing $x^{p-1}$ mod $p$. The latter computation can be carried out by the square-and-multiply algorithm with up to $2\ell$ consecutive multiplications, where, as before, $\ell =  \log p$.
Finally, as $1_{x = 0} = 1 -1_{ x \neq 0}$, then shares in $1_{ x \neq 0}$ can be readily translated into shares in $1_{x=0}$. The cost of the above described computation is significantly smaller than the cost of the alternative approach that performs positivity testing of both $x$ and $-x$.

\section{A secure order based voting protocol}\label{semihonest}
In this section we describe our method for securely computing the winners in two order-based voting rules, {\sc Copeland} and {\sc Maximin}.\footnote{Our protocols are designed for scenarios in which it is required to issue just the identity of the winners. In scenarios where more information is needed, such as a ranking of all candidates, or even a score for each candidate, our protocols can easily output also that additional information.}
We begin with formal definitions in Section \ref{formaldef}.
Then, in Section \ref{legal}, we characterize legal ballot matrices for each of the two rules. Such a characterization is an essential part of our method, since the talliers need to verify, in an oblivious manner, that each cast ballot is indeed legal, and does not hide a malicious attempt
to cheat or to sabotage the elections. In other words, the talliers need to verify the legality of each cast ballot only through its secret shares, i.e., without getting access to the actual ballot. The characterization that we describe in Section \ref{legal} will be used later on to perform such an oblivious validation.

Then,
in Section \ref{sec11} we introduce our secure voting protocol.
That protocol description includes a sub-protocol for
validating the cast ballots, and sub-protocols for computing the final election results from all legal ballots.
The validation sub-protocol is described in Section \ref{validating}.
The sub-protocols for computing the election results are described in Sections \ref{seccop} and \ref{secmax} for {\sc Copeland} and {\sc Maximin} rules, respectively.

We conclude this section with a discussion on how to set the size of the underlying field in which all computations take place (Section \ref{ppp}), and a discussion of
the overall security of our protocol (Section \ref{overallsecurity}).

\subsection{Formal definitions}\label{formaldef}
We consider a setting in which there are $N$ voters, $\mbox{\bf V}=\{V_1,\ldots,V_N\}$, that wish to hold an election over $M$ candidates, $\mbox{\bf C} = \{C_1,\ldots,C_M\}$.
The output of the election is a ranking of $\mbox{\bf C}$.
We proceed to define the two order-based rules for which we devise a secure MPC protocol in this section.

$\bullet$ {\sc Copeland.}
Define for each $V_n$ a matrix
$ P_n = (P_n(m,m'): m,m' \in [M])$,
where $P_n(m,m')=1$ if $C_m$ is ranked higher than $C_{m'}$ in $V_n$'s
ranking,
$P_n(m,m')=-1$ if $C_m$ is ranked lower than $C_{m'}$, and all diagonal entries are 0.
Then the sum matrix,
\begin{equation} P = \sum_{n=1}^N P_n \,, \label{pdef}\end{equation}
induces the following score for each candidate:
\begin{equation}
\begin{split}
\mbox{\bf w}(m) := |\{ m' \neq m : P(m,m')> 0\}| + \\
\alpha |\{ m' \neq m: P(m,m')= 0 \}|\,.\label{copeland}
\end{split}
\end{equation}
Namely, $\mbox{\bf w}(m)$ equals the number of candidates $C_{m'}$ that a majority of the voters ranked lower than $C_m$, plus $\alpha$ times
the number of candidates $C_{m'} $ who broke even with $C_m$.
The parameter $\alpha$ can be set to any rational number between 0 and 1. The most common setting is $\alpha = \frac{1}{2}$; the {\sc Copeland} rule with this setting of $\alpha$ is known as {\sc Copeland}$^\frac{1}{2}$ ~\cite{faliszewski2009llull}.

\smallskip
$\bullet$ {\sc Maximin.}
Define the matrices $P_n$ so that $P_n(m,m')=1$ if $C_m$ is ranked higher than $C_{m'}$ in $V_n$'s ranking,
while $P_n(m,m')=0$ otherwise.
As in {\sc Copeland} rule, we let $ P$ denote the sum of all ballot matrices, see Eq. (\ref{pdef}). Then  $P(m,m')$ is the number of voters who preferred $C_m$ over $C_{m'}$.
The final score of $C_m$, $m \in [M]$, is then set to
$ \mbox{\bf w}(m):=\min_{m' \neq m} P(m,m') $.

In both these order-based rules, we shall refer hereinafter to the matrix $P_n$ as $V_n$'s {\em ballot matrix}, and to $P$ as the aggregated ballot matrix.

\subsection{Characterization of legal ballot matrices in the {\sc Copeland} and {\sc Maximin} rules}\label{legal}

Here, we characterize the ballot matrices in each of the two order-based rules that we consider. Such a characterization will be used later on in the secure voting protocol.

\begin{theorem}\label{thm1}
An $M \times M$ matrix $Q$ is a valid ballot under the {\sc Copeland} rule if and only if it satisfies the following conditions:
\begin{enumerate}
    \item $Q(m,m') \in \{-1,1\}$ for all $1 \leq m < m' \leq M$;
    \item $Q(m,m)=0$ for all $m \in [M]$;
    \item $Q(m',m)+Q(m,m')=0$ for all $1 \leq m < m' \leq M$;
    \item The set $\{Q_m: m \in [M]\}$, where $Q_m:=\sum_{m' \in [M]} Q(m',m)$, consists of $M$ distinct values.
\end{enumerate}
\end{theorem}

\noindent
The proof of Theorem \ref{thm1} is given in Appendix
\ref{proofs}.

\begin{theorem}\label{thm2}
An $M \times M$ matrix $Q$ is a valid ballot under the {\sc Maximin} rule if and only if it satisfies the following conditions:
\begin{enumerate}
    \item $Q(m,m') \in \{0,1\}$ for all $1 \leq m < m' \leq M$;
    \item $Q(m,m)=0$ for all $m \in [M]$;
    \item $Q(m',m)+Q(m,m')=1$ for all $1 \leq m < m' \leq M$;
    \item The set $\{Q_m: m \in [M]\}$, where $Q_m:=\sum_{m' \in [M]} Q(m',m)$, consists of $M$ distinct values.
\end{enumerate}
\end{theorem}

\noindent
The proof of Theorem \ref{thm2} is similar to that of Theorem \ref{thm1} and thus omitted.

We conclude this section with the following observation. Let us define a projection mapping $\Gamma:{\bf Z}_p^{M \times M} \mapsto {\bf Z}_p^{M(M-1)/2}$, which takes an $M \times M$ matrix $Q \in {\bf Z}_p^{M \times M}$ and outputs its upper triangle,
$$ \Gamma(Q):=(Q(m,m'): 1 \leq m < m' \leq M) \,.$$
Conditions 2 and 3 in Theorems \ref{thm1} and \ref{thm2} imply that every ballot matrix, $P_n$, is fully determined by its upper triangle, $\Gamma(P_n)$, in either of the two voting rules that we consider.

 \subsection{A secure voting protocol}\label{sec11}
Here we present Protocol \ref{algvote}, a privacy-preserving implementation of
the {\sc Copeland} and {\sc Maximin} order-based rules.
The protocol computes, in a privacy-preserving manner, the winners in elections that are governed by those rules.
It has two phases. We begin with a bird's-eye view of those two phases, and afterwards we provide a more detailed explanation.

Phase 1 (Lines 1-8) is the voting phase. In that phase, each voter $V_n$, $n \in [N]:=\{1,\ldots,N\}$, constructs his ballot matrix, $P_n$ (Line 2), and then creates and distributes to all talliers corresponding $D'$-out-of-$D$ shares, with $D'=\lfloor (D+1)/2 \rfloor$,
as described in Section \ref{ssharing} (Lines 3-7).
Following that, the talliers jointly verify the legality of the shared ballot (Line 8).
Phase 2 of the protocol (Lines 9-11) is carried out after the voting phase had ended; in that phase, the talliers perform an MPC sub-protocol on the distributed shares in order to find
the winning candidates, while remaining oblivious to the actual ballots.

After constructing his ballot matrix in Line 2, voter $V_n$, $n \in [N]$, samples a random share-generating polynomial of degree $D'-1$ for each of the $M(M-1)/2$ entries in $\Gamma(P_n)$, where $\Gamma$ is the projection mapping defined in Section \ref{legal} (Lines 3-5). Then, $V_n$ sends each tallier $T_d$ his relevant share in each of those entries, namely, the value of the corresponding share-generating polynomial at $x=d$,
$d \in [D]$ (Lines 6-7).

In Line 8, the talliers engage in an MPC sub-protocol to verify the legality of $V_n$'s ballot, without actually recovering that ballot.
We describe the validation sub-protocol in Section \ref{validating}. Ballots that are found to be illegal are discarded. (In such cases it is possible to notify the voter that his ballot was rejected and allow him to resubmit it.)

Phase 2 (Lines 9-11) takes place at the end of the voting period,
after the voters cast their
ballots.
First (Lines 9-10), each of the talliers, $T_d$, $d \in [D]$, computes his $D'$-out-of-$D$ share, denoted $G_d(m,m')$, in the $(m,m')$th entry of the aggregated ballot matrix $P$, see Eq. (\ref{pdef}), for all $1 \leq m<m' \leq M$. This computation follows from the linearity of the secret sharing scheme. Indeed, as
$g_{n,m,m'}(d)$ is $T_d$'s share in $P_n(m,m')$ in a $D'$-out-of-$D$ Shamir's secret sharing, then
$G_d(m,m') = \sum_{n \in [N]} g_{n,m,m'}(d)$ is a
$D'$-out-of-$D$ Shamir's secret share in $P(m,m') = \sum_{n \in [N]} P_n(m,m')$.

The heart of the protocol is in Line 11: here, the talliers engage in an MPC
sub-protocol in order to find the indices of the $K$ winning candidates.
How can the talliers do that when none of them actually holds
the matrix $P$? We devote our discussion in Sections \ref{seccop} and \ref{secmax} to that interesting computational challenge.

\SetAlgorithmName{Protocol}{}{}
\begin{algorithm}[htb]
\SetAlgoLined
\DontPrintSemicolon
    \SetKwInput{Input}{Input}
    \Input{A set of $M$ candidates $\mbox{\bf C}$; $K \in [M]$; a set of voters $\mbox{\bf V}$.}
\ForAll{$V_n$, $n \in [N],$}{
Construct the ballot matrix, $P_n$, according to the selected indexing of candidates and the voting rule;

\ForAll{$1 \leq m < m' \leq M$}{
Select uniformly at random $a_{n,m,m',j} \in {\bf Z}_p$, $1 \leq j \leq D'-1$;

Set $g_{n,m,m'}(x) = P_n(m,m') + \sum_{j=1}^{D'-1}
a_{n,m,m',j}x^j$;
}
\ForAll{$d\in [D]$}{
Send to $T_d$ the set $\{n,m,m',g_{n,m,m'}(d): 1 \leq m<m' \leq M\}$;
}
After all talliers receive their shares in $V_n$'s ballot, they engage in an MPC sub-protocol to check its legality;
}
\ForAll{$T_d$, $d \in [D]$}{
Set $G_d(m,m') = \sum_{n \in [N]} g_{n,m,m'}(d)$, for all $1 \leq m<m' \leq M$;
}
$T_1,\ldots,T_D$ find the indices of the $K$ winners and publish them;

\SetKwInOut{Output}{Output}
    \Output{The $K$ winning candidates from $\mbox{\bf C}$.}
\caption{A basic protocol for secure order-based voting}
\label{algvote}
\end{algorithm}

\subsection{Verifying the legality of the cast ballots}\label{validating}
Voters may attempt to cheat by submitting illegal ballots in order to help their preferred candidate.
For example, a dishonest voter may send the talliers shares of the matrix $cQ$,
where $Q$ is his true ballot matrix and $c$ is an ``inflating factor" greater than 1.
If such a cheating attempt remains undetected, that voter manages to multiply his vote by a factor of $c$. The shares of the illegal ``inflated" matrix are indistinguishable from the shares of the legal
ballot matrix (unless, of course, a majority of $D'$ talliers collude and recover the ballot --- a scenario that is impossible under our assumption that the talliers have an honest majority).
Hence, it is necessary to devise a mechanism that would enable the talliers to check that the shares they received from each of the voters correspond to a legal ballot matrix, without actually recovering that matrix.

Malicious voters can sabotage the elections also in other manners. For example, a voter may create a legal ballot matrix $Q$ and then alter the sign of some of the $\pm 1$ entries in the shared upper triangle $\Gamma(Q)$, so that the resulting matrix does no longer correspond to an ordering of the candidates.
Even though such a manipulated
matrix cannot serve a dishonest voter in an attempt to help a specific candidate, it still must be detected and discarded. Failing to detect the illegality of such a ballot may result in an aggregated matrix $P$ that
differs from the aggregated matrix $P'$ that corresponds to the case in which that ballot is rejected. In such an unfortunate case, it is possible that the set of winners that $P$ would dictate differs from that which $P'$ dictates. In summary, it is essential to validate each of the cast ballots in order to prevent any
undesirable sabotaging of the elections.

In real-life
electronic elections where voters typically cast their ballots on certified computers in voting centers, the chances of hacking such computers and tampering with the software that they run are small. However, for full-proof security and as a countermeasure against dishonest voters that might manage to hack the voting system, we proceed to describe an MPC solution
that enables the talliers to verify the legality of each ballot, even though those ballots remain hidden from them.
We note that in case a ballot is found to be illegal, the talliers may reconstruct it (by means of interpolation from the shares of $D'$ talliers) and use the recovered ballot as a proof of the voter's dishonesty.
The ability of constructing such proofs, that could be used in legal actions against dishonest voters, might deter voters from attempting cheating
in the first place.

We proceed to explain how the talliers can verify the legality of the cast ballots in each of the two order-based rules. That validation is based on the characterizations of legal ballots as provided in Theorems \ref{thm1} and \ref{thm2} for {\sc Copeland} and {\sc Maximin}, respectively. Note that the talliers need only to verify conditions 1 and 4;
condition 2 needs no verification since the voters do not distribute shares in the diagonal entries, as those entries are known to be zero; and condition 3 needs no verification since the voters distribute shares only in the upper triangle and then the talliers use condition 3 in order to infer the lower triangle from the shared upper triangle.

\subsubsection{Verifying condition 1}\label{vercond1}
Consider the shares that a voter distributed in $\Gamma(Q)$, where $Q$ is his ballot matrix.
The talliers need to verify that each entry in the shared $\Gamma(Q)$
is either $1$ or $-1$ in {\sc Copeland}, or either $1$ or $0$ in {\sc Maximin}.
The verification is performed independently on each of the $M(M-1)/2$ entries of the shared upper triangle. A shared scalar $x$ is in $\{-1,1\}$ (resp. in $\{0,1\}$) if and only if $(x+1)\cdot (x-1)=0$ (resp. $x\cdot (x-1)=0$).
Hence, the talliers input their shares in $x$ to an arithmetic circuit that outputs the product $(x+1)\cdot (x-1)$ for {\sc Copeland} or
$x \cdot (x-1)$ for {\sc Maximin}.
If the output of such a circuit is zero for each of the $M(M-1)/2$ entries of
$\Gamma(Q)$,
then $\Gamma(Q)$ satisfies condition 1 in Theorem \ref{thm1}
({\sc Copeland}) or in Theorem \ref{thm2} ({\sc Maximin}).
If, on the other hand, some of the multiplication gates issue a nonzero output, then the ballot will be rejected.

\subsubsection{Verifying condition 4}
First, we make the following observation. Let $x,y \in {\bf Z}_p$ be two values that are shared among the talliers. Denote by $x_d$ and $y_d$ the $D'$-out-of-$D$ shares that $T_d$ has in $x$ and $y$, respectively.
Then if $a,b \in {\bf Z}_p$ are two publicly known field elements,
it is easy to see that $ax_d+by_d$ is a proper $D'$-out-of-$D$ share in $ax+by$, $d \in [D]$.
Also $a+x_d$ is a proper $D'$-out-of-$D$ share in $a+x$.

Using the above observation regarding the linearity of secret sharing, then once the talliers receive $D'$-out-of-$D$ shares in each entry in $\Gamma(Q)$, they can proceed to compute
$D'$-out-of-$D$ shares in the corresponding
column sums,
$Q_m$, $m \in [M]$, as we proceed to show.

In {\sc Copeland},
conditions 2 and 3 in Theorem \ref{thm1} imply that
\begin{equation} Q_m = \sum_{m' \in [M]} Q(m',m) = \sum_{m' <m} Q(m',m) -
\sum_{m<m'} Q(m,m') \,. \label{qmcop}\end{equation}
Since the talliers hold shares in $Q(m',m)$ for all $1 \leq m'<m \leq M$, they can use Eq. (\ref{qmcop}) and the linearity of secret sharing to compute shares in $Q_m$, $m \in [M]$.
In {\sc Maximin}, on the other hand, conditions 2 and 3 in Theorem \ref{thm2}
imply that
\begin{equation} Q_m =  \sum_{m' <m} Q(m',m) -
\sum_{m<m'} Q(m,m') + (M-m)\,. \label{qmmax}\end{equation}
Here too, the linearity of sharing
and the relation in Eq. (\ref{qmmax}) enable the talliers to compute shares in $Q_m$, $m \in [M]$, also in the case of {\sc Maximin}.

Now, it is necessary to verify that all $M$ values $Q_m$, $m \in [M]$,
are distinct. That condition can be verified by computing the product
\begin{equation} F(Q):=\prod_{1 \leq m'<m \leq M} (Q_m - Q_{m'}) \,. \label{prodq}\end{equation}
Condition 4, in both rules, holds if and only if $F(Q) \neq 0$.
Hence, the talliers, who hold shares in $Q_m$, $m \in [M]$, may compute $F(Q)$ and then accept the ballot if and only if $F(Q) \neq 0$.

\subsubsection{Privacy}\label{privacy}
A natural question that arises is whether the above described validation process poses a risk to the privacy of the voters.
In other words, a voter that casts a legal ballot wants to be ascertained that the validation process only reveals that the ballot is legal, while all other information is kept hidden from the talliers. We proceed to examine that question.

The procedure for verifying condition 1 in Theorems \ref{thm1} and \ref{thm2} offers perfect privacy for honest voters.
If the ballot $Q$ is legal then all multiplication gates will issue a zero output. Hence, apart from the legality of the ballot, the talliers will not learn anything on the content of the ballot.

The procedure for verifying condition 4
in Theorems \ref{thm1} and \ref{thm2}
offers {\em almost} perfect privacy, in the following sense.
If $Q$ is a valid ballot in {\sc Copeland}, then the ordered tuple
$(Q_1,\ldots,Q_M)$ is a permutation of
the ordered tuple
$(-M+1,-M+3,\ldots, M-3,M-1)$. This statement follows from the proof of condition 4 in Theorem \ref{thm1}, see Appendix \ref{proofs}.
Hence, as can be readily verified,
if $Q$ is a legal ballot then
the value of $F(Q)$, Eq. (\ref{prodq}), which the talliers compute in the validation procedure, equals
\begin{equation} F(Q)= \pm 2^{\binom{M}{2}} \cdot \prod_{1 \leq m'<m \leq M} (m - m')\,, \label{prodq1}\end{equation}
where the sign of the product in Eq. (\ref{prodq1})
is determined by the signature of $(Q_1,\ldots,Q_M)$ when viewed as a permutation of
the ordered tuple
$(-M+1,-M+3,\ldots, M-3,M-1)$.
Hence, since a ballot in {\sc Copeland} describes some ordering (permutation) of the candidates, the talliers will be able to infer the signature of that permutation, but nothing beyond that.
Such a leakage of information is meaningless, but it can be eliminated by squaring the result and recovering $F(Q)^2$.

Similarly, the procedure for verifying condition 4 in Theorem \ref{thm2}, for {\sc Maximin}, is also privacy-preserving in the same manner. Indeed, in the case of {\sc Maximin},
$(Q_1,\ldots,Q_M)$ is a permutation of
the ordered tuple
$(0,1,\ldots,M-2,M-1)$,
and, therefore,
$$ F(Q)= \pm  \prod_{1 \leq m'<m \leq M} (m - m')\,, $$
where the sign of the above product
is determined by the signature of $(Q_1,\ldots,Q_M)$
as a permutation of
$(0,1,\ldots,M-2,M-1)$.

\subsubsection{Computational cost}\label{cost}
Verifying condition 1 can be performed in parallel for all $M(M-1)/2$ entries in a given ballot, and also for several different ballots. Hence, in order to perform a batch validation of $B$ ballots, the talliers need to compute $BM(M-1)/2$ simultaneous multiplication gates.

The verification of condition 4 over a single ballot requires performing a sequence of
$M(M-1)/2$ multiplications.
Hence, in order to perform a batch validation of $B$ ballots, the talliers need to go through $M(M-1)/2$ rounds, where in each round they compute $B$ simultaneous multiplication gates.

\subsection{An MPC computation of the winners in the {\sc Copeland} rule}\label{seccop}
The parameter $\alpha$ in Eq. (\ref{copeland}) is always a rational number; typical settings of $\alpha$ are $0$, $1$, or $\frac{1}{2}$
~\cite{faliszewski2009llull}.
Assume that $\alpha=\frac{s}{t}$ for some integers $s$ and $t$. Then
\begin{equation} t\cdot \mbox{\bf w}(m) = t \cdot \sum_{m' \in [M] \setminus \{m\} } 1_{ P(m,m')>0 } +
s \cdot \sum_{m' \in [M] \setminus \{m\}} 1_{ P(m,m')=0 }\,. \label{tbw}
\end{equation}
The expression in Eq. (\ref{tbw}) involves all entries in $P$ outside the diagonal. However, the talliers hold $D'$-out-of-$D$ shares, denoted $G_d(m,m')$, $d \in [D]$, in $P(m,m')$ only for entries above the diagonal, $1 \leq m < m' \leq M$ (see Lines 9-10 in Protocol \ref{algvote}).
Hence, we first
translate Eq. (\ref{tbw}) into an equivalent expression that involves only entries in $P$ above the diagonal.
Condition 3 in Theorem \ref{thm1}, together with Eq. (\ref{pdef}), imply that
$P(m',m)=-P(m,m')$.
Hence, for all $m'<m$, we can replace $1_{ P(m,m')=0 }$ with $1_{ P(m',m)=0 } $, while
$1_{ P(m,m')>0 }$ can be replaced with
$1_{ -P(m',m)>0 }$. Hence,
\begin{eqnarray} t\cdot \mbox{\bf w}(m) =&t \cdot \left\{ \sum_{m' >m } 1_{ P(m,m')>0 } +
  \sum_{m' <m } 1_{ -P(m',m)>0 } \right\}  \nonumber \\
  ~&
+s \cdot \left\{ \sum_{m' >m } 1_{ P(m,m')=0 } +
 \sum_{m' <m } 1_{ P(m',m)=0 } \right\} \,.&~
 \label{tbw1}
\end{eqnarray}
Eq. (\ref{tbw1}) expresses the score of candidate $C_m$, re-scaled by a factor of $t$, only by entries in $P$ above the diagonal, in which the talliers hold $D'$-out-of-$D$ secret shares.

In view of the above, the talliers may begin by computing secret shares in the bits of positivity in the first sum on the right hand side of Eq. (\ref{tbw1}), by using the MPC sub-protocol described in Section \ref{positivity}. As for the bits of equality to zero in the second sum on the right hand side of Eq. (\ref{tbw1}), the talliers can compute secret shares in them using the
MPC sub-protocol described in Section \ref{is-zero}.
As the value of $t\cdot \mbox{\bf w}(m)$ is a linear combination of those bits, the talliers can then use the secret shares in those bits and Eq. (\ref{tbw1}) in order to get secret shares in $t\cdot \mbox{\bf w}(m)$, for each of the candidates, $C_m$, $m \in [M]$.

Next, they perform secure comparisons among the values $t \mbox{\bf w}(m)$, $m \in [M]$, in order to find the $K$ candidates with the highest scores.
To do that, they need to perform $M-1$ secure comparisons (as described in Section \ref{secure_comparison}) in order to find the candidate with the highest score, $M-2$ additional comparisons to find the next one, and so forth down to $M-K$ comparisons in order to find the $K$th winning candidate. Namely, the overall number of comparisons in this final stage is
$$\sum_{m=M-K}^{M-1}m = K\cdot\left( M-\frac{K+1}{2}\right)\,.$$
The above number is bounded by $M(M-1)/2$ for all $K <M$.
Once this computational task is concluded, the talliers publish the indices of the $K$ winners (Line 11 in Protocol \ref{algvote})).

We summarize the above described computation in Sub-protocol \ref{prot-winners}, which is an implementation of Line 11 in Protocol \ref{algvote}. It assumes that the talliers
hold
$D'$-out-of-$D$ secret shares in $P(m,m')$ for all $1 \leq m<m' \leq M$. Indeed, that computation has already taken place in Lines 9-10 of Protocol \ref{algvote}. Sub-protocol \ref{prot-winners} starts with a computation of $D'$-out-of-$D$ shares in all of the positivity bits and equality to zero bits that relate to the entries above the diagonal in $P$ (Lines 1-4). Then, in Lines 5-7,
the talliers use those shares in order to obtain $D'$-out-of-$D$ shares in $t \cdot \mbox{\bf w}(m)$ for each of the candidates, using Eq. (\ref{tbw1}); the $D'$-out-of-$D$ shares in $t \cdot \mbox{\bf w}(m)$ are denoted $\{w_d(m): d \in [D]\}$. Finally, using the secure comparison sub-protocol, they find the $K$ winners
(Lines 8-10).

\SetAlgorithmName{Sub-Protocol}{}{}
\begin{algorithm}[htb]
\SetAlgoLined
\DontPrintSemicolon
    \SetKwInput{Input}{Input}
    \Input{$T_d$, $d \in [D]$, has $G_d(m,m')$ (a share in $P(m,m')$) for all $1 \leq m<m' \leq M$.}
\ForAll{$1 \leq m < m' \leq M$}{
The talliers apply the positivity sub-protocol to translate $\{G_d(m,m'): d \in [D]\}$ into shares $\{\sigma^+_d(m,m'): d \in [D]\}$ in $1_{P(m,m')>0}$;

The talliers apply the positivity sub-protocol to translate $\{G_d(m,m'): d \in [D]\}$ into shares $\{\sigma^-_d(m,m'): d \in [D]\}$ in $1_{-P(m,m')>0}$;

The talliers apply the equality to zero sub-protocol to translate $\{G_d(m,m'): d \in [D]\}$ into shares $\{\sigma^0_d(m,m'): d \in [D]\}$ in $1_{P(m,m')=0}$;
}
\ForAll{$d \in [D]$}{
\ForAll{$m \in [M]$}{
$T_d$ computes $w_d(m) = t \cdot \left\{ \sum_{m' >m } \sigma^+_d(m,m')
  +\sum_{m' <m } \sigma^-_d(m',m)  \right\}+$  $
s \cdot \left\{ \sum_{m' >m } \sigma^0_d(m,m') +
 \sum_{m' <m } \sigma^0_d(m',m) \right\}
$;
}
}
\ForAll{$k \in [K]:=\{1,\ldots,K\}$}{
The talliers perform $M-k$ invocations of the secure comparison sub-protocol over the $M-k+1$ candidates in $\mbox{\bf C}$ in order to find the $k$th elected candidate;

The talliers output the candidate that was found and remove him from $\mbox{\bf C}$;
}

\SetKwInOut{Output}{Output}
    \Output{The $K$ winning candidates from $\mbox{\bf C}$.}
\caption{Determining the winners in {\sc Copeland} rule}
\label{prot-winners}
\end{algorithm}

\subsubsection{Privacy}\label{priv1}
The talliers hold $D'$-out-of-$D$ shares in each of the ballot matrices, $P_n$, $n \in [N]$,
as well as in the aggregated ballot matrix $P$.
Under our assumption of honest majority, and our setting of $D'= \lfloor (D+1)/2 \rfloor$, the talliers cannot recover any entry in any of the ballot matrices nor in the aggregated ballot matrix.
In computing the final election results, they input the shares that they hold into
the secure comparison sub-protocol, the positivity testing sub-protocol, or the sub-protocol that tests equality to zero (Sections \ref{secure_comparison}--\ref{is-zero}). The secure comparison sub-protocol is perfectly secure, as was shown in ~\cite{NO07}. The positivity testing sub-protocol that we presented here is just an implementation of one component from the secure comparison sub-protocol, hence it is also perfectly secure. Finally, the testing of equality to zero invokes the
arithmetic circuit construction of ~\cite{DN07} and ~\cite{ChidaGHIKLN18}, that was shown there to be secure.
Hence, Sub-protocol \ref{prot-winners} is perfectly secure.

\subsection{An MPC computation of the winners in the {\sc Maximin} rule}\label{secmax}
Fixing $m \in [M]$, the talliers need first to find the index $m' \neq m$ which minimizes $P(m,m')$; once $m'$ is found then
$\mbox{\bf w}(m)=P(m,m')$.
To do that (finding a minimum among $M-1$ values), the talliers need to perform $M-2$ secure comparisons. That means an overall number of $M(M-2)$ secure comparisons for the first stage in the talliers' computation of the final results (namely, the computation of the scores for all candidates under the {\sc Maximin} rule).
The second stage is just like in {\sc Copeland} --- finding the indices of the $K$ candidates with highest $\mbox{\bf w}$ scores.
As analyzed earlier, that task requires an invocation of the secure comparison sub-protocol at most $M(M-1)/2$ times. Namely, the determination of the winners in the case of {\sc Maximin} requires performing the comparison sub-protocol less than $1.5 M^2$ times.

The above described computation maintains the privacy of the voters, as argued in Section \ref{priv1}.

\subsection{A lower bound on the field's size}\label{ppp}
Here we comment on the requirements of our protocol regarding the size $p$ of the underlying field ${\bf Z}_p$.

The prime $p$ should be selected to be greater than the following four values:

(i) $D$, as that is the number of talliers (see Section \ref{ssharing}).

(ii) $2N$, since the field should be large enough to hold the entries of the
    sum $P$ of all ballot matrices,
    Eq. (\ref{pdef}), and the entries of that matrix are confined to the range $[-N,N]$.

(iii) $\max\{t,s\} \cdot (M-1)$, since that is the upper bound on $t \cdot \mbox{\bf w}(m)$, see Eq. (\ref{tbw}), which is secret-shared among the talliers.

(iv) $2(M-1)$, since in validating a given ballot matrix $Q$, the talliers need to test the equality to zero of $F(Q)$, see Eq. (\ref{prodq}). As $F(Q)$ is a product of the differences $Q_m-Q_{m'}$, and each of those differences can be at most $2(M-1)$ (in {\sc Copeland}) or $M-1$ (in {\sc Maximin}), it is necessary to set $p$ to be larger than that maximal value.

Hence, in summary, $p$ should be selected to be larger than each of the above four values. Since $D$ (number of talliers), $M$ (number of candidates), and $s$ and $t$ (the numerator and denominator in the coefficient $\alpha$ in {\sc Copeland} rule, Eq. (\ref{copeland})), are typically much smaller than $N$, number of voters, the essential lower bound on $p$ is $2N$.
In our evaluation we selected $p=2^{31}-1$, which is sufficiently large for any conceivable election scenario.

\subsection{The protocol's security}\label{overallsecurity}
An important goal of secure voting is to provide anonymity; namely, it should be impossible to connect
a ballot to the voter who cast it.
Protocol \ref{algvote} achieves that goal, and beyond.
Indeed, each cast ballot is distributed into $D'$-out-of-$D$ random shares and then each share is designated to a unique
tallier.
Under the {\em honest majority} assumption, the voters' privacy is perfectly preserved. Namely, unless at least $D' \geq D/2$ talliers betray the trust vested in them and collude, the ballots remain secret. Therefore, not only that a ballot cannot be connected to a voter,
even the content of the ballots is never exposed, and not even the aggregated ballot matrix. The only information that anyone learns at the end of Protocol \ref{algvote}'s execution is the final election results. This is a level of privacy that exceeds mere anonymity.

A scenario in which at least half of the talliers collude
is highly improbable, and its probability decreases as $D$ increases.
Ideally, the talliers would be parties that enjoy a high level of trust within the organization or state in which the elections take place, and whose business is based on such trust. Betraying that trust may incur devastating consequences for the talliers. Hence, even if $D$ is set to a low value such as $D=5$ or even $D=3$,
the probability of a privacy breach (namely, that $D'= \lfloor (D+1)/2 \rfloor$ talliers choose to betray the trust vested in them) would be small.

Instead of using a $D'$-out-of-$D$ threshold secret sharing, we could use an additive ``All or Nothing" secret sharing scheme, in which {\bf all} $D$ shares of all $D$ talliers are needed in order to reconstruct the shared secrets, and use suitable MPC protocols for multiplication and comparison. Such an approach would result in higher security, since the privacy of the voters would be jeopardized only if all $D$ talliers betray the trust vested in them and not just $D'$ out of them. However, such a scheme is not robust: if even a single tallier
is attacked or becomes dysfunctional for whatever reason,
then all ballots would be lost. Such a risk is utterly unacceptable in voting systems. Our protocols, on the other hand, can withstand the loss of $D-D'$ talliers.

In view of the above discussion, the tradeoff in setting the number of talliers $D$ is clear: higher values of $D$ provide higher security since more talliers would need to be corrupted in order to breach the system's security. Higher values of $D$ also provide higher robustness, since the system can withstand higher numbers of tallier failures. However, increasing $D$ has its costs: more independent and reputable talliers are needed, and the computational costs of our protocols increase, albeit modestly (see Section \ref{costanalysis}).

We would like to stress that our protocols focus on securing the computation of the election results. Needless to say that those protocols must be integrated into a comprehensive system that takes care of other aspects of voting systems.
For example, it is essential to guarantee that only registered voters can vote, and that each one can vote just once. It is possible to ensure such conditions by standard means. Another requirement is the need to prevent attacks of malicious adversaries. In the context of our protocols, an adversary may eavesdrop on the communication link between some voter $V_n$ and at least $D'$ of the talliers, and intercept the messages that $V_n$ sends to them (in Protocol \ref{algvote}'s Line 7) in order to recover $V_n$'s ballot. That adversary may also replace
$V_n$'s original messages to all $D$ talliers with other messages (say, ones that carry shares of a ballot that reflects the adversary's preferences).
Such attacks can be easily thwarted by requiring each party (a voter or a tallier) to
have a certified public key,
encrypt each message that he sends out using the receiver's public key and then sign it using his own private key;
also, when receiving messages, each party must first verify them using the public key of the sender and then send a suitable
message of confirmation
to the receiver.
Namely, each message that a voter $V_n$ sends to a tallier $T_d$ in Line 7 of Protocol \ref{algvote} should be signed with $V_n$'s private key and then encrypted by $T_d$'s public key; and $T_d$ must acknowledge its receipt and verification.

\section{Evaluation: Computational costs}\label{costanalysis}
Our goal herein is to establish the practicality of our protocol.
Our protocol relies on expensive cryptographic sub-protocols ---
secure comparisons and secure multiplications.
All other operations that the voters and talliers do (random number generation, and standard/non-secure additions and multiplications) have negligible costs in comparison to those of the cryptographic computations.
In this section we provide upper bounds for the overall cost of the cryptographic computations, in various election settings, in order to show that our protocol is viable and can be implemented in practical elections with very light overhead.

\subsection{Parameters}
There are four parameters that
affect the performance of our protocol:

(a) {\bf The size $p$ of the underlying field.} We chose the prime $p=2^{31}-1$ as the size of the underlying field. It is sufficiently large for our purposes, as discussed in Section \ref{ppp}. Moreover, that specific setting of $p$ serves us well also due to another reason. $p=2^{31}-1$
is a Mersenne prime (namely, a prime of the form $2^t-1$ for some integer $t$).
Choosing
such primes is advantageous, from computational point of view, since multiplying two elements in such fields can be done without performing an expensive division (in case the multiplication result exceeds the modulus).

(b) {\bf The number $D$ of talliers.} We set that number to be $D \in \{3,5,7,9\}$, where, as explained in Section \ref{overallsecurity}, larger values of $D$ provide greater security, as well as higher runtimes.

(c) {\bf The number $M$ of candidates.}
Order-based rules require each voter to provide a full ordering of the entire set of candidates.
Pairwise comparisons is a common method for eliciting voter preferences when a full order is required. A sequence of comparative questions in the form of ``Which of the following two candidates do you prefer?" are easier for the voter than a request for a complete order, see ~\cite{david1963method}.
Whether the voters are required to submit a full ranking of the set of $M$ candidates, or they need to compare pairs of candidates (in which case roughly $\log_2(M!)$ questions are needed in order to determine a full ordering of the $M$ candidates), it is clear that such order-based rules are relevant only for a small number of candidates.
In our evaluation we considered $M \in \{5,10,20\}$.

(d) {\bf The number $N$ of voters.}
That number
affects only the time for validating the cast ballots. We
provide here runtimes for validating batches of $B$ ballots, for $B \in \{500,5000,25000\}$. Those runtimes should be multiplied by $N/B$ in order to get the overall time for validating all incoming ballots.

\subsection{The cost of batch validation of ballots}
As discussed in Section \ref{cost}, the batch validation of $B$ ballots involves $BM(M-1)/2$ simultaneous multiplications (for verifying condition 1) and
$M(M-1)/2$ consecutive rounds with $B$ simultaneous multiplications in each (for verifying condition 4).
We can perform the verification of both conditions in parallel by spreading the $BM(M-1)/2$ simultaneous multiplications for verifying condition 1 over $M(M-1)/2$ consecutive rounds with $B$ simultaneous multiplications in each. Hence, the total workload would be $M(M-1)/2$ rounds with $2B$ simultaneous multiplications in each round.

Chida et al.
\cite{ChidaGHIKLN18} report runtimes for performing secure multiplications.
Their experiments were carried on
Amazon AWS {\sf m5.4xlarge} machines at N. Virginia over a network with bandwidth 9.6Gbps.
They experimented over a larger field of size $p'=2^{61}-1$ (which is also a Mersenne prime). Clearly, runtimes for our smaller prime, $p=2^{31}-1$, would be shorter;
but since we are interested only in upper-bounding the computational overhead of our protocol, in order to establish its practicality, those numbers will suffice for our needs.
They experimented with a circuit that consists of one million multiplication gates that are evenly spread over
$\{20,100,1000\}$ layers; hence, in each layer there are $\{5\cdot 10^4, 10^4, 10^3\}$ multiplication gates, respectively.
The reported runtimes as a function of $D$, the number of talliers,
are shown in Table \ref{tbl:Chida-results}.

\begin{table}[ht]
	\small
	\centering
	\setlength\tabcolsep{4.2pt}
	\begin{tabular}{c | p{0.3\linewidth}  | c | c | c | c}
		\hline
		 	\#layers & \#multiplication gates per layer 	& $D=3$ 	 & $D=5$  		& $D=7$  	& $D=9$\\
		\hline
		20 &  50000 & 826	 & 844 	& 	1058	& 1311	\\
		\hline
		100 & 10000 	& 842	 & 989 	& 	1154	& 1410\\
		\hline
		1000 & 1000 	& 1340	 & 1704 	& 	1851	& 2243\\
		\hline
	\end{tabular}
	\caption{Runtimes (milliseconds) for computing $10^6$ multiplication gates, spread evenly over 20, 100, and 1000 layers, as a function of the number $D$ of talliers.
	The first two columns show the number of layers and the number of multiplication gates per layer in each setting.}
	\label{tbl:Chida-results}
\end{table}

We begin by computing the needed runtimes for performing batch validations when $M=20$. We exemplify the computation in two cases: one in which the batch size is $B=500$ and another in which the batch size is increased 50-fold, i.e., $B=25000$.

To validate $B=500$ ballots when $M=20$ it is necessary to perform $M(M-1)/2=190$ rounds of $2B=1000$ simultaneous multiplications in each.
The runtimes for such a computation can be inferred from the third row in Table
\ref{tbl:Chida-results}, if we multiply the runtimes shown there by a factor of $\frac{190}{1000}$. That is, the batch validation of $B=500$ ballots would take
$255/324/352/426$ mili-seconds when $D=3/5/7/9$.
Therefore, to validate a million ballots, it would take $510/648/704/852$ seconds.

Those runtimes may be improved by enlarging the batch size. The time to validate a batch of $B=25000$ ballots, when $M=20$, can be inferred from the first row in Table
\ref{tbl:Chida-results}, if we multiply the runtimes shown there by a factor of $\frac{190}{20}$. That is, the batch validation of $B=25000$ ballots would take
$7.847/8.018/10.051/12.454$ seconds when $D=3/5/7/9$.
Therefore, validating a million ballots, would take
$314/321/402/498$ seconds.

In general, it is not hard to see that
the runtimes for validating one million ballots in batches of size $B=500/5000/25000$  can be read from  Table \ref{tbl:Chida-results} by multiplying the times reported there in the third/second/first row by a factor of $M(M-1)$.
Table \ref{val-batch} includes runtimes for validating 1 million ballots in batches of $B \in \{500,5000,25000\}$ ballots when $M \in \{5,10,20\}$, for $D =3/5/7/9$.

\begin{table}[ht]
	\small
	\centering
	\setlength\tabcolsep{4.2pt}
	\begin{tabular}{|c | c | c | c | }
		\hline
		 	& $B=500$ 	& $B=5000$ 	 & $B=25000$\\
		\hline
		$M=5$ 	 & 27/34/37/45 	& 	17/20/23/28	& 16/17/21/26	\\
		\hline
		$M=10$ 	 & 121/153/167/202 	& 	76/89/104/127	& 74/76/95/118\\
		\hline
		$M=20$ 	 & 510/648/704/852 	& 	160/188/219/268	& 314/321/402/498\\
		\hline
	\end{tabular}
	\caption{Runtimes (seconds) for validating 1 million ballots in order-based rules, as a function of the number of candidates $M$,
	the batch size $B$, and the number of talliers $D$. The table's entry relating to $M$ and $B$ shows the validation runtimes for $D=3/5/7/9$.}
	\label{val-batch}
\end{table}

Elections usually span a long time (typically at least 1 day) and the batch validation of ballots can take place along that period whenever a number of $B$ new ballots were received.
Hence, the above analysis shows that the runtimes for validating incoming ballots are very realistic and are not expected to slow down the election process.

\subsection{The cost of computing the final election results}\label{cost1}
Sub-protocol \ref{prot-winners} computes
the final election results in the {\sc Copeland} rule. It requires $M(M-1)$ invocations of the secure positivity test (Section \ref{positivity}), $M(M-1)/2$ invocations of the equality to zero test (Section \ref{is-zero}), and finally $K \cdot \left( M - \frac{K+1}{2} \right) \leq M(M-1)/2$ secure comparisons (Section \ref{secure_comparison}).
As discussed in Sections \ref{positivity} and \ref{is-zero}, the costs of the MPC computations to determine positivity and equality to zero are upper bounded by the cost of a secure comparison. Hence, the cost of Sub-protocol \ref{prot-winners} can be upper bounded by $4M(M-1)$ secure comparisons.

To evaluate the runtime of performing the secure comparison sub-protocol
we ran it on Amazon AWS {\sf m5.4xlarge} machines at N. Virginia over a network with bandwidth 9.6Gbps.
We performed our evaluation with $D\in\{3,5,7,9\}$ talliers.
The measured runtimes are given in Table \ref{tbl:mpc-results}.

\begin{table}[ht]
	\small
	\centering
	\setlength\tabcolsep{4.2pt}
	\begin{tabular}{p{0.35\linewidth}  | l | l | l | l}
		\hline
		Number of talliers 		 	& $D=3$ 	 & $D=5$  		& $D=7$  	& $D=9$\\
		\hline
		Time (msecs) to compute a secure comparison &  9.07	 & 9.54	& 	9.64	& 15.0	\\
\hline
	\end{tabular}
	\caption{Runtimes (milliseconds) for a secure comparison sub-protocol with a varying number of talliers.}
	\label{tbl:mpc-results}
\end{table}

As can be seen, the implied runtimes are negligible. For example, when $M=5$, the runtime of this stage is upper bounded by $1.2$ seconds, when using the highest number of talliers, $D=9$, while for $M=20$ it is upper bounded by
$22.8$ seconds. The runtimes in the case of {\sc Maximin} are even smaller, since then the number of secure comparisons is bounded only by $1.5\cdot M^2$ (see Section \ref{secmax}).
In summary, it is possible to achieve perfect ballot secrecy, as our protocol offers, at a very small computational price.

\section{Other order based rules}\label{other}
Here we consider two other order-based rules --- {\sc Kemeny-Young}
~\cite{kemeny1959mathematics,young1995optimal}
and {\sc Modal Ranking}
~\cite{caragiannis2014modal}, and describe secure protocols for implementing them.

\subsection{Kemeny-Young}
\subsubsection{Description}
In this rule, the ballot of each voter is a ranking of all candidates, where ties are allowed. Hence, the ballot of $V_n$, $n\in [N]$, may be described by an $M$-dimensional array,
$R_n$, where the $m$th entry in that array, $R_n(m)$, $m \in [M]$, is a number in $[M]$ that equals the rank of $C_m$ in $V_n$'s preference list.

For example, assume that there are four candidates: Alice ($C_1$), Bob ($C_2$), Carol ($C_3$) and David ($C_4$). Then if $V_n$ ranks Carol as her top candidate, Bob as her second choice, and either Alice or David as her last choices, then her ballot would be the vector $R_n=(3,2,1,3)$.
This vector ballot is then translated into a matrix $P_n$ of dimensions $M \times M$, where $P_n(m,\ell)=1$ if $C_m$ is ranked strictly higher than $C_\ell$ in $R_n$, and $P_n(m,\ell)=0$ otherwise. In the above example,
$$ P_n = \left( \begin{array}{cccc} 0 & 0 & 0 & 0 \\
1 & 0 & 0 & 1 \\
1 & 1 & 0 & 1 \\
0 & 0 & 0 & 0
\end{array}
\right)\,.$$

The talliers aggregate the incoming ballots by computing $P=\sum_{n \in [N]}P_n$.
For every $1 \leq m \neq \ell \leq N$, $P(m,\ell)$ equals the number of voters who ranked $C_m$ strictly higher than $C_\ell$.
The matrix $P$ induces a score for each of the possible $M!$ rankings over
$\mbox{\bf C} = \{C_1,\ldots,C_M\}$. Let $\rho = (\sigma_1,\ldots,\sigma_M)$, where $(\sigma_1,\ldots,\sigma_M)$ is a permutation of $\{1,\ldots,M\}$, be such a ranking. Here, for each $m \in [M]$, $\sigma_m$ is the rank of $C_m$ in the ranking. For example, if $M=4$ then
$\rho = (3,1,4,2)$ is the ranking in which $C_2$ is the top candidate and $C_3$ is the least favored candidate. The score of a ranking $\rho$ is defined as
\begin{equation} w(\rho) = \sum_{\ell,m \in [M]: \sigma_m<\sigma_\ell} P(m,\ell) \,;
\label{rhoscore}\end{equation}
namely, one goes over all pairs of candidates $C_m$ and
$C_\ell$ such that $\rho$ ranks $C_m$ higher than $C_\ell$ (in the sense that $\sigma_m<\sigma_\ell$) and adds up the number of voters who agreed with this pairwise comparison. The ranking $\rho$ with the highest score is selected, and the $K$ leading candidates in that ranking are the winners of the election.

\subsubsection{Secure implementation}
As in Protocol \ref{algvote} for {\sc Copeland} and {\sc Maximin}, each voter $V_n$ secret shares the entries of his ballot matrix $P_n$ among the $D$ talliers using a $D'$-out-of-$D$ scheme. Secret sharing is applied on each of the $M^2-M$ non-diagonal entries of $P_n$, since the diagonal entries are always zero.

To validate each in-coming ballot matrix, the talliers only need to check that all entries are in $\{0,1\}$ and that for every $1 \leq m<\ell \leq M$, $P_n(m,\ell) + P_n(\ell,m) \in \{0,1\}$. Indeed, the sum of two opposing entries,
$P_n(m,\ell)$ and $P_n(\ell,m)$, will always equal 1 (if one of $C_m$ and $C_\ell$ is ranked higher than the other) or 0 (if both are in a tie).
The validation of such conditions goes along the lines that we described in Section \ref{vercond1}.

After validating the cast ballots, the talliers add up their shares in $P_n$, for all validated ballot matrices, and then get $D'$-out-of-$D$ shares in each of the non-diagonal entries in $P$.

To compute secret shares in the score of each possible ranking $\rho$, the talliers need only to perform summation according to Eq. (\ref{rhoscore}). Note that that computation does not require the talliers to interact. Finally, it is needed to find the ranking with the highest score. That computation can be done by performing secure comparisons, as described in Section \ref{secure_comparison}.

\subsection{Modal ranking}
In modal ranking, every voter submits a ranking of all candidates, where the ranking has no ties. Namely, if $R_{\mbox{\bf C}}$ is the set of all $M!$ rankings of the $M$ candidates in $\mbox{\bf C}$, the ballot of each voter is a selection of one ranking from $R_{\mbox{\bf C}}$, as determined by her preferences. The rule then outputs the ranking that was selected by the largest number of voters (i.e., the mode of the distribution of ballots over $R_{\mbox{\bf C}}$). In case there are several rankings that were selected by the greatest number of voters, the rule outputs all of them, and then the winners are usually the candidates whose average position in those rankings is the highest.

Modal ranking rule is an order-based voting rule over $\mbox{\bf C}$, but it is equivalent to the {\sc Plurality} score-based voting rule (see ~\cite{brandt2016handbook}) over the set of candidate rankings $R_{\mbox{\bf C}}$. Hence, it can be securely implemented
by the protocol that was presented in~\cite{dery2021fear}.

\section{Conclusion}\label{conc}
In this study we presented a protocol for the secure computation of order-based voting rules. Securing the voting process is an essential step towards a fully online voting process, which is needed more than ever in these current times of social distancing.

A fundamental assumption in all secure voting systems that rely on fully trusted talliers (that is, talliers who receive the actual ballots from the voters) is that the talliers do not misuse the ballot information and that they keep it secret.
In contrast, our protocol significantly reduces the trust vested in the talliers, as it denies the talliers access to the actual ballots and utilizes MPC techniques in order to compute the desired output without allowing any party an access to the inputs (the private ballots). Even in scenarios where some (a minority) of the talliers betray that trust, privacy is ensured. Such a reduction of trust in the talliers is essential in order to increase the confidence of the voters in the voting system so that they would be further motivated to exercise their right to vote and, moreover, vote according to their true preferences, without fearing that their private vote will be disclosed to anyone.

Our protocol offers perfect ballot secrecy:
the protocol outputs the identity of the winning candidates, but the voters as well as the talliers remain oblivious of any other related information, such as the actual ballots or any other value that is computed during the tallying process (e.g., how many voters preferred one candidate over the other).
The design of a mechanism that offers perfect ballot secrecy must be tailored to the specific voting rule that governs the elections.
Others have studied {\sc Plurality}, {\sc Majority Judgement}, and {\sc Approval} voting rules ~\cite{NairBK15, yang2018secure, canard2018practical}, or the entire family of score-based rules ~\cite{dery2021fear}. However, ours is the first study that offers a privacy-preserving solution for order-based voting rules. We specifically demonstrated our solution on the following order-based rules: {\sc Copeland, Maximin, Kemeny-Young} and {\sc Modal-Ranking}. We showed that our solution is lightweight and can thus be readily implemented in real-life
order-based elections.

The present study suggests several directions for future research:

(a) \textbf{A running voting system.} To demonstrate the features and advantages of the secure protocols presented here, we intend to implement a running voting system, as was done in ~\cite{dery2021secure} for the secure protocols implementing score-based rules ~\cite{dery2021fear}.

(b) \textbf{Multi-winner elections.} Typical voting rules are usually oblivious to external social constraints, and they determine the identity of the winners solely based on the private ballots.
This is the case with the voting rules that we considered herein. In contrast, so called {\em multi-winner} election rules are designed specifically for selecting candidates that would satisfy the voters the most ~\cite{faliszewski2017multiwinner, elkind2017multiwinner}, in the sense that they also comply with additional social conditions (e.g., that the selected winners include a minimal number of representatives of specific gender, race, region etc.). This problem has unique features and it therefore requires its own secure protocols.
Examples for voting rules that are designed for such a purpose are {\sc Chamberlin-Courant} ~\cite{chamberlin1983representative} and {\sc Monroe} ~\cite{monroe1995fully}.

(c) \textbf{Malicious talliers.}
Our protocol assumes that the talliers are semi-honest,
i.e., that they follow the prescribed protocol correctly. The semi-honesty of the talliers can be ensured in practice by securing the software and hardware of the talliers. However, it is possible to design an MPC protocol that would be immune even to malicious talliers that may deviate from the prescribed protocol. While such protocols are expected to have significantly higher runtimes, they could enhance even further the security of the system and the trust of voters in the preservation of their privacy.

\newpage