Skip to content

Commit

Permalink
Merge pull request #4136 from randombit/jack/avoid-2-tables
Browse files Browse the repository at this point in the history
Avoid duplicating basepoint multiplication tables
  • Loading branch information
randombit authored Jun 18, 2024
2 parents d6b35ca + f43bbbf commit 8f43122
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ class Curve final : public EllipticCurve<Params> {};
} // namespace

std::shared_ptr<const PrimeOrderCurve> PCurveInstance::brainpool256r1() {
static auto g_brainpool256r1 = std::make_shared<const PrimeOrderCurveImpl<brainpool256r1::Curve>>();
return g_brainpool256r1;
return PrimeOrderCurveImpl<brainpool256r1::Curve>::instance();
}

} // namespace Botan::PCurve
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ class Curve final : public EllipticCurve<Params> {};
} // namespace

std::shared_ptr<const PrimeOrderCurve> PCurveInstance::brainpool384r1() {
static auto g_brainpool384r1 = std::make_shared<const PrimeOrderCurveImpl<brainpool384r1::Curve>>();
return g_brainpool384r1;
return PrimeOrderCurveImpl<brainpool384r1::Curve>::instance();
}

} // namespace Botan::PCurve
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ class Curve final : public EllipticCurve<Params> {};
} // namespace

std::shared_ptr<const PrimeOrderCurve> PCurveInstance::brainpool512r1() {
static auto g_brainpool512r1 = std::make_shared<const PrimeOrderCurveImpl<brainpool512r1::Curve>>();
return g_brainpool512r1;
return PrimeOrderCurveImpl<brainpool512r1::Curve>::instance();
}

} // namespace Botan::PCurve
3 changes: 1 addition & 2 deletions src/lib/math/pcurves/pcurves_frp256v1/pcurves_frp256v1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ class Curve final : public EllipticCurve<Params> {};
} // namespace

std::shared_ptr<const PrimeOrderCurve> PCurveInstance::frp256v1() {
static auto g_frp256v1 = std::make_shared<const PrimeOrderCurveImpl<frp256v1::Curve>>();
return g_frp256v1;
return PrimeOrderCurveImpl<frp256v1::Curve>::instance();
}

} // namespace Botan::PCurve
3 changes: 1 addition & 2 deletions src/lib/math/pcurves/pcurves_secp256k1/pcurves_secp256k1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ class Curve final : public EllipticCurve<Params> {};
} // namespace

std::shared_ptr<const PrimeOrderCurve> PCurveInstance::secp256k1() {
static auto g_secp256k1 = std::make_shared<const PrimeOrderCurveImpl<secp256k1::Curve>>();
return g_secp256k1;
return PrimeOrderCurveImpl<secp256k1::Curve>::instance();
}

} // namespace Botan::PCurve
3 changes: 1 addition & 2 deletions src/lib/math/pcurves/pcurves_secp256r1/pcurves_secp256r1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ class Curve final : public EllipticCurve<Params> {};
} // namespace

std::shared_ptr<const PrimeOrderCurve> PCurveInstance::secp256r1() {
static auto g_secp256r1 = std::make_shared<const PrimeOrderCurveImpl<secp256r1::Curve>>();
return g_secp256r1;
return PrimeOrderCurveImpl<secp256r1::Curve>::instance();
}

} // namespace Botan::PCurve
3 changes: 1 addition & 2 deletions src/lib/math/pcurves/pcurves_secp384r1/pcurves_secp384r1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ class Curve final : public EllipticCurve<Params> {};
} // namespace

std::shared_ptr<const PrimeOrderCurve> PCurveInstance::secp384r1() {
static auto g_secp384r1 = std::make_shared<const PrimeOrderCurveImpl<secp384r1::Curve>>();
return g_secp384r1;
return PrimeOrderCurveImpl<secp384r1::Curve>::instance();
}

} // namespace Botan::PCurve
3 changes: 1 addition & 2 deletions src/lib/math/pcurves/pcurves_secp521r1/pcurves_secp521r1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ class Curve final : public EllipticCurve<Params, P521Rep> {};
} // namespace

std::shared_ptr<const PrimeOrderCurve> PCurveInstance::secp521r1() {
static auto g_secp521r1 = std::make_shared<const PrimeOrderCurveImpl<secp521r1::Curve>>();
return g_secp521r1;
return PrimeOrderCurveImpl<secp521r1::Curve>::instance();
}

} // namespace Botan::PCurve
3 changes: 1 addition & 2 deletions src/lib/math/pcurves/pcurves_sm2p256v1/pcurves_sm2p256v1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ class Curve final : public EllipticCurve<Params> {};
} // namespace

std::shared_ptr<const PrimeOrderCurve> PCurveInstance::sm2p256v1() {
static auto g_sm2p256v1 = std::make_shared<const PrimeOrderCurveImpl<sm2p256v1::Curve>>();
return g_sm2p256v1;
return PrimeOrderCurveImpl<sm2p256v1::Curve>::instance();
}

} // namespace Botan::PCurve

0 comments on commit 8f43122

Please sign in to comment.