diff options
author | djm@openbsd.org <djm@openbsd.org> | 2019-11-15 07:00:20 +0100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2019-11-16 23:44:43 +0100 |
commit | fd1a96490cef7f945a1b3b5df4e90c8a1070f425 (patch) | |
tree | c806a64cad5969ddf02459d4535d5e9cf1ae9e4b /moduli.c | |
parent | Add wrappers for other ultrix headers. (diff) | |
download | openssh-fd1a96490cef7f945a1b3b5df4e90c8a1070f425.tar.xz openssh-fd1a96490cef7f945a1b3b5df4e90c8a1070f425.zip |
upstream: remove most uses of BN_CTX
We weren't following the rules re BN_CTX_start/BN_CTX_end and the places
we were using it didn't benefit from its use anyway. ok dtucker@
OpenBSD-Commit-ID: ea9ba6c0d2e6f6adfe00b309a8f41842fe12fc7a
Diffstat (limited to 'moduli.c')
-rw-r--r-- | moduli.c | 12 |
1 files changed, 4 insertions, 8 deletions
@@ -1,4 +1,4 @@ -/* $OpenBSD: moduli.c,v 1.36 2019/10/04 03:26:58 dtucker Exp $ */ +/* $OpenBSD: moduli.c,v 1.37 2019/11/15 06:00:20 djm Exp $ */ /* * Copyright 1994 Phil Karn <karn@qualcomm.com> * Copyright 1996-1998, 2003 William Allen Simpson <wsimpson@greendragon.com> @@ -578,7 +578,6 @@ prime_test(FILE *in, FILE *out, u_int32_t trials, u_int32_t generator_wanted, char *checkpoint_file, unsigned long start_lineno, unsigned long num_lines) { BIGNUM *q, *p, *a; - BN_CTX *ctx; char *cp, *lp; u_int32_t count_in = 0, count_out = 0, count_possible = 0; u_int32_t generator_known, in_tests, in_tries, in_type, in_size; @@ -602,8 +601,6 @@ prime_test(FILE *in, FILE *out, u_int32_t trials, u_int32_t generator_wanted, fatal("BN_new failed"); if ((q = BN_new()) == NULL) fatal("BN_new failed"); - if ((ctx = BN_CTX_new()) == NULL) - fatal("BN_CTX_new failed"); debug2("%.24s Final %u Miller-Rabin trials (%x generator)", ctime(&time_start), trials, generator_wanted); @@ -753,7 +750,7 @@ prime_test(FILE *in, FILE *out, u_int32_t trials, u_int32_t generator_wanted, * that p is also prime. A single pass will weed out the * vast majority of composite q's. */ - is_prime = BN_is_prime_ex(q, 1, ctx, NULL); + is_prime = BN_is_prime_ex(q, 1, NULL, NULL); if (is_prime < 0) fatal("BN_is_prime_ex failed"); if (is_prime == 0) { @@ -769,7 +766,7 @@ prime_test(FILE *in, FILE *out, u_int32_t trials, u_int32_t generator_wanted, * will show up on the first Rabin-Miller iteration so it * doesn't hurt to specify a high iteration count. */ - is_prime = BN_is_prime_ex(p, trials, ctx, NULL); + is_prime = BN_is_prime_ex(p, trials, NULL, NULL); if (is_prime < 0) fatal("BN_is_prime_ex failed"); if (is_prime == 0) { @@ -779,7 +776,7 @@ prime_test(FILE *in, FILE *out, u_int32_t trials, u_int32_t generator_wanted, debug("%10u: p is almost certainly prime", count_in); /* recheck q more rigorously */ - is_prime = BN_is_prime_ex(q, trials - 1, ctx, NULL); + is_prime = BN_is_prime_ex(q, trials - 1, NULL, NULL); if (is_prime < 0) fatal("BN_is_prime_ex failed"); if (is_prime == 0) { @@ -802,7 +799,6 @@ prime_test(FILE *in, FILE *out, u_int32_t trials, u_int32_t generator_wanted, free(lp); BN_free(p); BN_free(q); - BN_CTX_free(ctx); if (checkpoint_file != NULL) unlink(checkpoint_file); |