diff options
author | lloyd <[email protected]> | 2010-02-24 13:23:12 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-02-24 13:23:12 +0000 |
commit | 27d84b179913a82849c3994e8724dbec379dab52 (patch) | |
tree | 83634362c2d0ee146ef9a2104722dc3f5491088d /checks/ec_tests.cpp | |
parent | 7424a5b5102b569e3c052cb195c98b5d1b60ce30 (diff) | |
parent | f849aab38b36c68217e98d1bfc8d8ef8f0e3c027 (diff) |
propagate from branch 'net.randombit.botan' (head 2b67727dd9d1e7fe34f3cb7b7f6715ba42a04918)
to branch 'net.randombit.botan.c++0x' (head 1e2e1596f2b4928c2b7bfba624ea5e4ac69dfdad)
Diffstat (limited to 'checks/ec_tests.cpp')
-rw-r--r-- | checks/ec_tests.cpp | 43 |
1 files changed, 10 insertions, 33 deletions
diff --git a/checks/ec_tests.cpp b/checks/ec_tests.cpp index fdd333b1f..1820db1b6 100644 --- a/checks/ec_tests.cpp +++ b/checks/ec_tests.cpp @@ -85,16 +85,16 @@ void test_point_turn_on_sp_red_mul() CHECK_MESSAGE(r1 == r2, "error with point mul after extra turn on sp red mul"); CHECK(r1.get_affine_x().get_value() != BigInt("0")); - std::shared_ptr<PointGFp> p_r1(new PointGFp(r1)); - std::shared_ptr<PointGFp> p_r2(new PointGFp(r2)); - - p_r1->mult2_in_place(); // wird für Fehler nicht gebraucht - p_r2->turn_on_sp_red_mul(); // 1. t_o() macht nur p_r2 kaputt - p_r2->turn_on_sp_red_mul(); // 2. t_o() macht auch p_r1 kaputt!!! - p_r2->mult2_in_place(); // wird für Fehler nicht gebraucht - CHECK_MESSAGE(p_r1->get_affine_x() == p_r2->get_affine_x(), "error with mult2 after extra turn on sp red mul"); - CHECK(p_r1->get_affine_x().get_value() != BigInt("0")); - CHECK(p_r2->get_affine_x().get_value() != BigInt("0")); + PointGFp p_r1 = r1; + PointGFp p_r2 = r2; + + p_r1.mult2_in_place(); // wird für Fehler nicht gebraucht + p_r2.turn_on_sp_red_mul(); // 1. t_o() macht nur p_r2 kaputt + p_r2.turn_on_sp_red_mul(); // 2. t_o() macht auch p_r1 kaputt!!! + p_r2.mult2_in_place(); // wird für Fehler nicht gebraucht + CHECK_MESSAGE(p_r1.get_affine_x() == p_r2.get_affine_x(), "error with mult2 after extra turn on sp red mul"); + CHECK(p_r1.get_affine_x().get_value() != BigInt("0")); + CHECK(p_r2.get_affine_x().get_value() != BigInt("0")); r1.mult2_in_place(); r2.turn_on_sp_red_mul(); @@ -1072,28 +1072,6 @@ void test_mult_sec_mass(RandomNumberGenerator& rng) } } -/** -* The following test verifies that PointGFps copy-ctor and assignment operator -* produce non-sharing Objects -*/ -void test_point_ctors_ass_unshared() - { - std::cout << "." << std::flush; - - EC_Domain_Params dom_pars(get_EC_Dom_Pars_by_oid("1.3.132.0.8")); - PointGFp p = dom_pars.get_base_point(); - PointGFp ind_cpy(p); - - // doesn´t work this way, because getters of point return an independent copy! - CHECK(p.get_jac_proj_x().get_ptr_mod().get() != ind_cpy.get_jac_proj_x().get_ptr_mod().get()); - //CHECK(p.get_x().get_ptr_r().get() != ind_cpy.get_x().get_ptr_r().get()); - - PointGFp ind_ass(p); - ind_ass = p; - CHECK(p.get_jac_proj_x().get_ptr_mod().get() != ind_ass.get_jac_proj_x().get_ptr_mod().get()); - //CHECK(p.get_x().get_ptr_r().get() != ind_ass.get_x().get_ptr_r().get()); - } - void test_curve_cp_ctor() { std::cout << "." << std::flush; @@ -1216,7 +1194,6 @@ void do_ec_tests(RandomNumberGenerator& rng) test_point_swap(rng); test_mult_sec(); test_mult_sec_mass(rng); - test_point_ctors_ass_unshared(); test_curve_cp_ctor(); test_ec_key_cp_and_assignment(rng); test_ec_key_cast(rng); |