Skip to content

Commit 9167a49

Browse files
author
tb
committed
More cleanup
Drop unnecessary loading of error strings, fix error path and consistently print to stdout.
1 parent c1a3e64 commit 9167a49

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

src/regress/lib/libcrypto/bn/bn_mod_exp.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: bn_mod_exp.c,v 1.8 2022/12/03 09:37:02 tb Exp $ */
1+
/* $OpenBSD: bn_mod_exp.c,v 1.9 2022/12/03 09:44:52 tb Exp $ */
22
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
33
* All rights reserved.
44
*
@@ -103,14 +103,12 @@ test_mod_exp(const BIGNUM *result_simple, const BIGNUM *a, const BIGNUM *b,
103103

104104
if (test->mod_exp_fn != NULL) {
105105
if (!test->mod_exp_fn(result, a, b, m, ctx)) {
106-
fprintf(stderr, "%s problems\n", test->name);
107-
ERR_print_errors_fp(stderr);
106+
printf("%s() problems\n", test->name);
108107
goto err;
109108
}
110109
} else {
111110
if (!test->mod_exp_mont_fn(result, a, b, m, ctx, NULL)) {
112-
fprintf(stderr, "%s problems\n", test->name);
113-
ERR_print_errors_fp(stderr);
111+
printf("%s() problems\n", test->name);
114112
goto err;
115113
}
116114
}
@@ -150,8 +148,6 @@ main(int argc, char *argv[])
150148
int c, i;
151149
size_t j;
152150

153-
ERR_load_BN_strings();
154-
155151
if ((ctx = BN_CTX_new()) == NULL)
156152
goto err;
157153

@@ -199,12 +195,13 @@ main(int argc, char *argv[])
199195

200196
BN_CTX_end(ctx);
201197
BN_CTX_free(ctx);
202-
ERR_remove_thread_state(NULL);
203198

204-
return (0);
199+
return 0;
205200

206201
err:
207-
ERR_load_crypto_strings();
202+
BN_CTX_end(ctx);
203+
BN_CTX_free(ctx);
208204
ERR_print_errors_fp(stdout);
209-
return (1);
205+
206+
return 1;
210207
}

0 commit comments

Comments
 (0)