diff options
| author | tb <> | 2023-04-05 07:52:25 +0000 |
|---|---|---|
| committer | tb <> | 2023-04-05 07:52:25 +0000 |
| commit | 8765edddf509e6f06c01109420a4762aef99d5f7 (patch) | |
| tree | b15bc50e5125fddf12b86fdd7e98ab072f8a8bf7 /src | |
| parent | 7f98cc228e114fb7cf13c13c139389e89ce1e037 (diff) | |
| download | openbsd-8765edddf509e6f06c01109420a4762aef99d5f7.tar.gz openbsd-8765edddf509e6f06c01109420a4762aef99d5f7.tar.bz2 openbsd-8765edddf509e6f06c01109420a4762aef99d5f7.zip | |
bn_mod_sqrt test: Use a #define rather than hard coded 100
Diffstat (limited to 'src')
| -rw-r--r-- | src/regress/lib/libcrypto/bn/bn_mod_sqrt.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/regress/lib/libcrypto/bn/bn_mod_sqrt.c b/src/regress/lib/libcrypto/bn/bn_mod_sqrt.c index a4d86a80b6..72042341d6 100644 --- a/src/regress/lib/libcrypto/bn/bn_mod_sqrt.c +++ b/src/regress/lib/libcrypto/bn/bn_mod_sqrt.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_mod_sqrt.c,v 1.4 2023/04/05 07:17:44 tb Exp $ */ | 1 | /* $OpenBSD: bn_mod_sqrt.c,v 1.5 2023/04/05 07:52:25 tb Exp $ */ |
| 2 | 2 | ||
| 3 | /* | 3 | /* |
| 4 | * Copyright (c) 2022,2023 Theo Buehler <tb@openbsd.org> | 4 | * Copyright (c) 2022,2023 Theo Buehler <tb@openbsd.org> |
| @@ -150,10 +150,12 @@ bn_mod_sqrt_test(void) | |||
| 150 | * residues. These exercise the non-deterministic path of Tonelli-Shanks. | 150 | * residues. These exercise the non-deterministic path of Tonelli-Shanks. |
| 151 | */ | 151 | */ |
| 152 | 152 | ||
| 153 | #define N_SMALL_SQUARE_TESTS 100 | ||
| 154 | |||
| 153 | static const struct p_is_1_mod_8_tests { | 155 | static const struct p_is_1_mod_8_tests { |
| 154 | const char *p; | 156 | const char *p; |
| 155 | int first_non_square; | 157 | int first_non_square; |
| 156 | const char *sqrt[100]; | 158 | const char *sqrt[N_SMALL_SQUARE_TESTS]; |
| 157 | } p_is_1_mod_8_tests[] = { | 159 | } p_is_1_mod_8_tests[] = { |
| 158 | { | 160 | { |
| 159 | .p = "d7a6133d89b7a840ec0d80d2ee197849", | 161 | .p = "d7a6133d89b7a840ec0d80d2ee197849", |
| @@ -1696,7 +1698,7 @@ bn_mod_sqrt_p_is_1_mod_8_test(const struct p_is_1_mod_8_tests *test, | |||
| 1696 | if (!BN_hex2bn(&p, test->p)) | 1698 | if (!BN_hex2bn(&p, test->p)) |
| 1697 | errx(1, "BN_hex2bn"); | 1699 | errx(1, "BN_hex2bn"); |
| 1698 | 1700 | ||
| 1699 | for (i = 0; i < 100; i++) { | 1701 | for (i = 0; i < N_SMALL_SQUARE_TESTS; i++) { |
| 1700 | if (!BN_set_word(a, i)) | 1702 | if (!BN_set_word(a, i)) |
| 1701 | errx(1, "BN_set_word"); | 1703 | errx(1, "BN_set_word"); |
| 1702 | 1704 | ||
