Skip to content

Commit

Permalink
Enable faster hashing for more curves.
Browse files Browse the repository at this point in the history
  • Loading branch information
dfaranha committed Jul 11, 2023
1 parent b769beb commit 5d60890
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions test/test_ep.c
Original file line number Diff line number Diff line change
Expand Up @@ -1365,19 +1365,19 @@ static int hashing(void) {
TEST_CASE("point hashing is correct") {
rand_bytes(msg, sizeof(msg));
ep_map(a, msg, sizeof(msg));
TEST_ASSERT(ep_is_infty(a) == 0, end);
TEST_ASSERT(ep_on_curve(a) && ep_is_infty(a) == 0, end);
ep_mul(a, a, n);
TEST_ASSERT(ep_is_infty(a) == 1, end);
TEST_ASSERT(ep_on_curve(a) && ep_is_infty(a) == 1, end);
}
TEST_END;

#if EP_MAP == BASIC || !defined(STRIP)
TEST_CASE("basic point hashing is correct") {
rand_bytes(msg, sizeof(msg));
ep_map_basic(a, msg, sizeof(msg));
TEST_ASSERT(ep_is_infty(a) == 0, end);
TEST_ASSERT(ep_on_curve(a) && ep_is_infty(a) == 0, end);
ep_mul(a, a, n);
TEST_ASSERT(ep_is_infty(a) == 1, end);
TEST_ASSERT(ep_on_curve(a) && ep_is_infty(a) == 1, end);
}
TEST_END;
#endif
Expand All @@ -1386,21 +1386,21 @@ static int hashing(void) {
TEST_CASE("simplified SWU point hashing is correct") {
rand_bytes(msg, sizeof(msg));
ep_map_sswum(a, msg, sizeof(msg));
TEST_ASSERT(ep_is_infty(a) == 0, end);
TEST_ASSERT(ep_on_curve(a) && ep_is_infty(a) == 0, end);
ep_mul(a, a, n);
TEST_ASSERT(ep_is_infty(a) == 1, end);
TEST_ASSERT(ep_on_curve(a) && ep_is_infty(a) == 1, end);
}
TEST_END;
#endif

#if EP_MAP == SWIFT || !defined(STRIP)
if (ep_curve_opt_a() == RLC_ZERO) {
if (ep_curve_opt_a() == RLC_ZERO || ep_curve_opt_b() == RLC_ZERO) {
TEST_CASE("swift point hashing is correct") {
rand_bytes(msg, sizeof(msg));
ep_map_swift(a, msg, sizeof(msg));
TEST_ASSERT(ep_is_infty(a) == 0, end);
TEST_ASSERT(ep_on_curve(a) && ep_is_infty(a) == 0, end);
ep_mul(a, a, n);
TEST_ASSERT(ep_is_infty(a) == 1, end);
TEST_ASSERT(ep_on_curve(a) && ep_is_infty(a) == 1, end);
}
TEST_END;
#endif
Expand Down

0 comments on commit 5d60890

Please sign in to comment.