diff --git a/apps/prime.c b/apps/prime.c index a03909c411..23b7e462fc 100644 --- a/apps/prime.c +++ b/apps/prime.c @@ -145,10 +145,14 @@ opthelp: } BN_print(bio_out, bn); + r = BN_check_prime(bn, NULL, NULL); + if (r < 0) { + BIO_printf(bio_err, "Error checking prime\n"); + goto end; + } BIO_printf(bio_out, " (%s) %s prime\n", argv[0], - BN_check_prime(bn, NULL, NULL) - ? "is" : "is not"); + r == 1 ? "is" : "is not"); } } diff --git a/test/bntest.c b/test/bntest.c index 2c7b91fad9..3b3671a622 100644 --- a/test/bntest.c +++ b/test/bntest.c @@ -2703,7 +2703,7 @@ static int test_not_prime(int i) for (trial = 0; trial <= 1; ++trial) { if (!TEST_true(BN_set_word(r, not_primes[i])) - || !TEST_false(BN_check_prime(r, ctx, NULL))) + || !TEST_int_eq(BN_check_prime(r, ctx, NULL), 0)) goto err; }