Keywords

1 Introduction

In 1994, Shor discovered a quantum algorithm for factoring integers and solving discrete logarithms in polynomial time [26]. This implies that an adversary with access to a sufficiently powerful quantum computer can break nearly all public-key cryptography that is deployed today. Therefore, it is important to look for alternative public-key cryptography algorithms that can resist attacks from quantum adversaries. Recently, the US National Institute of Standards and Technology (NIST) has initiated a process to solicit, evaluate, and standardize one or more quantum-resistant public-key cryptographic algorithms [22]. One of the 9 signature schemes that advanced to the second round of the NIST project is Picnic [7, 19, 27], a signature scheme whose security only relies on symmetric-key primitives.

Indeed, a key pair for Picnic consists of a random secret key \(\mathsf {sk}\) and the corresponding public key \(\mathsf {pk}= F(\mathsf {sk})\), where F is a one-way function which can be computed with a low number of non-linear binary gates [7]. To sign a message m the signer then produces a non-interactive zero-knowledge proof of knowledge of \(\mathsf {sk}\) such that \(F(\mathsf {sk}) = \mathsf {pk}\) in a way that binds the message m to the proof. These zero-knowledge proofs (whose security relies additionally only on a secure commitment scheme) are constructed using the MPC-in-the-head paradigm [17]. This results in a signature scheme whose signatures are 33 KB large for 128 bits of security. Later, Katz et al. developed Picnic2 [19], which reduces the signature size to only 14 KB by moving from a 3-party MPC protocol in the honest majority setting to an n-party protocol with preprocessing secure in the dishonest majority setting. However, this increased number of parties slows down the signing and verification algorithms. Picnic and Picnic2 are round 2 candidates in the NIST project [27]. To study the effect of selecting a different function \( F \), Delpech de Saint Guilhem et al. constructed the BBQ scheme using MPC protocols for arithmetic secret sharing to base the signatures on the security of the AES algorithm instead of the less scrutinized block cipher LowMC [24].

Contributions. In this work we propose to use the Legendre PRF [9], denoted by \( \mathcal {L}_K(\cdot ) \), as one-way function, instead of LowMC or AES. The Legendre PRF is a promising alternative since it can be computed very efficiently in the MPC setting [15]. However, a major limitation of the Legendre PRF is that it only produces one bit of output, which means that the public key should consist of many PRF evaluations \(\mathcal {L}_K(i_1), \dots , \mathcal {L}_K(i_L)\), at some fixed arbitrary list \( \mathcal {I}= (i_1,\cdots ,i_L) \) of L elements of \(\mathbb {F}_p\), to uniquely determine the secret key K. Hence, the zero-knowledge proof needs to prove knowledge of a value \(K'\) such that \(\mathcal {L}_{K'}(i) = \mathcal {L}_K(i)\) for all \(i \in \mathcal {I}\) simultaneously, which results in prohibitively large signatures. Luckily, we can relax the relation to overcome this problem. Instead of proving that the signer knows a \(K'\) such that \(\mathcal {L}_{K'}(i) = \mathcal {L}_K(i)\) for all \(i \in \mathcal {I}\), we let a prover prove knowledge of a \(K'\) such that this holds for a large fraction of the i in \(\mathcal {I}\). We show that the relaxed statement allows for a much more efficient zero-knowledge proof. This allows us to establish LegRoast, an MPC-in-the-head based scheme with a signature size of 12.2 KB and with much faster signing and verification algorithms than the Picnic2 and BBQ schemes. To further improve the efficiency of LegRoast, we propose to use higher-power residuosity symbols instead of just the quadratic one (i.e. the Legendre symbol) in a second scheme called PorcRoast. This results in signatures that are only 6.3 KB large and in signing and verification times that are twice faster than LegRoast.

A comparison between the signature size and signing time of LegRoast and PorcRoast versus existing signatures based on symmetric primitives (Picnic [27] and SPHINCS+ [16]) is shown in Fig. 1. Even though LegRoast and PorcRoast do not have an AVX optimized implementation yet, we see that LegRoast has faster signing times than both Picnic and SPHINCS+, and that PorcRoast is even faster than LegRoast. We conclude that PorcRoast is the most efficient post-quantum signature scheme based on symmetric primitives in terms of signature size and signing time.

However, note that there are several other branches of post-quantum signatures, such as lattice-based (e.g. Dilithium and Falcon [12, 21, 23]), Multivariate signatures (e.g., Rainbow, LUOV, MQDSS, MUDFISH [2, 5, 6, 10, 11, 25]) and isogeny-based signatures (e.g. CSI-FISH [4]), some of which result in more efficient signature schemes.

Roadmap. After some preliminaries in Sect. 2, we introduce a relaxed PRF relation in Sect. 3. We then sketch an identification scheme in Sect. 4 which we formalize as a signature scheme in Sect. 5. We finally discuss parameter choices and implementation results in Sect. 6.

Fig. 1.
figure 1

Signature sizes and timings of post-quantum signature schemes based only on symmetric primitives.

2 Preliminaries - The Legendre and Power Residue PRFs

For an odd prime p the Legendre PRF is conjectured to be a pseudorandom function family, indexed by a key \(K \in \mathbb {Z}_p\), such that \(\mathcal {L}_K\) takes as input an element \(a \in \mathbb {F}_p\) and outputs the bit

$$ \mathcal {L}_K (a) = \left\lfloor \frac{1}{2} \left( 1 - \left( \frac{K+a}{p} \right) \right) \right\rfloor \in \mathbb {Z}_2, $$

where \(( \frac{a}{p} ) \in \{ -1, 0, 1 \}\) denotes the quadratic residuosity symbol of \(a \bmod p\). We note that the function \( \mathcal {L}_K \) above is defined such that \( \mathcal {L}_0 (a \cdot b) = \mathcal {L}_0 (a) + \mathcal {L}_0(b) \) for all \( a, b \in \mathbb {F}_p^\times \). (Note also that \( \mathcal {L}_K (a) = \mathcal {L}_0 (K + a) \).)

The seemingly random properties of quadratic residues have been the subject of study for number theorists at least since the early twentieth century, which is why Damgård proposed to use this construction in cryptography [9]. Since then, the security of the Legendre PRF has been studied in several attack models. In the very strong model where a quantum adversary is allowed to query the PRF in superposition, a key can be recovered in quantum polynomial time [8]. If the adversary is only allowed to query the PRF classically, there is a memoryless classical attack that requires computing \(O(p^{1/2}\log p)\) Legendre symbols and making \(O(p^{1/2}\log p)\) queries to the PRF [20]. Finally, if the adversary is restricted to querying only L Legendre symbols, the best known attack requires computing \(O(p \log ^2 p / L^2)\) Legendre symbols [3].

Damgård also considers a generalisation of the Legendre PRF, where instead of using the quadratic residue symbol \(( \frac{a}{p} ) = a^{\frac{p-1}{2}} \bmod p \), the PRF uses the k-th power residue symbol defined as \(( \frac{a}{p} )_k = a^{\frac{p-1}{k}} \bmod p\), for some k that divides \(p-1\). We define the power residue PRF, analogous to the Legendre PRF, as the keyed function \( \mathcal {L}^{k}_K : \mathbb {F}_p\rightarrow \mathbb {Z}_k \), where for an odd prime \( p \equiv 1 \bmod k \), \(\mathcal {L}^{k}_K(a)\) is defined as

$$ \mathcal {L}^{k}_K(a) = {\left\{ \begin{array}{ll} i &{} \text { if } (a+K) / g^i \equiv h^k \bmod p \text { for some } h \in \mathbb {F}_p^\times \\ 0 &{} \text { if } (a+K) \equiv 0 \bmod p \end{array}\right. } \, , $$

where \( g \) is a fixed generator of \( \mathbb {F}_p^\times \). We see that the function \( \mathcal {L}^{k}_0 \) is a homomorphism of groups from \( \mathbb {F}_p^\times \) to \( \mathbb {Z}_k \).

Note that for \( k = 2 \), this notation coincides with the original Legendre PRF. In this paper, we use the generic notation and we separate the \(k = 2\) and \(k>2\) cases only in the experimental sections to highlight the advantages gained by using \( k > 2 \). One advantage of the power residue PRF is that it yields \(\log k\) bits of output, instead of a single bit. The best known attack against the power residue PRF in the setting where an attacker is allowed to query the PRF L times requires computing \(O(p \log ^2 p / ( k L \log ^2 k) )\) power residue symbols [3].

3 The (Relaxed) Power Residue PRF Relation

In this section, we define the Legendre and power residue PRF NP-languages \(R_{\mathcal {L}^{k}}\), for \( k \ge 2 \), which consist of the symbol strings of outputs of the \( \mathcal {L}^{k}\) PRF for a given set of inputs. We also define a relaxed version of these languages \(R_{\beta \mathcal {L}^{k}}\), which consist of the strings that are very close (up to addition by a scalar in \( \mathbb {Z}_k \)) to a word in \(R_{\mathcal {L}^{k}}\), where the Hamming distance \( d_H \) is used and \( \beta \) parameterizes the slack.

For properly chosen parameters, it follows from the Weil bound that the relaxed version is as hard as the exact relation, but the relaxed relation will lead to much more efficient signature schemes. To simplify notation, for a list \(\mathcal {I} = (i_1,\cdots ,i_L)\) of L arbitrary elements of \(\mathbb {Z}_p\), we denote a length-L Legendre/k-th power residue PRF as:

$$\begin{aligned} F_\mathcal {I}^{k} : \mathbb {F}_p&\rightarrow \mathbb {Z}_k^L \\ K&\mapsto ( \mathcal {L}^{k}_K(i_1), \dots , \mathcal {L}^{k}_K(i_L) ). \end{aligned}$$

Definition 1

(Legendre/k-th power residue PRF relation). For an odd prime p, a positive integer \(k \mid p-1\) and a list \(\mathcal {I}\) of L elements of \(\mathbb {Z}_p\) we define the Legendre/\( k \)-th power residue PRF relation \(R_{\mathcal {L}^{k}}\) with output length L as

$$\begin{aligned} R_{\mathcal {L}^{k}}&= \{ (F_\mathcal {I}^{k}(K), K) \in \mathbb {Z}_k^L \times \mathbb {F}_p\mid K \in \mathbb {F}_p\} \, . \end{aligned}$$

Definition 2

(\(\beta \)-approximate PRF relation). For \(\beta \in [0,1]\), an odd prime p, a positive integer \(k \mid p-1\) and a list \(\mathcal {I}\) of L elements of \(\mathbb {Z}_p\) we define the \(\beta \)-approximate PRF relation \(R_{\beta \mathcal {L}^{k}}\) with output length L as

$$\begin{aligned} R_{\beta \mathcal {L}^{k}} = \{ (s, K) \in \mathbb {Z}_k^L \times \mathbb {F}_p\mid \exists a \in \mathbb {Z}_k : d_H (s + (a, \dots , a),F_\mathcal {I}^{k}(K)) \le \beta L \} \end{aligned}$$

where \( d_H(\cdot , \cdot ) \) denotes the Hamming distance.

It follows from the Weil bound for character sums that if \(\beta \) is sufficiently small and L is sufficiently large, then the \(\beta \)-relaxed power residue relation is equally hard as the exact power residue relation, simply because with overwhelming probability over the choice of \(\mathcal {I}= (i_1,\cdots ,i_L)\) every witness for the relaxed relation is also a witness for the exact relation. The proof is given in Appendix A.

Theorem 1

Let \( \mathcal {B}(n, q) \) denote the binomial distribution with \( n \) samples each with success probability \( q \). Take \(K \in \mathbb {F}_p\), and take \(s = F_\mathcal {I}^k(K)\). Then with probability at least \(1- kp \cdot \Pr \left[ \mathcal {B}(L,1/k + 1/\sqrt{p} + 2/p) \ge (1-\beta ) L \right] \) over the choice of \(\mathcal {I}\), there exist only one witness for \(s \in R_{\beta \mathcal {L}^{k}}\), namely K, which is also a witness for the exact relation \(R_{\mathcal {L}^{k}}\).

4 Identification Scheme

In this section, we establish a Picnic-style identification scheme from the Legendre/\( k \)-th power residue PRF. We first sketch a scheme very close to the original Picnic construction [7] and gradually add more optimizations, presenting each in turn. Even though the final goal is to construct a signature scheme, we use the language of identification schemes in this section to relate the scheme to existing constructions. We delay the security proof to the next section, where we first apply the Fiat-Shamir transform [13] before we prove that the resulting signature scheme is tightly secure in the ROM. The proof of security of the interactive identification scheme presented here can be derived from the one provided in the next section.

Starting Point. To begin, we take the Picnic2 identification scheme and replace the LowMC block-cipher by the PRF \( F^k_\mathcal {I}\). The key pair is then \( \mathsf {sk}= K \) and \( \mathsf {pk}= F^k_\mathcal {I}(K) \in \mathbb {Z}_k^L \). From a high-level view, the protocol can be sketched as in Fig. 2 where the prover runs an MPC-in-the-head proof with \( N \) parties on a secret sharing of K, to prove to the verifier that he knows K such that \(( ( \frac{K+i_1}{p} ), \dots , ( \frac{K+i_L}{p} ) )\) is equal to the public key. We also use the more efficient method recently proposed by Baum and Nof [1] based on sacrificing rather than the cut-and-choose technique.

Relaxing the PRF Relation. As a first optimization, rather than computing all of the L residue symbols with the MPC protocol, we only check a fixed number B of them. To do so, the verifier chooses random inputs \(I^{(1)}, \dots , I^{(B)}\) in \(\mathcal {I}\) at which the \(\mathcal {L}^{k}\) PRF is evaluated to check the witness. It is crucial that the verifier sends his choice of \(I^{(j)}\)s after the prover has committed to his sharing of K, because if a malicious prover knows beforehand which symbols are going to be checked, he can use a fake key \(K'\) such that \(( \frac{K'+I^{(j)}}{p} ) = \mathsf {pk}_{I^{(j)}}\) only for \(j \in [B]\). This probabilistic method of selecting which circuit will be executed with the MPC-in-the-head technique is similar to the “sampling circuits on the fly” technique of Baum and Nof [1].

This is now an identification scheme for the \(\beta \)-approximate Legendre PRF relation; a prover that convinces the verifier with probability greater than \((1-\beta )^B + (1-(1-\beta )^B)/N \) could be used to extract a \(\beta \)-approximate witness following the formalism presented in [1, Section 4]. This protocol is sketched in Fig. 3.

Fig. 2.
figure 2

Picnic-stye identification scheme

Fig. 3.
figure 3

Checking only B symbols

Computing Residue Symbols in the Clear. Since computing residue symbols is relatively expensive, we avoid doing it within the MPC protocol. We use an idea similar to that of Grassi et al. to make this possible [15]. First, we let the prover create sharings of B uniformly random values \(r^{(1)}, \dots , r^{(B)} \in \mathbb {F}_p^\times \) and commit to their residue symbols by sending \(s^{(j)} = \mathcal {L}^{k}_0( r^{(j)} )\) to the verifier. Then, the MPC protocol only outputs \(o^{(j)} = (K+I^{(j)})r^{(j)}\). Since \(K + I^{(j)}\) is masked with a uniformly random value with known residue symbol, \(o^{(j)}\) does not leak information about K (except for the residue symbol of \(K+I^{(j)}\)). The verifier then computes \(\mathcal {L}^{k}_0 ( o^{(j)} )\) himself in the clear, and verifies whether it equals \(\mathsf {pk}_{I^{(j)}} + s^{(j)}\). The correctness of this check follows from the facts that \( \mathcal {L}^{k}_0 : \mathbb {F}_p^\times \rightarrow \mathbb {Z}_k\) is a group homomorphism.

Note that the prover can lie about the values of \(s^{(j)} = \mathcal {L}^{k}_0( r^{(j)})\) that he sends to the prover. This is not an issue because he has to commit to these values before the choice of \(I^{(j)}\) is revealed. This is the reason why we defined \(K'\) to be an \(\beta \)-approximate witness for \( \mathsf {pk}\) if \( F^k_\mathcal {I}(K') \) is close to \( \mathsf {pk}= F^k_\mathcal {I}(K) \) up to addition by a scalar. This identification protocol is sketched in Fig. 4.

Verifying Instead of Computing Multiplications. Instead of using the MPC protocol to compute the products \(o^{(j)}\), the prover can just send these products directly to verifier. We then use the MPC-in-the-head protocol to instead verify that \( o^{(j)} = ( K + I^{(j)} ) \cdot r^{(j)} \) for all \(j \in [B]\). A big optimization here is that rather than verifying these B equations separately, it is possible to just check a random linear combination of these equations:

After the prover sends the \(o^{(j)}\) values, the verifier chooses random coefficients \(\lambda ^{(1)}, \dots , \lambda ^{(B)}\) for the linear combination. Then, the MPC protocol is used to compute the error term \( E \) defined as

$$\begin{aligned} E = \sum _{j=1}^B \lambda ^{(j)} \left( (K+I^{(j)})r^{(j)} - o^{(j)} \right) = K \cdot \sum _{j=1}^B \lambda ^{(j)} r^{(j)} + \sum _{j=1}^B \lambda ^{(j)} (I^{(j)} r^{(j)} - o^{(j)}) . \end{aligned}$$

Clearly, if all the \(o^{(j)}\) are correct, then \(E = 0\). Otherwise, if one or more of the \(o^{(j)}\) are wrong, then E will be a uniformly random value. Therefore, checking if \(E = 0\) proves to the verifier that all the \(o^{(j)}\) are correct, with a soundness error of 1/p. Moreover, since the \(\lambda ^{(j)}, o^{(j)}\) and \(I^{(j)}\) are public values, we see that E can be computed with only a single nonlinear operation! This means we can compute E extremely efficiently in MPC. The identification scheme with this final optimization is sketched in Fig. 5.

Fig. 4.
figure 4

Computations in the clear.

Fig. 5.
figure 5

The final scheme.

We note that a single execution of the interactive identification scheme is not enough to achieve negligible soundness error (e.g. the prover has probability \( 1 / N \) to cheat in the MPC verification protocol). To resolve this, \( M \) executions must be run in parallel.

5 LegRoast and PorcRoast Signature Schemes

We now formalize the signature schemes LegRoast (with \( k = 2 \)) and PorcRoast (with \( k > 2 \)) which are constructed from the identification scheme of Sect. 4 with the Fiat-Shamir transform [13], by generating the challenges using three random oracles \( \mathcal {H}_1, \mathcal {H}_2 \) and \( \mathcal {H}_3 \). The message is combined with a \(2\lambda \)-bit salt and bound to the proof by hashing it together with the messages of the prover.

Parameters. Our new signature schemes are parametrized by the following values. Let \( p \) be a prime number and let \( k \ge 2 \) be an integer such that \( k \mid p-1 \). Let \( L \) be an integer determining the length of the public key, \(\mathcal {I}\) a pseudo-randomly chosen list of L elements of \(\mathbb {Z}_p\) and let \( B \le L \) denote the number of \( k \)-th power residue symbols in the public key that will be checked at random. Let \( N \) denote the number of parties in the MPC verification protocol and let \( M \) denote the number of parallel executions of the identification scheme. These values are grouped under the term \( \mathsf {params}\).

Key Generation, Signing and Verifying. The \( \mathsf {KGen}(1^\lambda , \mathsf {params}) \) algorithm samples \( \mathsf {sk}= K \xleftarrow {\$}\mathbb {F}_p\) uniformly at random and computes the public key \( \mathsf {pk}= F^k_\mathcal {I}(K) \). The \( \mathsf {Sign}(\mathsf {params}, \mathsf {sk}, m) \) algorithm, for message \( m \in \{ 0, 1\}^*\) is presented in Fig. 6. The \( \mathsf {Vf}(\mathsf {params}, \mathsf {pk}, m, \sigma ) \) algorithm is presented in Fig. 7.

Security. The EUF-CMA security [14] of the LegRoast and PorcRoast signature schemes follows from a tight reduction from the problem of finding a witness for the \(R_{\beta \mathcal {L}^{k}}\)-relation, which is equally hard as a key recovery on the power residue PRF for our parameters. The proof of Theorem 2 is included in Appendix B.

Theorem 2

In the classical random oracle model, the LegRoast and PorcRoast signature schemes defined as above are EUF-CMA-secure under the assumption that computing \( \beta \)-approximate witnesses for a given public key is hard.

Fig. 6.
figure 6

Signature scheme from proof of knowledge of \( k \)-th power residue PRF pre-image.

Fig. 7.
figure 7

Verifying algorithm for LegRoast and PorcRoast.

6 Parameter Choices and Implementation

This section shows how to choose secure parameters for the LegRoast and PorcRoast signature schemes, and what the resulting key and signature sizes are. We also go over some of the implementation details and the performance of our implementation.

6.1 Parameter Choices

Choosing p, L and \(\mathcal {I}\). We choose p and L such that the problem of finding a \(\beta \)-approximate witness for the PRF relation has the required security level. To do this, we first choose p and L such that the problem of recovering the exact key from L symbols of output is hard. For our proposed parameters we choose L such that the public key size is 4 KB, (i.e. \(L = 32768/\log (k)\)). Different trade-offs are possible (see Remark 1). Then, we set \(\beta \) such that

$$ k\cdot p\cdot \Pr [B(L,1/k + 1/\sqrt{(}p) + 2/p) > (1-\beta ) l] \le 2^{-\lambda }\, . $$

With this choice, Theorem 1 says that with overwhelming probability, finding a \(\beta \)-approximate key is equivalent to finding the exact key. Section 2 gives a short overview of attacks on the Legendre PRF for various attack models. However, in the setting of attacking LegRoast and PorcRoast, the adversary is restricted even more than in the weakest attacker model considered in the literature: an attacker learns only a few evaluations of the Legendre PRF on pseudorandom inputs over which the attacker has no control. If the L inputs are chosen at random, the best known attack is a brute force search which requires computing O(p/k) power residue symbols, and the attack complexity becomes independent of L. For Legroast, we propose to use a prime p of size roughly \(2^\lambda \), where \(\lambda \) is the required security level. We choose the Mersenne prime \(p = 2^{127} -1\) to speed up the arithmetic. For PorcRoast, we use the same prime and \(k = 254\) such that a power residue symbol can efficiently be represented by a single byte. For \(k>2\), computing a power residue symbol corresponds to a modular exponentiation, which is much more expensive than an AES operation, so even though an attacker has on average only to compute \(2^{127}/k \approx 2^{119}\) power residue symbols, we claim that this still provides approximately 128-bits of security. We stress that the quantum polynomial-time key recovery attack on the Legendre PRF does not apply on our scheme, because the adversary can not make queries to the instance of the Legendre PRF (and certainly no quantum queries) [8].

Choosing B, N and M. Our security proof shows that, unless an attacker can produce a \(\beta \)-approximate witness, his best strategy is to query \(\mathcal {H}_1\) on many inputs and then choose the query for which

$$ \mathcal {L}^{k}_0 ( (K_e + I_e^{(j)})r_e^{(j)}) = s_e^{(j)} + \mathsf {pk}_{I_e^{(j)}} \text { for all } j \in [B] $$

holds for the most executions. Say this is the case for \(M'\) out of M executions. He then makes one of the parties cheat in the MPC protocol in each of the \(M - M'\) remaining executions and queries \(\mathcal {H}_3\) in the hope of getting an output \(\{\bar{i}_{e}\}_{e\in [M]}\) that asks him to open all the other non-cheating parties; i.e. the attacker attempts to guess \(\bar{i}_{e}\) for each \( e \). This succeeds with probability \(N^{-M+M'}\).

Therefore, to achieve \(\lambda \) bits of security, we take parameters \(B,N = 2^n\) and M such that

$$\begin{aligned} \min _{M' \in \{0,\dots ,M\} } \left( \Pr [\mathcal {B}(M,(1-\beta )^B) \ge M_1]^{-1} + N^{M-M'} \right) \ge 2^\lambda \, , \end{aligned}$$
(1)

which says that for each value of \(M'\), the adversary is expected to do at least \(2^\lambda \) hash function evalutations for the attack to succeed. To choose parameters, we fix N to a certain value and compute which values of B and M minimize the signature size while satisfying Eq. (1). The choice of N controls a trade-off between signing time and signature size. If N is large, the soundness error will be small, which results in a smaller signature size, but the signer and the verifier need to simulate an MPC protocol with a large number of parties, which is slow. On the other hand, if N is small, then the signature size will be larger, but signing and verifying will be faster. Some trade-offs achieving 128-bits of security for LegRoast and PorcRoast are displayed in Table 1.

Remark 1

The parameter L controls a trade-off between public key size and signature size. For example, we can decrease the public key size by a factor 8 (to 0.5 KB), at the cost of an increase in signature size by \(21\%\) (to 7.6 KB). (\(L = 512, k = 254, \beta = 0.871, n = 256, B = 10, M = 20\)).

Table 1. Parameter sets for LegRoast and PorcRoast for NIST security level I. For all parameter sets we have \(p = 2^{127}-1\), a secret key size of 16 Bytes and a public key size of 4 KB (\(L = 32768\) and 4096 for LegRoast and PorcRoast respectively). The verification time is similar to the signing time.

6.2 Implementation

In our implementation, we replace the random oracles and the \(\mathsf {Expand}\) function by SHA-3 and SHAKE128. The signing algorithm is inherently constant time, except for computing Legendre symbols, which when implemented with the usual GCD strategy, leaks timing information on its argument. Therefore, in our implementation, we chose to adopt the slower approach of computing Legendre symbols as an exponentiation with fixed exponent \((p-1)/2\), which is an inherently constant time operation. Higher-power residue symbols are also calculated as an exponentiation with fixed exponent \((p-1)/k\). The signing-time of our implementation, measured on an Intel i5-8400H CPU, running at 2.50 GHz, is displayed in Table 1.