From e5b9ee2345affb56307070298ded9c2d5e1914be Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Wed, 31 Jan 2018 14:03:05 -0500 Subject: Use shared representation of EC_Group Hide CurveGFp with an eye for eventual removal --- src/cli/pubkey.cpp | 6 +++--- src/cli/speed.cpp | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'src/cli') diff --git a/src/cli/pubkey.cpp b/src/cli/pubkey.cpp index ffe1470dc..0e515d2ea 100644 --- a/src/cli/pubkey.cpp +++ b/src/cli/pubkey.cpp @@ -340,9 +340,9 @@ class EC_Group_Info final : public Command } else { - output() << "P = " << std::hex << group.get_curve().get_p() << "\n" - << "A = " << std::hex << group.get_curve().get_a() << "\n" - << "B = " << std::hex << group.get_curve().get_b() << "\n" + output() << "P = " << std::hex << group.get_p() << "\n" + << "A = " << std::hex << group.get_a() << "\n" + << "B = " << std::hex << group.get_b() << "\n" << "G = " << group.get_base_point().get_affine_x() << "," << group.get_base_point().get_affine_y() << "\n"; } diff --git a/src/cli/speed.cpp b/src/cli/speed.cpp index 04b8cc3ff..7dbc7922c 100644 --- a/src/cli/speed.cpp +++ b/src/cli/speed.cpp @@ -1215,7 +1215,7 @@ class Speed final : public Command Timer mult_timer(group_name + " scalar mult"); Timer blinded_mult_timer(group_name + " blinded scalar mult"); - const Botan::BigInt scalar(rng(), group.get_curve().get_p().bits()); + const Botan::BigInt scalar(rng(), group.get_p_bits()); const Botan::PointGFp& base_point = group.get_base_point(); Botan::Blinded_Point_Multiply scalar_mult(base_point, group.get_order(), 4); @@ -1242,7 +1242,6 @@ class Speed final : public Command for(std::string group_name : groups) { const Botan::EC_Group group(group_name); - const Botan::CurveGFp& curve = group.get_curve(); while(uncmp_timer.under(runtime) && cmp_timer.under(runtime)) { @@ -1251,8 +1250,8 @@ class Speed final : public Command const Botan::secure_vector os_cmp = Botan::EC2OSP(p, Botan::PointGFp::COMPRESSED); const Botan::secure_vector os_uncmp = Botan::EC2OSP(p, Botan::PointGFp::UNCOMPRESSED); - uncmp_timer.run([&]() { OS2ECP(os_uncmp, curve); }); - cmp_timer.run([&]() { OS2ECP(os_cmp, curve); }); + uncmp_timer.run([&]() { group.OS2ECP(os_uncmp); }); + cmp_timer.run([&]() { group.OS2ECP(os_cmp); }); } record_result(uncmp_timer); -- cgit v1.2.3