# A Unified Point Multiplication Architecture of Weierstrass, Edward and Huff Elliptic Curves on FPGA
## 2 Mathematical Background over \(GF(2^{m})\)
```
Input:\(k=(k_{n-1},\ldots,k_{1},k_{0})\) with \(k_{n-1}=1\), \(P=(x,y)\in GF(2^{m})\) Output:\(Q=\omega(k.P)\) Affine to projective conversions:\(X_{1}=x_{p}\), \(Y_{1}=Y_{2}=y_{p}\), \(Z_{1}=1\), \(X_{2}=x_{p}^{4}+b\) and \(Z_{2}=x_{p}^{2}\) PM in projective coordinates: for(i from m-2 down to 0)do \(Q=UADD_{Huff}(Q,Q)\) if(\(k_{i}=1\))then \(Q=UADD_{Huff}(P,Q)\) end for end Reconversion from projective to affine:\(Q(x_{q},y_{q})=(\frac{X_{2}}{Z_{2}},\frac{Y_{2}}{Z_{2}^{2}})\)In Table 1, variables \(X_{1}\), \(X_{2}\), \(Y_{1}\), \(Y_{2}\), \(Z_{1}\), \(Z_{2}\), \(W_{1}\), \(W_{2}\), \(Z_{a}\), \(Z_{d}\),\(W_{a}\) and \(W_{d}\) depict the initial and final points in a projective coordinate system. The remaining variables, such as \(m_{12}\) to \(m_{12}\), \(A\), \(B\), \(C\), and \(T_{1}\), represent the storage elements/items. These storage items are required to compute the PM operation on the respective ECC model (Weierstrass, Edward, and Huff). In column two of Table 1, the \(x_{p}\) is the base point in affine coordinates while \(b\) is the constant for the Weierstrass curve. Similarly, in column three, the values \(e_{1}\), \(e_{2}\) and \(e\) can be calculated as \(\sqrt[4]{e}\), \(\sqrt{e}\) and \(d_{1}^{4}+d_{1}^{3}+d_{1}^{2}d_{2}\). Moreover, the variable \(\omega\) is a rational function for the corresponding elliptic curve. It can be calculated on point \(P\) as \(w(P)=\frac{x+y}{d_{1}(x+y+1)}\) for \(P=(x,y)\) in \(E_{B,d1,d2}\). The \(w-coordinate\) differential addition and doubling implies calculating \(w(2P_{1})\) and \(w(P_{1}+P_{2})\) from the given values \(w(P_{1})\), \(w(P_{2})\) and \(w(P_{1}\)-\(P_{2})\), where \(P_{1}\) and \(P_{2}\) are the points on \(E\) over \(GF(2^{m})\). The variables \(\alpha\) and \(\beta\) in column four of Table 1 are constants. These curve constants are calculated as \(\alpha=\frac{a+b}{b}\) and \(\beta=\frac{a+b}{a}\). To obtain maximum throughput, our work uses pre-computed values of \(e_{1}\), \(e_{2}\), \(e\), \(\alpha\), and \(\beta\). For more detailed descriptions, we refer readers to [8] (for the Weierstrass curve) [20] (for the Edward curve), and [21; 22; 23; 24] (for the Huff curve). ## 3 Memory Optimizations

As we mentioned in Section 2, the variables in Table 1 are \(X_{1}\), \(X_{2}\), \(X_{3}\), \(Y_{1}\), \(Y_{2}\), \(Y_{3}\), \(Z_{1}\), \(Z_{2}\), \(Z_{3}\), \(W_{1}\), \(W_{2}\), \(Z_{a}\), \(Z_{d}\), \(W_{a}\) and \(W_{d}\). These variables hold the initial and final points in a projective coordinate system. Similarly, the remaining variables \(m_{1}\) to \(m_{12}\), \(A\), \(B\), \(C\), and \(T_{1}\) are the storage elements required to compute the PM operation on the respective ECC model (Weierstrass, Edward, and Huff). If we count these variables, this becomes 31. We need a memory unit of 31 \(\times\)\(m\) to implement Weierstrass, Edward, and Huff curves simultaneously, where \(m\) is the implemented field length. Moreover, columns three and four of Table 1 show that the Edward and Huff curves contain complex mathematical formulations, meaning that some instructions require more than one modular operation to compute. The \(I_{5}\), i.e., ((\(e_{1}\times W_{1}+Z_{1}\))\({}^{4}\)), can be observed in column three of Table 1. It depends on three modular operations: (i) the multiplication of \(e_{1}\times W_{1}\), (ii) \(e_{1}\times W_{1}+Z_{1}\), and (iii) (\((e_{1}\times W_{1}+Z_{1}\))\({}^{4}\)). Such complex instructions demand specialized hardware to execute them. Hence, we need to simplify the mathematical formulations of columns three and four of Table 1 to implement them in the proposed unified design. Consequently, in Table 2, we use the following replacement strategy to obtain simplified mathematical instructions. Moreover, we consider one modular operator (adder, multiplier, and square) to show the simplified instructions.