summaryrefslogtreecommitdiffstats
path: root/apps/prime.c
diff options
context:
space:
mode:
authorKurt Roeckx <kurt@roeckx.be>2019-10-06 17:21:16 +0200
committerKurt Roeckx <kurt@roeckx.be>2019-10-14 22:54:02 +0200
commit42619397eb5db1a77d077250b0841b9c9f2b8984 (patch)
treed8afd9cabeedfe4cade8580206ed323bd6f4b9d0 /apps/prime.c
parentUse fewer primes for the trial division (diff)
downloadopenssl-42619397eb5db1a77d077250b0841b9c9f2b8984.tar.xz
openssl-42619397eb5db1a77d077250b0841b9c9f2b8984.zip
Add BN_check_prime()
Add a new API to test for primes that can't be misused, deprecated the old APIs. Suggested by Jake Massimo and Kenneth Paterson Reviewed-by: Paul Dale <paul.dale@oracle.com> GH: #9272
Diffstat (limited to 'apps/prime.c')
-rw-r--r--apps/prime.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/apps/prime.c b/apps/prime.c
index e00a3084a1..55cdad81a0 100644
--- a/apps/prime.c
+++ b/apps/prime.c
@@ -35,7 +35,7 @@ const OPTIONS prime_options[] = {
int prime_main(int argc, char **argv)
{
BIGNUM *bn = NULL;
- int hex = 0, checks = 20, generate = 0, bits = 0, safe = 0, ret = 1;
+ int hex = 0, generate = 0, bits = 0, safe = 0, ret = 1;
char *prog;
OPTION_CHOICE o;
@@ -64,7 +64,8 @@ opthelp:
safe = 1;
break;
case OPT_CHECKS:
- checks = atoi(opt_arg());
+ /* ignore parameter and argument */
+ opt_arg();
break;
}
}
@@ -121,7 +122,7 @@ opthelp:
BN_print(bio_out, bn);
BIO_printf(bio_out, " (%s) %s prime\n",
argv[0],
- BN_is_prime_ex(bn, checks, NULL, NULL)
+ BN_check_prime(bn, NULL, NULL)
? "is" : "is not");
}
}