diff options
author | tb <> | 2023-03-26 20:09:14 +0000 |
---|---|---|
committer | tb <> | 2023-03-26 20:09:14 +0000 |
commit | 8f3213695d21f184044158c617b8718951a19797 (patch) | |
tree | 19cf0d88fe2da5c744114096a11aae295fe89af1 /src | |
parent | 390f3beb0e1fcb27a11eddb229e4deaf41e75c92 (diff) | |
download | openbsd-8f3213695d21f184044158c617b8718951a19797.tar.gz openbsd-8f3213695d21f184044158c617b8718951a19797.tar.bz2 openbsd-8f3213695d21f184044158c617b8718951a19797.zip |
Align bn_mod_exp_zero_test() with bn_mod_exp_test()
Diffstat (limited to 'src')
-rw-r--r-- | src/regress/lib/libcrypto/bn/bn_mod_exp.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/regress/lib/libcrypto/bn/bn_mod_exp.c b/src/regress/lib/libcrypto/bn/bn_mod_exp.c index 5e12c8bb74..f4a6274af2 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 @@ | |||
1 | /* $OpenBSD: bn_mod_exp.c,v 1.22 2023/03/26 19:56:28 tb Exp $ */ | 1 | /* $OpenBSD: bn_mod_exp.c,v 1.23 2023/03/26 20:09:14 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> |
@@ -87,6 +87,7 @@ bn_mod_exp_zero_test(const struct mod_exp_zero_test *test, BN_CTX *ctx, | |||
87 | { | 87 | { |
88 | const BIGNUM *one; | 88 | const BIGNUM *one; |
89 | BIGNUM *a, *p, *got; | 89 | BIGNUM *a, *p, *got; |
90 | int mod_exp_ret; | ||
90 | int failed = 1; | 91 | int failed = 1; |
91 | 92 | ||
92 | BN_CTX_start(ctx); | 93 | BN_CTX_start(ctx); |
@@ -108,17 +109,15 @@ bn_mod_exp_zero_test(const struct mod_exp_zero_test *test, BN_CTX *ctx, | |||
108 | } | 109 | } |
109 | 110 | ||
110 | if (test->mod_exp_fn != NULL) { | 111 | if (test->mod_exp_fn != NULL) { |
111 | if (!test->mod_exp_fn(got, a, p, one, ctx)) { | 112 | mod_exp_ret = test->mod_exp_fn(got, a, p, one, ctx); |
112 | fprintf(stderr, "%s failed\n", test->name); | ||
113 | ERR_print_errors_fp(stderr); | ||
114 | goto err; | ||
115 | } | ||
116 | } else { | 113 | } else { |
117 | if (!test->mod_exp_mont_fn(got, a, p, one, ctx, NULL)) { | 114 | mod_exp_ret = test->mod_exp_mont_fn(got, a, p, one, ctx, NULL); |
118 | fprintf(stderr, "%s failed\n", test->name); | 115 | } |
119 | ERR_print_errors_fp(stderr); | 116 | |
120 | goto err; | 117 | if (!mod_exp_ret) { |
121 | } | 118 | fprintf(stderr, "%s failed\n", test->name); |
119 | ERR_print_errors_fp(stderr); | ||
120 | goto err; | ||
122 | } | 121 | } |
123 | 122 | ||
124 | if (!BN_is_zero(got)) { | 123 | if (!BN_is_zero(got)) { |
@@ -542,6 +541,7 @@ bn_mod_exp2_test(int reduce, BIGNUM *want, BIGNUM *got, BIGNUM *a1, BIGNUM *p1, | |||
542 | 541 | ||
543 | return failed; | 542 | return failed; |
544 | } | 543 | } |
544 | |||
545 | static int | 545 | static int |
546 | run_bn_mod_exp2_tests(void) | 546 | run_bn_mod_exp2_tests(void) |
547 | { | 547 | { |