1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-23 06:48:16 +00:00

tests: Split curve tests into individual tests

This commit is contained in:
Saleem Rashid 2017-06-03 15:53:09 +01:00 committed by Pavol Rusnak
parent 50301f22ec
commit 27c7474856

51
tests.c
View File

@ -2594,11 +2594,8 @@ static void test_codepoints_curve(const ecdsa_curve *curve) {
}
}
START_TEST(test_codepoints) {
test_codepoints_curve(&secp256k1);
test_codepoints_curve(&nist256p1);
}
END_TEST
START_TEST(test_codepoints_secp256k1) { test_codepoints_curve(&secp256k1); } END_TEST
START_TEST(test_codepoints_nist256p1) { test_codepoints_curve(&nist256p1); } END_TEST
static void test_mult_border_cases_curve(const ecdsa_curve *curve) {
bignum256 a;
@ -2645,11 +2642,8 @@ static void test_mult_border_cases_curve(const ecdsa_curve *curve) {
ck_assert_mem_eq(&p, &expected, sizeof(curve_point));
}
START_TEST(test_mult_border_cases) {
test_mult_border_cases_curve(&secp256k1);
test_mult_border_cases_curve(&nist256p1);
}
END_TEST
START_TEST(test_mult_border_cases_secp256k1) { test_mult_border_cases_curve(&secp256k1); } END_TEST
START_TEST(test_mult_border_cases_nist256p1) { test_mult_border_cases_curve(&nist256p1); } END_TEST
static void test_scalar_mult_curve(const ecdsa_curve *curve) {
int i;
@ -2674,11 +2668,8 @@ static void test_scalar_mult_curve(const ecdsa_curve *curve) {
}
}
START_TEST(test_scalar_mult) {
test_scalar_mult_curve(&secp256k1);
test_scalar_mult_curve(&nist256p1);
}
END_TEST
START_TEST(test_scalar_mult_secp256k1) { test_scalar_mult_curve(&secp256k1); } END_TEST
START_TEST(test_scalar_mult_nist256p1) { test_scalar_mult_curve(&nist256p1); } END_TEST
static void test_point_mult_curve(const ecdsa_curve *curve) {
int i;
@ -2705,11 +2696,8 @@ static void test_point_mult_curve(const ecdsa_curve *curve) {
}
}
START_TEST(test_point_mult) {
test_point_mult_curve(&secp256k1);
test_point_mult_curve(&nist256p1);
}
END_TEST
START_TEST(test_point_mult_secp256k1) { test_point_mult_curve(&secp256k1); } END_TEST
START_TEST(test_point_mult_nist256p1) { test_point_mult_curve(&nist256p1); } END_TEST
static void test_scalar_point_mult_curve(const ecdsa_curve *curve) {
int i;
@ -2743,11 +2731,8 @@ static void test_scalar_point_mult_curve(const ecdsa_curve *curve) {
}
}
START_TEST(test_scalar_point_mult) {
test_scalar_point_mult_curve(&secp256k1);
test_scalar_point_mult_curve(&nist256p1);
}
END_TEST
START_TEST(test_scalar_point_mult_secp256k1) { test_scalar_point_mult_curve(&secp256k1); } END_TEST
START_TEST(test_scalar_point_mult_nist256p1) { test_scalar_point_mult_curve(&nist256p1); } END_TEST
START_TEST(test_ed25519) {
// test vectors from https://github.com/torproject/tor/blob/master/src/test/ed25519_vectors.inc
@ -3219,24 +3204,28 @@ Suite *test_suite(void)
suite_add_tcase(s, tc);
tc = tcase_create("codepoints");
tcase_add_test(tc, test_codepoints);
tcase_set_timeout(tc, 8);
tcase_add_test(tc, test_codepoints_secp256k1);
tcase_add_test(tc, test_codepoints_nist256p1);
suite_add_tcase(s, tc);
tc = tcase_create("mult_border_cases");
tcase_add_test(tc, test_mult_border_cases);
tcase_add_test(tc, test_mult_border_cases_secp256k1);
tcase_add_test(tc, test_mult_border_cases_nist256p1);
suite_add_tcase(s, tc);
tc = tcase_create("scalar_mult");
tcase_add_test(tc, test_scalar_mult);
tcase_add_test(tc, test_scalar_mult_secp256k1);
tcase_add_test(tc, test_scalar_mult_nist256p1);
suite_add_tcase(s, tc);
tc = tcase_create("point_mult");
tcase_add_test(tc, test_point_mult);
tcase_add_test(tc, test_point_mult_secp256k1);
tcase_add_test(tc, test_point_mult_nist256p1);
suite_add_tcase(s, tc);
tc = tcase_create("scalar_point_mult");
tcase_add_test(tc, test_scalar_point_mult);
tcase_add_test(tc, test_scalar_point_mult_secp256k1);
tcase_add_test(tc, test_scalar_point_mult_nist256p1);
suite_add_tcase(s, tc);
tc = tcase_create("ed25519");