|
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 $ */ |
2 | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
3 | 3 | * All rights reserved.
|
4 | 4 | *
|
@@ -103,14 +103,12 @@ test_mod_exp(const BIGNUM *result_simple, const BIGNUM *a, const BIGNUM *b,
|
103 | 103 |
|
104 | 104 | if (test->mod_exp_fn != NULL) {
|
105 | 105 | 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); |
108 | 107 | goto err;
|
109 | 108 | }
|
110 | 109 | } else {
|
111 | 110 | 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); |
114 | 112 | goto err;
|
115 | 113 | }
|
116 | 114 | }
|
@@ -150,8 +148,6 @@ main(int argc, char *argv[])
|
150 | 148 | int c, i;
|
151 | 149 | size_t j;
|
152 | 150 |
|
153 |
| - ERR_load_BN_strings(); |
154 |
| - |
155 | 151 | if ((ctx = BN_CTX_new()) == NULL)
|
156 | 152 | goto err;
|
157 | 153 |
|
@@ -199,12 +195,13 @@ main(int argc, char *argv[])
|
199 | 195 |
|
200 | 196 | BN_CTX_end(ctx);
|
201 | 197 | BN_CTX_free(ctx);
|
202 |
| - ERR_remove_thread_state(NULL); |
203 | 198 |
|
204 |
| - return (0); |
| 199 | + return 0; |
205 | 200 |
|
206 | 201 | err:
|
207 |
| - ERR_load_crypto_strings(); |
| 202 | + BN_CTX_end(ctx); |
| 203 | + BN_CTX_free(ctx); |
208 | 204 | ERR_print_errors_fp(stdout);
|
209 |
| - return (1); |
| 205 | + |
| 206 | + return 1; |
210 | 207 | }
|
0 commit comments