-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Drop unnecessary loading of error strings, fix error path and consistently print to stdout.
- Loading branch information
tb
committed
Dec 3, 2022
1 parent
c1a3e64
commit 9167a49
Showing
1 changed file
with
8 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/* $OpenBSD: bn_mod_exp.c,v 1.8 2022/12/03 09:37:02 tb Exp $ */ | ||
/* $OpenBSD: bn_mod_exp.c,v 1.9 2022/12/03 09:44:52 tb Exp $ */ | ||
/* Copyright (C) 1995-1998 Eric Young ([email protected]) | ||
* All rights reserved. | ||
* | ||
|
@@ -103,14 +103,12 @@ test_mod_exp(const BIGNUM *result_simple, const BIGNUM *a, const BIGNUM *b, | |
|
||
if (test->mod_exp_fn != NULL) { | ||
if (!test->mod_exp_fn(result, a, b, m, ctx)) { | ||
fprintf(stderr, "%s problems\n", test->name); | ||
ERR_print_errors_fp(stderr); | ||
printf("%s() problems\n", test->name); | ||
goto err; | ||
} | ||
} else { | ||
if (!test->mod_exp_mont_fn(result, a, b, m, ctx, NULL)) { | ||
fprintf(stderr, "%s problems\n", test->name); | ||
ERR_print_errors_fp(stderr); | ||
printf("%s() problems\n", test->name); | ||
goto err; | ||
} | ||
} | ||
|
@@ -150,8 +148,6 @@ main(int argc, char *argv[]) | |
int c, i; | ||
size_t j; | ||
|
||
ERR_load_BN_strings(); | ||
|
||
if ((ctx = BN_CTX_new()) == NULL) | ||
goto err; | ||
|
||
|
@@ -199,12 +195,13 @@ main(int argc, char *argv[]) | |
|
||
BN_CTX_end(ctx); | ||
BN_CTX_free(ctx); | ||
ERR_remove_thread_state(NULL); | ||
|
||
return (0); | ||
return 0; | ||
|
||
err: | ||
ERR_load_crypto_strings(); | ||
BN_CTX_end(ctx); | ||
BN_CTX_free(ctx); | ||
ERR_print_errors_fp(stdout); | ||
return (1); | ||
|
||
return 1; | ||
} |