diff options
author | Colin Watson <cjwatson@debian.org> | 2020-02-21 11:57:14 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2020-02-21 14:27:02 +0000 |
commit | 886e47e745586c34e81cfd5c5fb9b5dbc8e84d04 (patch) | |
tree | dd6c3b4dc64a17c520af7aaf213163f8a0a63e56 /moduli.c | |
parent | ac2b4c0697fcac554041ab95f81736887eadf6ec (diff) | |
parent | a2dabf35ce0228c86a288d11cc847a9d9801604f (diff) |
New upstream release (8.2p1)
Diffstat (limited to 'moduli.c')
-rw-r--r-- | moduli.c | 12 |
1 files changed, 4 insertions, 8 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: moduli.c,v 1.36 2019/10/04 03:26:58 dtucker Exp $ */ | 1 | /* $OpenBSD: moduli.c,v 1.37 2019/11/15 06:00:20 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright 1994 Phil Karn <karn@qualcomm.com> | 3 | * Copyright 1994 Phil Karn <karn@qualcomm.com> |
4 | * Copyright 1996-1998, 2003 William Allen Simpson <wsimpson@greendragon.com> | 4 | * 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, | |||
578 | char *checkpoint_file, unsigned long start_lineno, unsigned long num_lines) | 578 | char *checkpoint_file, unsigned long start_lineno, unsigned long num_lines) |
579 | { | 579 | { |
580 | BIGNUM *q, *p, *a; | 580 | BIGNUM *q, *p, *a; |
581 | BN_CTX *ctx; | ||
582 | char *cp, *lp; | 581 | char *cp, *lp; |
583 | u_int32_t count_in = 0, count_out = 0, count_possible = 0; | 582 | u_int32_t count_in = 0, count_out = 0, count_possible = 0; |
584 | u_int32_t generator_known, in_tests, in_tries, in_type, in_size; | 583 | 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, | |||
602 | fatal("BN_new failed"); | 601 | fatal("BN_new failed"); |
603 | if ((q = BN_new()) == NULL) | 602 | if ((q = BN_new()) == NULL) |
604 | fatal("BN_new failed"); | 603 | fatal("BN_new failed"); |
605 | if ((ctx = BN_CTX_new()) == NULL) | ||
606 | fatal("BN_CTX_new failed"); | ||
607 | 604 | ||
608 | debug2("%.24s Final %u Miller-Rabin trials (%x generator)", | 605 | debug2("%.24s Final %u Miller-Rabin trials (%x generator)", |
609 | ctime(&time_start), trials, generator_wanted); | 606 | 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, | |||
753 | * that p is also prime. A single pass will weed out the | 750 | * that p is also prime. A single pass will weed out the |
754 | * vast majority of composite q's. | 751 | * vast majority of composite q's. |
755 | */ | 752 | */ |
756 | is_prime = BN_is_prime_ex(q, 1, ctx, NULL); | 753 | is_prime = BN_is_prime_ex(q, 1, NULL, NULL); |
757 | if (is_prime < 0) | 754 | if (is_prime < 0) |
758 | fatal("BN_is_prime_ex failed"); | 755 | fatal("BN_is_prime_ex failed"); |
759 | if (is_prime == 0) { | 756 | if (is_prime == 0) { |
@@ -769,7 +766,7 @@ prime_test(FILE *in, FILE *out, u_int32_t trials, u_int32_t generator_wanted, | |||
769 | * will show up on the first Rabin-Miller iteration so it | 766 | * will show up on the first Rabin-Miller iteration so it |
770 | * doesn't hurt to specify a high iteration count. | 767 | * doesn't hurt to specify a high iteration count. |
771 | */ | 768 | */ |
772 | is_prime = BN_is_prime_ex(p, trials, ctx, NULL); | 769 | is_prime = BN_is_prime_ex(p, trials, NULL, NULL); |
773 | if (is_prime < 0) | 770 | if (is_prime < 0) |
774 | fatal("BN_is_prime_ex failed"); | 771 | fatal("BN_is_prime_ex failed"); |
775 | if (is_prime == 0) { | 772 | if (is_prime == 0) { |
@@ -779,7 +776,7 @@ prime_test(FILE *in, FILE *out, u_int32_t trials, u_int32_t generator_wanted, | |||
779 | debug("%10u: p is almost certainly prime", count_in); | 776 | debug("%10u: p is almost certainly prime", count_in); |
780 | 777 | ||
781 | /* recheck q more rigorously */ | 778 | /* recheck q more rigorously */ |
782 | is_prime = BN_is_prime_ex(q, trials - 1, ctx, NULL); | 779 | is_prime = BN_is_prime_ex(q, trials - 1, NULL, NULL); |
783 | if (is_prime < 0) | 780 | if (is_prime < 0) |
784 | fatal("BN_is_prime_ex failed"); | 781 | fatal("BN_is_prime_ex failed"); |
785 | if (is_prime == 0) { | 782 | if (is_prime == 0) { |
@@ -802,7 +799,6 @@ prime_test(FILE *in, FILE *out, u_int32_t trials, u_int32_t generator_wanted, | |||
802 | free(lp); | 799 | free(lp); |
803 | BN_free(p); | 800 | BN_free(p); |
804 | BN_free(q); | 801 | BN_free(q); |
805 | BN_CTX_free(ctx); | ||
806 | 802 | ||
807 | if (checkpoint_file != NULL) | 803 | if (checkpoint_file != NULL) |
808 | unlink(checkpoint_file); | 804 | unlink(checkpoint_file); |