1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-08 16:42:03 +00:00

chore(crypto): do not use precomputed tables by native implementation of ECC

[no changelog]
This commit is contained in:
Ondřej Vejpustek 2024-08-02 14:38:29 +02:00
parent c0b295a9b1
commit 20453f6c99
2 changed files with 5 additions and 1 deletions

View File

@ -25,7 +25,7 @@
// use precomputed Curve Points (some scalar multiples of curve base point G) // use precomputed Curve Points (some scalar multiples of curve base point G)
#ifndef USE_PRECOMPUTED_CP #ifndef USE_PRECOMPUTED_CP
#define USE_PRECOMPUTED_CP 1 #define USE_PRECOMPUTED_CP 0
#endif #endif
// use fast inverse method // use fast inverse method

View File

@ -7385,6 +7385,7 @@ START_TEST(test_ecdsa_der) {
} }
END_TEST END_TEST
#if USE_PRECOMPUTED_CP
static void test_codepoints_curve(const ecdsa_curve *curve) { static void test_codepoints_curve(const ecdsa_curve *curve) {
int i, j; int i, j;
bignum256 a; bignum256 a;
@ -7422,6 +7423,7 @@ START_TEST(test_codepoints_secp256k1) { test_codepoints_curve(&secp256k1); }
END_TEST END_TEST
START_TEST(test_codepoints_nist256p1) { test_codepoints_curve(&nist256p1); } START_TEST(test_codepoints_nist256p1) { test_codepoints_curve(&nist256p1); }
END_TEST END_TEST
#endif
static void test_mult_border_cases_curve(const ecdsa_curve *curve) { static void test_mult_border_cases_curve(const ecdsa_curve *curve) {
bignum256 a; bignum256 a;
@ -11466,10 +11468,12 @@ Suite *test_suite(void) {
tcase_add_test(tc, test_pubkey_uncompress); tcase_add_test(tc, test_pubkey_uncompress);
suite_add_tcase(s, tc); suite_add_tcase(s, tc);
#if USE_PRECOMPUTED_CP
tc = tcase_create("codepoints"); tc = tcase_create("codepoints");
tcase_add_test(tc, test_codepoints_secp256k1); tcase_add_test(tc, test_codepoints_secp256k1);
tcase_add_test(tc, test_codepoints_nist256p1); tcase_add_test(tc, test_codepoints_nist256p1);
suite_add_tcase(s, tc); suite_add_tcase(s, tc);
#endif
tc = tcase_create("mult_border_cases"); tc = tcase_create("mult_border_cases");
tcase_add_test(tc, test_mult_border_cases_secp256k1); tcase_add_test(tc, test_mult_border_cases_secp256k1);