aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/unit_ecc.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-02-21 11:29:23 -0500
committerJack Lloyd <[email protected]>2018-02-21 11:29:23 -0500
commit171e999ce1d6fd2b23e7a5f15b2b33ba9eed8403 (patch)
treedae3e80e8a89a95ac6bd5830cecb5369d4a69430 /src/tests/unit_ecc.cpp
parent1d07f8287a452420db969cafd61bc223214cff03 (diff)
Remove mutable worksspace from PointGFp
Was not thread safe, big problem now that we share elements in EC_Group
Diffstat (limited to 'src/tests/unit_ecc.cpp')
-rw-r--r--src/tests/unit_ecc.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/tests/unit_ecc.cpp b/src/tests/unit_ecc.cpp
index bd8295033..1a2f1d61c 100644
--- a/src/tests/unit_ecc.cpp
+++ b/src/tests/unit_ecc.cpp
@@ -130,13 +130,16 @@ std::vector<Test::Result> ECC_Randomized_Tests::run()
result.test_eq("infinite order correct", inf.is_zero(), true);
result.test_eq("infinity on the curve", inf.on_the_curve(), true);
+ std::vector<Botan::BigInt> blind_ws;
+
try
{
const size_t trials = (Test::run_long_tests() ? 10 : 3);
for(size_t i = 0; i < trials; ++i)
{
- const size_t h = 1 + (Test::rng().next_byte() % 8);
- Botan::Blinded_Point_Multiply blind(base_point, group_order, h);
+ const size_t w = 1 + (Test::rng().next_byte() % 8);
+
+ Botan::PointGFp_Blinded_Multiplier blinded(base_point, w);
const Botan::BigInt a = Botan::BigInt::random_integer(Test::rng(), 2, group_order);
const Botan::BigInt b = Botan::BigInt::random_integer(Test::rng(), 2, group_order);
@@ -146,9 +149,9 @@ std::vector<Test::Result> ECC_Randomized_Tests::run()
const Botan::PointGFp Q = base_point * b;
const Botan::PointGFp R = base_point * c;
- const Botan::PointGFp P1 = blind.blinded_multiply(a, Test::rng());
- const Botan::PointGFp Q1 = blind.blinded_multiply(b, Test::rng());
- const Botan::PointGFp R1 = blind.blinded_multiply(c, Test::rng());
+ const Botan::PointGFp P1 = blinded.mul(a, group_order, Test::rng(), blind_ws);
+ const Botan::PointGFp Q1 = blinded.mul(b, group_order, Test::rng(), blind_ws);
+ const Botan::PointGFp R1 = blinded.mul(c, group_order, Test::rng(), blind_ws);
const Botan::PointGFp A1 = P + Q;
const Botan::PointGFp A2 = Q + P;