aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-08-06 15:21:07 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-09-11 13:38:32 +0000
commit2bf636503fa09346b02964b2903ca70579f94c6b (patch)
tree8aba79518b97e20c52914759f3cb4c5bbc0d7b39 /tests
parentbulletproofs: scale points by 8 to ensure subgroup validity (diff)
downloadmonero-2bf636503fa09346b02964b2903ca70579f94c6b.tar.xz
bulletproofs: speed up the latest changes a bit
Diffstat (limited to 'tests')
-rw-r--r--tests/performance_tests/crypto_ops.h4
-rw-r--r--tests/performance_tests/main.cpp2
-rw-r--r--tests/unit_tests/ringct.cpp7
3 files changed, 13 insertions, 0 deletions
diff --git a/tests/performance_tests/crypto_ops.h b/tests/performance_tests/crypto_ops.h
index f52faa708..3c68583c5 100644
--- a/tests/performance_tests/crypto_ops.h
+++ b/tests/performance_tests/crypto_ops.h
@@ -45,6 +45,8 @@ enum test_op
op_addKeys,
op_scalarmultBase,
op_scalarmultKey,
+ op_scalarmultH,
+ op_scalarmult8,
op_ge_double_scalarmult_base_vartime,
op_ge_double_scalarmult_precomp_vartime,
op_ge_double_scalarmult_precomp_vartime2,
@@ -97,6 +99,8 @@ public:
case op_addKeys: rct::addKeys(key, point0, point1); break;
case op_scalarmultBase: rct::scalarmultBase(scalar0); break;
case op_scalarmultKey: rct::scalarmultKey(point0, scalar0); break;
+ case op_scalarmultH: rct::scalarmultH(scalar0); break;
+ case op_scalarmult8: rct::scalarmult8(point0); break;
case op_ge_double_scalarmult_base_vartime: ge_double_scalarmult_base_vartime(&tmp_p2, scalar0.bytes, &p3_0, scalar1.bytes); break;
case op_ge_double_scalarmult_precomp_vartime: ge_double_scalarmult_precomp_vartime(&tmp_p2, scalar0.bytes, &p3_0, scalar1.bytes, precomp0); break;
case op_ge_double_scalarmult_precomp_vartime2: ge_double_scalarmult_precomp_vartime2(&tmp_p2, scalar0.bytes, precomp0, scalar1.bytes, precomp1); break;
diff --git a/tests/performance_tests/main.cpp b/tests/performance_tests/main.cpp
index d83486296..7c5135c65 100644
--- a/tests/performance_tests/main.cpp
+++ b/tests/performance_tests/main.cpp
@@ -247,6 +247,8 @@ int main(int argc, char** argv)
TEST_PERFORMANCE1(filter, p, test_crypto_ops, op_addKeys);
TEST_PERFORMANCE1(filter, p, test_crypto_ops, op_scalarmultBase);
TEST_PERFORMANCE1(filter, p, test_crypto_ops, op_scalarmultKey);
+ TEST_PERFORMANCE1(filter, p, test_crypto_ops, op_scalarmultH);
+ TEST_PERFORMANCE1(filter, p, test_crypto_ops, op_scalarmult8);
TEST_PERFORMANCE1(filter, p, test_crypto_ops, op_ge_double_scalarmult_base_vartime);
TEST_PERFORMANCE1(filter, p, test_crypto_ops, op_ge_double_scalarmult_precomp_vartime);
TEST_PERFORMANCE1(filter, p, test_crypto_ops, op_ge_double_scalarmult_precomp_vartime2);
diff --git a/tests/unit_tests/ringct.cpp b/tests/unit_tests/ringct.cpp
index 360529b9e..3877ef785 100644
--- a/tests/unit_tests/ringct.cpp
+++ b/tests/unit_tests/ringct.cpp
@@ -1093,6 +1093,13 @@ TEST(ringct, H)
ASSERT_EQ(memcmp(&p3, &ge_p3_H, sizeof(ge_p3)), 0);
}
+TEST(ringct, mul8)
+{
+ ASSERT_EQ(rct::scalarmult8(rct::identity()), rct::identity());
+ ASSERT_EQ(rct::scalarmult8(rct::H), rct::scalarmultKey(rct::H, rct::EIGHT));
+ ASSERT_EQ(rct::scalarmultKey(rct::scalarmultKey(rct::H, rct::INV_EIGHT), rct::EIGHT), rct::H);
+}
+
TEST(ringct, aggregated)
{
static const size_t N_PROOFS = 16;