aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-02-02 18:51:54 -0500
committerJack Lloyd <[email protected]>2018-02-04 07:33:00 -0500
commit912f3b6f042855b4983a7ee86250fc670e3738e5 (patch)
tree3e1739b481dca8079d66b60a0d799710c368affc /src/tests
parent0d63e98483e304a385013a4568312ab94dff3822 (diff)
Create a persistent registry for ECC group data
Now a single copy is maintained of each EC group info
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/unit_ecc.cpp26
-rw-r--r--src/tests/unit_x509.cpp3
2 files changed, 27 insertions, 2 deletions
diff --git a/src/tests/unit_ecc.cpp b/src/tests/unit_ecc.cpp
index 8d8cdb538..96e2438b3 100644
--- a/src/tests/unit_ecc.cpp
+++ b/src/tests/unit_ecc.cpp
@@ -806,6 +806,31 @@ Test::Result test_mult_sec_mass()
return result;
}
+Test::Result test_ecc_registration()
+ {
+ Test::Result result("ECC registration");
+
+ // secp112r1
+ const Botan::BigInt p("0xDB7C2ABF62E35E668076BEAD208B");
+ const Botan::BigInt a("0xDB7C2ABF62E35E668076BEAD2088");
+ const Botan::BigInt b("0x659EF8BA043916EEDE8911702B22");
+
+ const Botan::BigInt g_x("0x09487239995A5EE76B55F9C2F098");
+ const Botan::BigInt g_y("0xA89CE5AF8724C0A23E0E0FF77500");
+ const Botan::BigInt order("0xDB7C2ABF62E35E7628DFAC6561C5");
+
+ const Botan::OID oid("1.3.132.0.6");
+
+ // Creating this object implicitly registers the curve for future use ...
+ Botan::EC_Group reg_group(p, a, b, g_x, g_y, order, 1, oid);
+
+ Botan::EC_Group group(oid);
+
+ result.test_eq("Group registration worked", group.get_p(), p);
+
+ return result;
+ }
+
class ECC_Unit_Tests final : public Test
{
public:
@@ -836,6 +861,7 @@ class ECC_Unit_Tests final : public Test
results.push_back(test_mult_by_order());
results.push_back(test_point_swap());
results.push_back(test_mult_sec_mass());
+ results.push_back(test_ecc_registration());
return results;
}
diff --git a/src/tests/unit_x509.cpp b/src/tests/unit_x509.cpp
index 5ca5a2edc..94fa95392 100644
--- a/src/tests/unit_x509.cpp
+++ b/src/tests/unit_x509.cpp
@@ -1177,7 +1177,7 @@ class String_Extension final : public Botan::Certificate_Extension
Botan::OID oid_of() const override
{
- return m_oid;
+ return Botan::OID("1.2.3.4.5.6.7.8.9.1");
}
bool should_encode() const override
@@ -1205,7 +1205,6 @@ class String_Extension final : public Botan::Certificate_Extension
}
private:
- Botan::OID m_oid {"1.2.3.4.5.6.7.8.9.1"};
std::string m_contents;
};