Botan 3.6.1
Crypto and TLS for C&
pcurves_numsp512d1.cpp
Go to the documentation of this file.
1/*
2* (C) 2024 Jack Lloyd
3*
4* Botan is released under the Simplified BSD License (see license.txt)
5*/
6
7#include <botan/internal/pcurves_instance.h>
8
9#include <botan/internal/pcurves_wrap.h>
10
11namespace Botan::PCurve {
12
13namespace {
14
15namespace numsp512d1 {
16
17template <typename Params>
18class Numsp512d1Rep final {
19 public:
20 static constexpr auto P = Params::P;
21 static constexpr size_t N = Params::N;
22 typedef typename Params::W W;
23
24 static constexpr W C = 569;
25
26 constexpr static std::array<W, N> one() { return std::array<W, N>{1}; }
27
28 constexpr static std::array<W, N> redc(const std::array<W, 2 * N>& z) {
29 return redc_crandall<W, N, C>(std::span{z});
30 }
31
32 constexpr static std::array<W, N> to_rep(const std::array<W, N>& x) { return x; }
33
34 constexpr static std::array<W, N> wide_to_rep(const std::array<W, 2 * N>& x) { return redc(x); }
35
36 constexpr static std::array<W, N> from_rep(const std::array<W, N>& z) { return z; }
37};
38
39// clang-format off
40class Params final : public EllipticCurveParameters<
41 "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDC7",
42 "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDC4",
43 "1D99B",
44 "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5B3CA4FB94E7831B4FC258ED97D0BDC63B568B36607CD243CE153F390433555D",
45 "2",
46 "1C282EB23327F9711952C250EA61AD53FCC13031CF6DD336E0B9328433AFBDD8CC5A1C1F0C716FDC724DDE537C2B0ADB00BB3D08DC83755B205CC30D7F83CF28"> {
47};
48
49// clang-format on
50
51class Curve final : public EllipticCurve<Params, Numsp512d1Rep> {
52 public:
53 static FieldElement fe_invert2(const FieldElement& x) {
54 // Generated by https://github.com/mmcloughlin/addchain
55 auto z = x.square();
56 z *= x;
57 z = z.square();
58 z *= x;
59 auto t0 = z;
60 t0.square_n(3);
61 t0 *= z;
62 t0.square_n(3);
63 auto t1 = t0 * z;
64 t0 = t1;
65 t0.square_n(9);
66 t0 *= t1;
67 t0.square_n(3);
68 t0 *= z;
69 auto t2 = t0;
70 t2.square_n(9);
71 t1 *= t2;
72 t2 = t1;
73 t2.square_n(30);
74 t1 *= t2;
75 t2 = t1;
76 t2.square_n(60);
77 t1 *= t2;
78 t2 = t1;
79 t2.square_n(120);
80 t1 *= t2;
81 t2 = t1;
82 t2.square_n(240);
83 t1 *= t2;
84 t1.square_n(21);
85 t0 *= t1;
86 t0 = t0.square();
87 t0 *= x;
88 t0.square_n(4);
89 z *= t0;
90 z.square_n(4);
91 z *= x;
92 z.square_n(2);
93 return z;
94 }
95};
96
97} // namespace numsp512d1
98
99} // namespace
100
101std::shared_ptr<const PrimeOrderCurve> PCurveInstance::numsp512d1() {
103}
104
105} // namespace Botan::PCurve
static std::shared_ptr< const PrimeOrderCurve > numsp512d1()
Definition pcurves.cpp:96
static std::shared_ptr< const PrimeOrderCurve > instance()
int(* final)(unsigned char *, CTX *)
constexpr std::array< W, N > redc_crandall(std::span< const W, 2 *N > z)
Definition mp_core.h:1122