diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/regress/lib/libcrypto/bn/bn_mod_exp.c | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/src/regress/lib/libcrypto/bn/bn_mod_exp.c b/src/regress/lib/libcrypto/bn/bn_mod_exp.c index d12d9f1e05..591d603182 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.3 2022/12/02 17:42:45 tb Exp $ */ | 1 | /* $OpenBSD: bn_mod_exp.c,v 1.4 2022/12/02 18:24:01 tb Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -82,23 +82,26 @@ main(int argc, char *argv[]) | |||
82 | 82 | ||
83 | if ((ctx = BN_CTX_new()) == NULL) | 83 | if ((ctx = BN_CTX_new()) == NULL) |
84 | goto err; | 84 | goto err; |
85 | if ((r_mont = BN_new()) == NULL) | 85 | |
86 | BN_CTX_start(ctx); | ||
87 | |||
88 | if ((r_mont = BN_CTX_get(ctx)) == NULL) | ||
86 | goto err; | 89 | goto err; |
87 | if ((r_mont_const = BN_new()) == NULL) | 90 | if ((r_mont_const = BN_CTX_get(ctx)) == NULL) |
88 | goto err; | 91 | goto err; |
89 | if ((r_mont_ct = BN_new()) == NULL) | 92 | if ((r_mont_ct = BN_CTX_get(ctx)) == NULL) |
90 | goto err; | 93 | goto err; |
91 | if ((r_mont_nonct = BN_new()) == NULL) | 94 | if ((r_mont_nonct = BN_CTX_get(ctx)) == NULL) |
92 | goto err; | 95 | goto err; |
93 | if ((r_recp = BN_new()) == NULL) | 96 | if ((r_recp = BN_CTX_get(ctx)) == NULL) |
94 | goto err; | 97 | goto err; |
95 | if ((r_simple = BN_new()) == NULL) | 98 | if ((r_simple = BN_CTX_get(ctx)) == NULL) |
96 | goto err; | 99 | goto err; |
97 | if ((a = BN_new()) == NULL) | 100 | if ((a = BN_CTX_get(ctx)) == NULL) |
98 | goto err; | 101 | goto err; |
99 | if ((b = BN_new()) == NULL) | 102 | if ((b = BN_CTX_get(ctx)) == NULL) |
100 | goto err; | 103 | goto err; |
101 | if ((m = BN_new()) == NULL) | 104 | if ((m = BN_CTX_get(ctx)) == NULL) |
102 | goto err; | 105 | goto err; |
103 | 106 | ||
104 | if ((out = BIO_new(BIO_s_file())) == NULL) | 107 | if ((out = BIO_new(BIO_s_file())) == NULL) |
@@ -194,15 +197,8 @@ main(int argc, char *argv[]) | |||
194 | exit(1); | 197 | exit(1); |
195 | } | 198 | } |
196 | } | 199 | } |
197 | BN_free(r_mont); | 200 | |
198 | BN_free(r_mont_const); | 201 | BN_CTX_end(ctx); |
199 | BN_free(r_mont_ct); | ||
200 | BN_free(r_mont_nonct); | ||
201 | BN_free(r_recp); | ||
202 | BN_free(r_simple); | ||
203 | BN_free(a); | ||
204 | BN_free(b); | ||
205 | BN_free(m); | ||
206 | BN_CTX_free(ctx); | 202 | BN_CTX_free(ctx); |
207 | ERR_remove_thread_state(NULL); | 203 | ERR_remove_thread_state(NULL); |
208 | CRYPTO_mem_leaks(out); | 204 | CRYPTO_mem_leaks(out); |