summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2023-04-05 07:52:25 +0000
committertb <>2023-04-05 07:52:25 +0000
commit5207c285c80d0215c0c0aee54cf4a211113f42eb (patch)
treeb15bc50e5125fddf12b86fdd7e98ab072f8a8bf7
parent3019a914788f1fbdc55309450e3ac6d111b6a2c2 (diff)
downloadopenbsd-5207c285c80d0215c0c0aee54cf4a211113f42eb.tar.gz
openbsd-5207c285c80d0215c0c0aee54cf4a211113f42eb.tar.bz2
openbsd-5207c285c80d0215c0c0aee54cf4a211113f42eb.zip
bn_mod_sqrt test: Use a #define rather than hard coded 100
-rw-r--r--src/regress/lib/libcrypto/bn/bn_mod_sqrt.c8
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
153static const struct p_is_1_mod_8_tests { 155static 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