diff options
author | Jack Lloyd <[email protected]> | 2018-02-07 15:07:37 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-02-07 15:07:37 -0500 |
commit | 08046d32318090bd6ef110c3e4bb0105453ef26f (patch) | |
tree | 609b4fa5bdbdd8e6107f661b3d474795c8e59b1f /src/tests | |
parent | 7604dd4702ae61f74f37a91ab8f5177f04db8108 (diff) | |
parent | 2cb0fa04472f4bc60f02d822daa8f4f8ad487e7e (diff) |
Merge GH #1441 Add a shared registry of EC_Group objects
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/unit_ecc.cpp | 26 | ||||
-rw-r--r-- | src/tests/unit_x509.cpp | 3 |
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; }; |