aboutsummaryrefslogtreecommitdiffstats
path: root/src/cli
diff options
context:
space:
mode:
authorRenĂ© Fischer <[email protected]>2020-06-05 18:40:53 +0200
committerRenĂ© Fischer <[email protected]>2020-06-05 18:42:44 +0200
commitc681615785fd929a3f2d8543305fd8b29e6d0048 (patch)
treeeb5f6605ebab0843a4924f461b1df820987fda0d /src/cli
parent774d51448143f184c3ef8eb5ae847d98911f4cae (diff)
Fix cppcheck findings
Diffstat (limited to 'src/cli')
-rw-r--r--src/cli/pubkey.cpp22
-rw-r--r--src/cli/speed.cpp26
2 files changed, 24 insertions, 24 deletions
diff --git a/src/cli/pubkey.cpp b/src/cli/pubkey.cpp
index 39923bc1f..af68befd6 100644
--- a/src/cli/pubkey.cpp
+++ b/src/cli/pubkey.cpp
@@ -384,19 +384,19 @@ class EC_Group_Info final : public Command
void go() override
{
- Botan::EC_Group group(get_arg("name"));
+ Botan::EC_Group ec_group(get_arg("name"));
if(flag_set("pem"))
{
- output() << group.PEM_encode();
+ output() << ec_group.PEM_encode();
}
else
{
- output() << "P = " << std::hex << group.get_p() << "\n"
- << "A = " << std::hex << group.get_a() << "\n"
- << "B = " << std::hex << group.get_b() << "\n"
- << "N = " << std::hex << group.get_order() << "\n"
- << "G = " << group.get_g_x() << "," << group.get_g_y() << "\n";
+ output() << "P = " << std::hex << ec_group.get_p() << "\n"
+ << "A = " << std::hex << ec_group.get_a() << "\n"
+ << "B = " << std::hex << ec_group.get_b() << "\n"
+ << "N = " << std::hex << ec_group.get_order() << "\n"
+ << "G = " << ec_group.get_g_x() << "," << ec_group.get_g_y() << "\n";
}
}
@@ -425,16 +425,16 @@ class DL_Group_Info final : public Command
void go() override
{
- Botan::DL_Group group(get_arg("name"));
+ Botan::DL_Group ec_group(get_arg("name"));
if(flag_set("pem"))
{
- output() << group.PEM_encode(Botan::DL_Group::ANSI_X9_42_DH_PARAMETERS);
+ output() << ec_group.PEM_encode(Botan::DL_Group::ANSI_X9_42_DH_PARAMETERS);
}
else
{
- output() << "P = " << std::hex << group.get_p() << "\n"
- << "G = " << group.get_g() << "\n";
+ output() << "P = " << std::hex << ec_group.get_p() << "\n"
+ << "G = " << ec_group.get_g() << "\n";
}
}
diff --git a/src/cli/speed.cpp b/src/cli/speed.cpp
index a3e730d80..09ad76d95 100644
--- a/src/cli/speed.cpp
+++ b/src/cli/speed.cpp
@@ -1128,15 +1128,15 @@ class Speed final : public Command
{
for(std::string group_name : groups)
{
- const Botan::EC_Group group(group_name);
+ const Botan::EC_Group ec_group(group_name);
std::unique_ptr<Timer> add_timer = make_timer(group_name + " add");
std::unique_ptr<Timer> addf_timer = make_timer(group_name + " addf");
std::unique_ptr<Timer> dbl_timer = make_timer(group_name + " dbl");
- const Botan::PointGFp& base_point = group.get_base_point();
- Botan::PointGFp non_affine_pt = group.get_base_point() * 1776; // create a non-affine point
- Botan::PointGFp pt = group.get_base_point();
+ const Botan::PointGFp& base_point = ec_group.get_base_point();
+ Botan::PointGFp non_affine_pt = ec_group.get_base_point() * 1776; // create a non-affine point
+ Botan::PointGFp pt = ec_group.get_base_point();
std::vector<Botan::BigInt> ws(Botan::PointGFp::WORKSPACE_SIZE);
@@ -1173,13 +1173,13 @@ class Speed final : public Command
{
for(std::string group_name : groups)
{
- const Botan::EC_Group group(group_name);
+ const Botan::EC_Group ec_group(group_name);
std::unique_ptr<Timer> mult_timer = make_timer(group_name + " Montgomery ladder");
std::unique_ptr<Timer> blinded_mult_timer = make_timer(group_name + " blinded comb");
std::unique_ptr<Timer> blinded_var_mult_timer = make_timer(group_name + " blinded window");
- const Botan::PointGFp& base_point = group.get_base_point();
+ const Botan::PointGFp& base_point = ec_group.get_base_point();
std::vector<Botan::BigInt> ws;
@@ -1187,15 +1187,15 @@ class Speed final : public Command
blinded_mult_timer->under(runtime) &&
blinded_var_mult_timer->under(runtime))
{
- const Botan::BigInt scalar(rng(), group.get_p_bits());
+ const Botan::BigInt scalar(rng(), ec_group.get_p_bits());
const Botan::PointGFp r1 = mult_timer->run([&]() { return base_point * scalar; });
const Botan::PointGFp r2 = blinded_mult_timer->run(
- [&]() { return group.blinded_base_point_multiply(scalar, rng(), ws); });
+ [&]() { return ec_group.blinded_base_point_multiply(scalar, rng(), ws); });
const Botan::PointGFp r3 = blinded_var_mult_timer->run(
- [&]() { return group.blinded_var_point_multiply(base_point, scalar, rng(), ws); });
+ [&]() { return ec_group.blinded_var_point_multiply(base_point, scalar, rng(), ws); });
BOTAN_ASSERT_EQUAL(r1, r2, "Same point computed by Montgomery and comb");
BOTAN_ASSERT_EQUAL(r1, r3, "Same point computed by Montgomery and window");
@@ -1214,17 +1214,17 @@ class Speed final : public Command
for(std::string group_name : groups)
{
- const Botan::EC_Group group(group_name);
+ const Botan::EC_Group ec_group(group_name);
while(uncmp_timer->under(runtime) && cmp_timer->under(runtime))
{
const Botan::BigInt k(rng(), 256);
- const Botan::PointGFp p = group.get_base_point() * k;
+ const Botan::PointGFp p = ec_group.get_base_point() * k;
const std::vector<uint8_t> os_cmp = p.encode(Botan::PointGFp::COMPRESSED);
const std::vector<uint8_t> os_uncmp = p.encode(Botan::PointGFp::UNCOMPRESSED);
- uncmp_timer->run([&]() { group.OS2ECP(os_uncmp); });
- cmp_timer->run([&]() { group.OS2ECP(os_cmp); });
+ uncmp_timer->run([&]() { ec_group.OS2ECP(os_uncmp); });
+ cmp_timer->run([&]() { ec_group.OS2ECP(os_cmp); });
}
record_result(uncmp_timer);