From 04102b8382e69b88db65e1e30a569dcca0ac8daf Mon Sep 17 00:00:00 2001 From: tb <> Date: Mon, 27 Mar 2023 09:01:08 +0000 Subject: bn_mod_exp: make this test a bit less noisy on failure While it is good to run more tests on failure, it is pointless to try broken things thousands of times. --- src/regress/lib/libcrypto/bn/bn_mod_exp.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/regress/lib/libcrypto/bn/bn_mod_exp.c b/src/regress/lib/libcrypto/bn/bn_mod_exp.c index c880e78dd3..f381df3734 100644 --- a/src/regress/lib/libcrypto/bn/bn_mod_exp.c +++ b/src/regress/lib/libcrypto/bn/bn_mod_exp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_mod_exp.c,v 1.26 2023/03/27 08:52:57 tb Exp $ */ +/* $OpenBSD: bn_mod_exp.c,v 1.27 2023/03/27 09:01:08 tb Exp $ */ /* * Copyright (c) 2022,2023 Theo Buehler @@ -404,7 +404,7 @@ bn_mod_exp_test(int reduce, BIGNUM *want, BIGNUM *a, BIGNUM *p, BIGNUM *m, if (!generate_test_triple(reduce, a, p, m, ctx)) errx(1, "generate_test_triple"); - for (i = 0; i < 8; i++) { + for (i = 0; i < 8 && !failed; i++) { BN_set_negative(a, i & 1); BN_set_negative(p, (i >> 1) & 1); BN_set_negative(m, (i >> 2) & 1); @@ -447,11 +447,11 @@ run_bn_mod_exp_tests(void) errx(1, "want = BN_CTX_get()"); reduce = 0; - for (i = 0; i < N_MOD_EXP_TESTS; i++) + for (i = 0; i < N_MOD_EXP_TESTS && !failed; i++) failed |= bn_mod_exp_test(reduce, want, a, p, m, ctx); reduce = 1; - for (i = 0; i < N_MOD_EXP_TESTS; i++) + for (i = 0; i < N_MOD_EXP_TESTS && !failed; i++) failed |= bn_mod_exp_test(reduce, want, a, p, m, ctx); BN_CTX_end(ctx); @@ -522,7 +522,7 @@ bn_mod_exp2_test(int reduce, BIGNUM *want, BIGNUM *got, BIGNUM *a1, BIGNUM *p1, if (!generate_test_quintuple(reduce, a1, p1, a2, p2, m, ctx)) errx(1, "generate_test_quintuple"); - for (i = 0; i < 32; i++) { + for (i = 0; i < 32 && !failed; i++) { BN_set_negative(a1, i & 1); BN_set_negative(p1, (i >> 1) & 1); BN_set_negative(a2, (i >> 2) & 1); @@ -574,12 +574,12 @@ run_bn_mod_exp2_tests(void) errx(1, "got = BN_CTX_get()"); reduce = 0; - for (i = 0; i < N_MOD_EXP_TESTS; i++) + for (i = 0; i < N_MOD_EXP_TESTS && !failed; i++) failed |= bn_mod_exp2_test(reduce, want, got, a1, p1, a2, p2, m, ctx); reduce = 1; - for (i = 0; i < N_MOD_EXP_TESTS; i++) + for (i = 0; i < N_MOD_EXP_TESTS && !failed; i++) failed |= bn_mod_exp2_test(reduce, want, got, a1, p1, a2, p2, m, ctx); -- cgit v1.2.3-55-g6feb