aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/unit_ecc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/unit_ecc.cpp')
-rw-r--r--src/tests/unit_ecc.cpp249
1 files changed, 137 insertions, 112 deletions
diff --git a/src/tests/unit_ecc.cpp b/src/tests/unit_ecc.cpp
index 1672c289d..e1e1a15ab 100644
--- a/src/tests/unit_ecc.cpp
+++ b/src/tests/unit_ecc.cpp
@@ -9,17 +9,17 @@
#include "tests.h"
#if defined(BOTAN_HAS_ECC_GROUP)
- #include <botan/bigint.h>
- #include <botan/numthry.h>
- #include <botan/curve_gfp.h>
- #include <botan/curve_nistp.h>
- #include <botan/point_gfp.h>
- #include <botan/ec_group.h>
- #include <botan/reducer.h>
- #include <botan/oids.h>
- #include <botan/hex.h>
- #include <botan/data_src.h>
- #include <botan/x509_key.h>
+ #include <botan/bigint.h>
+ #include <botan/numthry.h>
+ #include <botan/curve_gfp.h>
+ #include <botan/curve_nistp.h>
+ #include <botan/point_gfp.h>
+ #include <botan/ec_group.h>
+ #include <botan/reducer.h>
+ #include <botan/oids.h>
+ #include <botan/hex.h>
+ #include <botan/data_src.h>
+ #include <botan/x509_key.h>
#endif
namespace Botan_Tests {
@@ -28,31 +28,32 @@ namespace {
#if defined(BOTAN_HAS_ECC_GROUP)
-const std::vector<std::string> ec_groups = {
- "brainpool160r1",
- "brainpool192r1",
- "brainpool224r1",
- "brainpool256r1",
- "brainpool320r1",
- "brainpool384r1",
- "brainpool512r1",
- "gost_256A",
- "secp160k1",
- "secp160r1",
- "secp160r2",
- "secp192k1",
- "secp192r1",
- "secp224k1",
- "secp224r1",
- "secp256k1",
- "secp256r1",
- "secp384r1",
- "secp521r1",
- "x962_p192v2",
- "x962_p192v3",
- "x962_p239v1",
- "x962_p239v2",
- "x962_p239v3"
+const std::vector<std::string> ec_groups =
+ {
+ "brainpool160r1",
+ "brainpool192r1",
+ "brainpool224r1",
+ "brainpool256r1",
+ "brainpool320r1",
+ "brainpool384r1",
+ "brainpool512r1",
+ "gost_256A",
+ "secp160k1",
+ "secp160r1",
+ "secp160r2",
+ "secp192k1",
+ "secp192r1",
+ "secp224k1",
+ "secp224r1",
+ "secp256k1",
+ "secp256r1",
+ "secp384r1",
+ "secp521r1",
+ "x962_p192v2",
+ "x962_p192v3",
+ "x962_p239v1",
+ "x962_p239v2",
+ "x962_p239v3"
};
Botan::BigInt test_integer(Botan::RandomNumberGenerator& rng, size_t bits, BigInt max)
@@ -63,15 +64,22 @@ Botan::BigInt test_integer(Botan::RandomNumberGenerator& rng, size_t bits, BigIn
*/
Botan::BigInt x = 0;
- auto flip_prob = [](size_t i) -> double {
+ auto flip_prob = [](size_t i) -> double
+ {
if(i % 64 == 0)
+ {
return .5;
+ }
if(i % 32 == 0)
+ {
return .4;
+ }
if(i % 8 == 0)
+ {
return .05;
+ }
return .01;
- };
+ };
bool active = rng.next_byte() % 2;
for(size_t i = 0; i != bits; ++i)
@@ -83,7 +91,9 @@ Botan::BigInt test_integer(Botan::RandomNumberGenerator& rng, size_t bits, BigIn
const double sample = double(rng.next_byte() % 100) / 100.0; // biased
if(sample < prob)
+ {
active = !active;
+ }
}
if(max > 0)
@@ -132,7 +142,7 @@ class ECC_Randomized_Tests : public Test
std::vector<Test::Result> ECC_Randomized_Tests::run()
{
std::vector<Test::Result> results;
- for(auto&& group_name : ec_groups)
+ for(auto const& group_name : ec_groups)
{
Test::Result result("ECC randomized " + group_name);
@@ -217,7 +227,7 @@ class NIST_Curve_Reduction_Tests : public Test
const Botan::BigInt& p,
reducer_fn redc_fn)
{
- const Botan::BigInt p2 = p*p;
+ const Botan::BigInt p2 = p * p;
const size_t p_bits = p.bits();
Botan::Modular_Reducer p_redc(p);
@@ -230,7 +240,7 @@ class NIST_Curve_Reduction_Tests : public Test
for(size_t i = 0; i <= trials; ++i)
{
- const Botan::BigInt x = test_integer(Test::rng(), 2*p_bits, p2);
+ const Botan::BigInt x = test_integer(Test::rng(), 2 * p_bits, p2);
// TODO: time and report all three approaches
const Botan::BigInt v1 = x % p;
@@ -240,7 +250,7 @@ class NIST_Curve_Reduction_Tests : public Test
redc_fn(v3, ws);
if(!result.test_eq("reference redc", v1, v2) ||
- !result.test_eq("specialized redc", v2, v3))
+ !result.test_eq("specialized redc", v2, v3))
{
result.test_note("failing input" + Botan::hex_encode(Botan::BigInt::encode(x)));
}
@@ -287,7 +297,7 @@ Version 0.3;
Section 2.1.2
--------
*/
-Test::Result test_point_transformation ()
+Test::Result test_point_transformation()
{
Test::Result result("ECC Unit");
@@ -306,7 +316,7 @@ Test::Result test_point_transformation ()
return result;
}
-Test::Result test_point_mult ()
+Test::Result test_point_mult()
{
Test::Result result("ECC Unit");
@@ -348,8 +358,8 @@ Test::Result test_zeropoint()
const Botan::CurveGFp& curve = secp160r1.get_curve();
Botan::PointGFp p1(curve,
- Botan::BigInt("16984103820118642236896513183038186009872590470"),
- Botan::BigInt("1373093393927139016463695321221277758035357890939"));
+ Botan::BigInt("16984103820118642236896513183038186009872590470"),
+ Botan::BigInt("1373093393927139016463695321221277758035357890939"));
result.confirm("point is on the curve", p1.on_the_curve());
p1 -= p1;
@@ -387,8 +397,8 @@ Test::Result test_calc_with_zeropoint()
const Botan::CurveGFp& curve = secp160r1.get_curve();
Botan::PointGFp p(curve,
- Botan::BigInt("16984103820118642236896513183038186009872590470"),
- Botan::BigInt("1373093393927139016463695321221277758035357890939"));
+ Botan::BigInt("16984103820118642236896513183038186009872590470"),
+ Botan::BigInt("1373093393927139016463695321221277758035357890939"));
result.confirm("point is on the curve", p.on_the_curve());
result.confirm("point is not zero", !p.is_zero());
@@ -422,8 +432,8 @@ Test::Result test_add_point()
p1 += p0;
Botan::PointGFp expected(curve,
- Botan::BigInt("704859595002530890444080436569091156047721708633"),
- Botan::BigInt("1147993098458695153857594941635310323215433166682"));
+ Botan::BigInt("704859595002530890444080436569091156047721708633"),
+ Botan::BigInt("1147993098458695153857594941635310323215433166682"));
result.test_eq("point addition", p1, expected);
return result;
@@ -488,15 +498,15 @@ Test::Result test_basic_operations()
const Botan::PointGFp simplePlus = p1 + p0;
const Botan::PointGFp exp_simplePlus(curve,
- Botan::BigInt("704859595002530890444080436569091156047721708633"),
- Botan::BigInt("1147993098458695153857594941635310323215433166682"));
+ Botan::BigInt("704859595002530890444080436569091156047721708633"),
+ Botan::BigInt("1147993098458695153857594941635310323215433166682"));
result.test_eq("point addition", simplePlus, exp_simplePlus);
const Botan::PointGFp simpleMinus = p1 - p0;
const Botan::PointGFp exp_simpleMinus(curve,
- Botan::BigInt("425826231723888350446541592701409065913635568770"),
- Botan::BigInt("203520114162904107873991457957346892027982641970"));
+ Botan::BigInt("425826231723888350446541592701409065913635568770"),
+ Botan::BigInt("203520114162904107873991457957346892027982641970"));
result.test_eq("point subtraction", simpleMinus, exp_simpleMinus);
@@ -538,18 +548,18 @@ Test::Result test_enc_dec_compressed_256()
std::string b_secp = "5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B";
std::string G_secp_comp = "036B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296";
- std::vector<uint8_t> sv_p_secp = Botan::hex_decode ( p_secp );
- std::vector<uint8_t> sv_a_secp = Botan::hex_decode ( a_secp );
- std::vector<uint8_t> sv_b_secp = Botan::hex_decode ( b_secp );
- std::vector<uint8_t> sv_G_secp_comp = Botan::hex_decode ( G_secp_comp );
+ std::vector<uint8_t> sv_p_secp = Botan::hex_decode(p_secp);
+ std::vector<uint8_t> sv_a_secp = Botan::hex_decode(a_secp);
+ std::vector<uint8_t> sv_b_secp = Botan::hex_decode(b_secp);
+ std::vector<uint8_t> sv_G_secp_comp = Botan::hex_decode(G_secp_comp);
- Botan::BigInt bi_p_secp = Botan::BigInt::decode ( sv_p_secp.data(), sv_p_secp.size() );
- Botan::BigInt bi_a_secp = Botan::BigInt::decode ( sv_a_secp.data(), sv_a_secp.size() );
- Botan::BigInt bi_b_secp = Botan::BigInt::decode ( sv_b_secp.data(), sv_b_secp.size() );
+ Botan::BigInt bi_p_secp = Botan::BigInt::decode(sv_p_secp.data(), sv_p_secp.size());
+ Botan::BigInt bi_a_secp = Botan::BigInt::decode(sv_a_secp.data(), sv_a_secp.size());
+ Botan::BigInt bi_b_secp = Botan::BigInt::decode(sv_b_secp.data(), sv_b_secp.size());
Botan::CurveGFp curve(bi_p_secp, bi_a_secp, bi_b_secp);
- Botan::PointGFp p_G = OS2ECP ( sv_G_secp_comp, curve );
+ Botan::PointGFp p_G = OS2ECP(sv_G_secp_comp, curve);
std::vector<uint8_t> sv_result = unlock(EC2OSP(p_G, Botan::PointGFp::COMPRESSED));
result.test_eq("compressed_256", sv_result, sv_G_secp_comp);
@@ -568,18 +578,18 @@ Test::Result test_enc_dec_uncompressed_112()
std::string b_secp = "51DEF1815DB5ED74FCC34C85D709";
std::string G_secp_uncomp = "044BA30AB5E892B4E1649DD0928643ADCD46F5882E3747DEF36E956E97";
- std::vector<uint8_t> sv_p_secp = Botan::hex_decode ( p_secp );
- std::vector<uint8_t> sv_a_secp = Botan::hex_decode ( a_secp );
- std::vector<uint8_t> sv_b_secp = Botan::hex_decode ( b_secp );
- std::vector<uint8_t> sv_G_secp_uncomp = Botan::hex_decode ( G_secp_uncomp );
+ std::vector<uint8_t> sv_p_secp = Botan::hex_decode(p_secp);
+ std::vector<uint8_t> sv_a_secp = Botan::hex_decode(a_secp);
+ std::vector<uint8_t> sv_b_secp = Botan::hex_decode(b_secp);
+ std::vector<uint8_t> sv_G_secp_uncomp = Botan::hex_decode(G_secp_uncomp);
- Botan::BigInt bi_p_secp = Botan::BigInt::decode ( sv_p_secp.data(), sv_p_secp.size() );
- Botan::BigInt bi_a_secp = Botan::BigInt::decode ( sv_a_secp.data(), sv_a_secp.size() );
- Botan::BigInt bi_b_secp = Botan::BigInt::decode ( sv_b_secp.data(), sv_b_secp.size() );
+ Botan::BigInt bi_p_secp = Botan::BigInt::decode(sv_p_secp.data(), sv_p_secp.size());
+ Botan::BigInt bi_a_secp = Botan::BigInt::decode(sv_a_secp.data(), sv_a_secp.size());
+ Botan::BigInt bi_b_secp = Botan::BigInt::decode(sv_b_secp.data(), sv_b_secp.size());
Botan::CurveGFp curve(bi_p_secp, bi_a_secp, bi_b_secp);
- Botan::PointGFp p_G = OS2ECP ( sv_G_secp_uncomp, curve );
+ Botan::PointGFp p_G = OS2ECP(sv_G_secp_uncomp, curve);
std::vector<uint8_t> sv_result = unlock(EC2OSP(p_G, Botan::PointGFp::UNCOMPRESSED));
result.test_eq("uncompressed_112", sv_result, sv_G_secp_uncomp);
@@ -591,23 +601,27 @@ Test::Result test_enc_dec_uncompressed_521()
Test::Result result("ECC Unit");
// Test for uncompressed conversion(04) with big values(521 bit)
- std::string p_secp = "01ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff";
- std::string a_secp = "01ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffFC";
- std::string b_secp = "0051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00";
- std::string G_secp_uncomp = "0400C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2ffA8DE3348B3C1856A429BF97E7E31C2E5BD66011839296A789A3BC0045C8A5FB42C7D1BD998F54449579B446817AFBD17273E662C97EE72995EF42640C550B9013FAD0761353C7086A272C24088BE94769FD16650";
-
- std::vector<uint8_t> sv_p_secp = Botan::hex_decode ( p_secp );
- std::vector<uint8_t> sv_a_secp = Botan::hex_decode ( a_secp );
- std::vector<uint8_t> sv_b_secp = Botan::hex_decode ( b_secp );
- std::vector<uint8_t> sv_G_secp_uncomp = Botan::hex_decode ( G_secp_uncomp );
-
- Botan::BigInt bi_p_secp = Botan::BigInt::decode ( sv_p_secp.data(), sv_p_secp.size() );
- Botan::BigInt bi_a_secp = Botan::BigInt::decode ( sv_a_secp.data(), sv_a_secp.size() );
- Botan::BigInt bi_b_secp = Botan::BigInt::decode ( sv_b_secp.data(), sv_b_secp.size() );
+ std::string p_secp =
+ "01ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff";
+ std::string a_secp =
+ "01ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffFC";
+ std::string b_secp =
+ "0051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00";
+ std::string G_secp_uncomp =
+ "0400C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2ffA8DE3348B3C1856A429BF97E7E31C2E5BD66011839296A789A3BC0045C8A5FB42C7D1BD998F54449579B446817AFBD17273E662C97EE72995EF42640C550B9013FAD0761353C7086A272C24088BE94769FD16650";
+
+ std::vector<uint8_t> sv_p_secp = Botan::hex_decode(p_secp);
+ std::vector<uint8_t> sv_a_secp = Botan::hex_decode(a_secp);
+ std::vector<uint8_t> sv_b_secp = Botan::hex_decode(b_secp);
+ std::vector<uint8_t> sv_G_secp_uncomp = Botan::hex_decode(G_secp_uncomp);
+
+ Botan::BigInt bi_p_secp = Botan::BigInt::decode(sv_p_secp.data(), sv_p_secp.size());
+ Botan::BigInt bi_a_secp = Botan::BigInt::decode(sv_a_secp.data(), sv_a_secp.size());
+ Botan::BigInt bi_b_secp = Botan::BigInt::decode(sv_b_secp.data(), sv_b_secp.size());
Botan::CurveGFp curve(bi_p_secp, bi_a_secp, bi_b_secp);
- Botan::PointGFp p_G = Botan::OS2ECP ( sv_G_secp_uncomp, curve );
+ Botan::PointGFp p_G = Botan::OS2ECP(sv_G_secp_uncomp, curve);
std::vector<uint8_t> sv_result = unlock(EC2OSP(p_G, Botan::PointGFp::UNCOMPRESSED));
@@ -620,26 +634,30 @@ Test::Result test_enc_dec_uncompressed_521_prime_too_large()
Test::Result result("ECC Unit");
// Test for uncompressed conversion(04) with big values(521 bit)
- std::string p_secp = "01ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"; // length increased by "ff"
- std::string a_secp = "01ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffFC";
- std::string b_secp = "0051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00";
- std::string G_secp_uncomp = "0400C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2ffA8DE3348B3C1856A429BF97E7E31C2E5BD66011839296A789A3BC0045C8A5FB42C7D1BD998F54449579B446817AFBD17273E662C97EE72995EF42640C550B9013FAD0761353C7086A272C24088BE94769FD16650";
-
- std::vector<uint8_t> sv_p_secp = Botan::hex_decode ( p_secp );
- std::vector<uint8_t> sv_a_secp = Botan::hex_decode ( a_secp );
- std::vector<uint8_t> sv_b_secp = Botan::hex_decode ( b_secp );
- std::vector<uint8_t> sv_G_secp_uncomp = Botan::hex_decode ( G_secp_uncomp );
-
- Botan::BigInt bi_p_secp = Botan::BigInt::decode ( sv_p_secp.data(), sv_p_secp.size() );
- Botan::BigInt bi_a_secp = Botan::BigInt::decode ( sv_a_secp.data(), sv_a_secp.size() );
- Botan::BigInt bi_b_secp = Botan::BigInt::decode ( sv_b_secp.data(), sv_b_secp.size() );
-
- Botan::CurveGFp secp521r1 (bi_p_secp, bi_a_secp, bi_b_secp);
+ std::string p_secp =
+ "01ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"; // length increased by "ff"
+ std::string a_secp =
+ "01ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffFC";
+ std::string b_secp =
+ "0051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00";
+ std::string G_secp_uncomp =
+ "0400C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2ffA8DE3348B3C1856A429BF97E7E31C2E5BD66011839296A789A3BC0045C8A5FB42C7D1BD998F54449579B446817AFBD17273E662C97EE72995EF42640C550B9013FAD0761353C7086A272C24088BE94769FD16650";
+
+ std::vector<uint8_t> sv_p_secp = Botan::hex_decode(p_secp);
+ std::vector<uint8_t> sv_a_secp = Botan::hex_decode(a_secp);
+ std::vector<uint8_t> sv_b_secp = Botan::hex_decode(b_secp);
+ std::vector<uint8_t> sv_G_secp_uncomp = Botan::hex_decode(G_secp_uncomp);
+
+ Botan::BigInt bi_p_secp = Botan::BigInt::decode(sv_p_secp.data(), sv_p_secp.size());
+ Botan::BigInt bi_a_secp = Botan::BigInt::decode(sv_a_secp.data(), sv_a_secp.size());
+ Botan::BigInt bi_b_secp = Botan::BigInt::decode(sv_b_secp.data(), sv_b_secp.size());
+
+ Botan::CurveGFp secp521r1(bi_p_secp, bi_a_secp, bi_b_secp);
std::unique_ptr<Botan::PointGFp> p_G;
try
{
- p_G = std::unique_ptr<Botan::PointGFp>(new Botan::PointGFp(Botan::OS2ECP ( sv_G_secp_uncomp, secp521r1)));
+ p_G = std::unique_ptr<Botan::PointGFp>(new Botan::PointGFp(Botan::OS2ECP(sv_G_secp_uncomp, secp521r1)));
result.test_failure("point decoding with too large value accepted");
}
catch(std::exception&)
@@ -671,16 +689,20 @@ Test::Result test_cdc_curve_33()
{
Test::Result result("ECC Unit");
- std::string G_secp_uncomp = "04081523d03d4f12cd02879dea4bf6a4f3a7df26ed888f10c5b2235a1274c386a2f218300dee6ed217841164533bcdc903f07a096f9fbf4ee95bac098a111f296f5830fe5c35b3e344d5df3a2256985f64fbe6d0edcc4c61d18bef681dd399df3d0194c5a4315e012e0245ecea56365baa9e8be1f7";
+ std::string G_secp_uncomp =
+ "04081523d03d4f12cd02879dea4bf6a4f3a7df26ed888f10c5b2235a1274c386a2f218300dee6ed217841164533bcdc903f07a096f9fbf4ee95bac098a111f296f5830fe5c35b3e344d5df3a2256985f64fbe6d0edcc4c61d18bef681dd399df3d0194c5a4315e012e0245ecea56365baa9e8be1f7";
- std::vector<uint8_t> sv_G_uncomp = Botan::hex_decode ( G_secp_uncomp );
+ std::vector<uint8_t> sv_G_uncomp = Botan::hex_decode(G_secp_uncomp);
- Botan::BigInt bi_p_secp = Botan::BigInt("2117607112719756483104013348936480976596328609518055062007450442679169492999007105354629105748524349829824407773719892437896937279095106809");
- Botan::BigInt bi_a_secp("0xa377dede6b523333d36c78e9b0eaa3bf48ce93041f6d4fc34014d08f6833807498deedd4290101c5866e8dfb589485d13357b9e78c2d7fbe9fe");
- Botan::BigInt bi_b_secp("0xa9acf8c8ba617777e248509bcb4717d4db346202bf9e352cd5633731dd92a51b72a4dc3b3d17c823fcc8fbda4da08f25dea89046087342595a7");
+ Botan::BigInt bi_p_secp =
+ Botan::BigInt("2117607112719756483104013348936480976596328609518055062007450442679169492999007105354629105748524349829824407773719892437896937279095106809");
+ Botan::BigInt
+ bi_a_secp("0xa377dede6b523333d36c78e9b0eaa3bf48ce93041f6d4fc34014d08f6833807498deedd4290101c5866e8dfb589485d13357b9e78c2d7fbe9fe");
+ Botan::BigInt
+ bi_b_secp("0xa9acf8c8ba617777e248509bcb4717d4db346202bf9e352cd5633731dd92a51b72a4dc3b3d17c823fcc8fbda4da08f25dea89046087342595a7");
Botan::CurveGFp curve(bi_p_secp, bi_a_secp, bi_b_secp);
- Botan::PointGFp p_G = Botan::OS2ECP ( sv_G_uncomp, curve);
+ Botan::PointGFp p_G = Botan::OS2ECP(sv_G_uncomp, curve);
result.confirm("point is on the curve", p_G.on_the_curve());
return result;
}
@@ -695,8 +717,8 @@ Test::Result test_more_zeropoint()
const Botan::CurveGFp& curve = secp160r1.get_curve();
Botan::PointGFp p1(curve,
- Botan::BigInt("16984103820118642236896513183038186009872590470"),
- Botan::BigInt("1373093393927139016463695321221277758035357890939"));
+ Botan::BigInt("16984103820118642236896513183038186009872590470"),
+ Botan::BigInt("1373093393927139016463695321221277758035357890939"));
result.confirm("point is on the curve", p1.on_the_curve());
Botan::PointGFp minus_p1 = -p1;
@@ -760,7 +782,7 @@ Test::Result test_mult_sec_mass()
Test::Result result("ECC Unit");
Botan::EC_Group dom_pars(Botan::OID("1.3.132.0.8"));
- for(int i = 0; i<50; i++)
+ for(int i = 0; i < 50; i++)
{
try
{
@@ -806,8 +828,8 @@ class ECC_Unit_Tests : public Test
std::vector<Test::Result> results;
results.push_back(test_coordinates());
- results.push_back(test_point_transformation ());
- results.push_back(test_point_mult ());
+ results.push_back(test_point_transformation());
+ results.push_back(test_point_mult());
results.push_back(test_point_negative());
results.push_back(test_zeropoint());
results.push_back(test_zeropoint_enc_dec());
@@ -841,7 +863,10 @@ class ECC_Invalid_Key_Tests : public Text_Based_Test
ECC_Invalid_Key_Tests() :
Text_Based_Test("pubkey/ecc_invalid.vec", "SubjectPublicKey") {}
- bool clear_between_callbacks() const override { return false; }
+ bool clear_between_callbacks() const override
+ {
+ return false;
+ }
Test::Result run_one_test(const std::string&, const VarMap& vars) override
{