diff options
author | tb <> | 2023-03-26 14:50:23 +0000 |
---|---|---|
committer | tb <> | 2023-03-26 14:50:23 +0000 |
commit | 554631fc725f289c8c65c4b7ee7ddcf395a4906c (patch) | |
tree | 7499d634e2c9c10e56f05bc7efde7f1a95d1850b /src | |
parent | 651978435ef0d762b74b9d6a3de0424651ef4181 (diff) | |
download | openbsd-554631fc725f289c8c65c4b7ee7ddcf395a4906c.tar.gz openbsd-554631fc725f289c8c65c4b7ee7ddcf395a4906c.tar.bz2 openbsd-554631fc725f289c8c65c4b7ee7ddcf395a4906c.zip |
bn_mod_exp_ret() fix stupid logic error
Diffstat (limited to 'src')
-rw-r--r-- | src/regress/lib/libcrypto/bn/bn_mod_exp.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/regress/lib/libcrypto/bn/bn_mod_exp.c b/src/regress/lib/libcrypto/bn/bn_mod_exp.c index 67445c37b3..7009a6096a 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.15 2023/03/18 13:04:02 tb Exp $ */ | 1 | /* $OpenBSD: bn_mod_exp.c,v 1.16 2023/03/26 14:50:23 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> |
@@ -282,6 +282,7 @@ test_mod_exp(const BIGNUM *want, const BIGNUM *a, const BIGNUM *p, | |||
282 | const BIGNUM *m, BN_CTX *ctx, const struct mod_exp_test *test) | 282 | const BIGNUM *m, BN_CTX *ctx, const struct mod_exp_test *test) |
283 | { | 283 | { |
284 | BIGNUM *got; | 284 | BIGNUM *got; |
285 | int mod_exp_ret; | ||
285 | int ret = 0; | 286 | int ret = 0; |
286 | 287 | ||
287 | BN_CTX_start(ctx); | 288 | BN_CTX_start(ctx); |
@@ -290,11 +291,11 @@ test_mod_exp(const BIGNUM *want, const BIGNUM *a, const BIGNUM *p, | |||
290 | goto err; | 291 | goto err; |
291 | 292 | ||
292 | if (test->mod_exp_fn != NULL) | 293 | if (test->mod_exp_fn != NULL) |
293 | ret = test->mod_exp_fn(got, a, p, m, ctx); | 294 | mod_exp_ret = test->mod_exp_fn(got, a, p, m, ctx); |
294 | else | 295 | else |
295 | ret = test->mod_exp_mont_fn(got, a, p, m, ctx, NULL); | 296 | mod_exp_ret = test->mod_exp_mont_fn(got, a, p, m, ctx, NULL); |
296 | 297 | ||
297 | if (!ret) | 298 | if (!mod_exp_ret) |
298 | errx(1, "%s() failed", test->name); | 299 | errx(1, "%s() failed", test->name); |
299 | 300 | ||
300 | if (BN_cmp(want, got) != 0) { | 301 | if (BN_cmp(want, got) != 0) { |