18template <
typename Params>
19class Secp192r1Rep
final {
21 static constexpr auto P = Params::P;
22 static constexpr size_t N = Params::N;
23 typedef typename Params::W W;
25 constexpr static std::array<W, N> redc(
const std::array<W, 2 * N>& z) {
39 const int64_t S0 = X00 + X06 + X10;
40 const int64_t S1 = X01 + X07 + X11;
41 const int64_t S2 = X02 + X06 + X08 + X10;
42 const int64_t S3 = X03 + X07 + X09 + X11;
43 const int64_t S4 = X04 + X08 + X10;
44 const int64_t S5 = X05 + X09 + X11;
46 std::array<W, N> r = {};
60 const auto correction = p192_mul_mod_192(S);
61 W borrow =
bigint_sub2(r.data(), N, correction.data(), N);
68 constexpr static std::array<W, N> one() {
return std::array<W, N>{1}; }
70 constexpr static std::array<W, N> to_rep(
const std::array<W, N>& x) {
return x; }
72 constexpr static std::array<W, N> wide_to_rep(
const std::array<W, 2 * N>& x) {
return redc(x); }
74 constexpr static std::array<W, N> from_rep(
const std::array<W, N>& z) {
return z; }
80 constexpr static std::array<W, N> p192_mul_mod_192(W i) {
100class Params
final :
public EllipticCurveParameters<
101 "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF",
102 "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC",
103 "64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1",
104 "FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831",
105 "188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012",
106 "07192B95FFC8DA78631011ED6B24CDD573F977A11E794811"> {
111class Curve
final :
public EllipticCurve<Params, Secp192r1Rep> {};