From 4287993bead18bceac43780ae1e9a3a69c61c514 Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Tue, 11 Jun 2024 07:55:32 -0400 Subject: [PATCH] Small cleanups in P-521 pcurve code --- .../pcurves_secp521r1/pcurves_secp521r1.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/lib/math/pcurves/pcurves_secp521r1/pcurves_secp521r1.cpp b/src/lib/math/pcurves/pcurves_secp521r1/pcurves_secp521r1.cpp index cf926b7340e..ba3afdbb400 100644 --- a/src/lib/math/pcurves/pcurves_secp521r1/pcurves_secp521r1.cpp +++ b/src/lib/math/pcurves/pcurves_secp521r1/pcurves_secp521r1.cpp @@ -12,7 +12,6 @@ namespace Botan::PCurve { namespace { -// clang-format off namespace secp521r1 { template @@ -22,11 +21,7 @@ class P521Rep final { static constexpr size_t N = Params::N; typedef typename Params::W W; - constexpr static std::array one() { - std::array one = {}; - one[0] = 1; - return one; - } + constexpr static std::array one() { return std::array{1}; } constexpr static std::array redc(const std::array& z) { constexpr W TOP_MASK = static_cast(0x1FF); @@ -58,6 +53,7 @@ class P521Rep final { constexpr static std::array from_rep(const std::array& z) { return z; } }; +// clang-format off class Params final : public EllipticCurveParameters< "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC", @@ -68,11 +64,11 @@ class Params final : public EllipticCurveParameters< -4> { }; -class Curve final : public EllipticCurve {}; +// clang-format on -} +class Curve final : public EllipticCurve {}; -// clang-format on +} // namespace secp521r1 } // namespace