Skip to content

Commit

Permalink
Small cleanups in P-521 pcurve code
Browse files Browse the repository at this point in the history
  • Loading branch information
randombit committed Jun 14, 2024
1 parent 4c3e9dc commit 4287993
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/lib/math/pcurves/pcurves_secp521r1/pcurves_secp521r1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ namespace Botan::PCurve {

namespace {

// clang-format off
namespace secp521r1 {

template <typename Params>
Expand All @@ -22,11 +21,7 @@ class P521Rep final {
static constexpr size_t N = Params::N;
typedef typename Params::W W;

constexpr static std::array<W, N> one() {
std::array<W, N> one = {};
one[0] = 1;
return one;
}
constexpr static std::array<W, N> one() { return std::array<W, N>{1}; }

constexpr static std::array<W, N> redc(const std::array<W, 2 * N>& z) {
constexpr W TOP_MASK = static_cast<W>(0x1FF);
Expand Down Expand Up @@ -58,6 +53,7 @@ class P521Rep final {
constexpr static std::array<W, N> from_rep(const std::array<W, N>& z) { return z; }
};

// clang-format off
class Params final : public EllipticCurveParameters<
"1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
"1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC",
Expand All @@ -68,11 +64,11 @@ class Params final : public EllipticCurveParameters<
-4> {
};

class Curve final : public EllipticCurve<Params, P521Rep> {};
// clang-format on

}
class Curve final : public EllipticCurve<Params, P521Rep> {};

// clang-format on
} // namespace secp521r1

} // namespace

Expand Down

0 comments on commit 4287993

Please sign in to comment.