Fix multiple wrong use of BN_check_prime
Reviewed-by: Paul Dale <ppzgs1@gmail.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/25811)
This commit is contained in:
parent
1273fae170
commit
b2b995ec2d
2 changed files with 7 additions and 3 deletions
|
@ -145,10 +145,14 @@ opthelp:
|
||||||
}
|
}
|
||||||
|
|
||||||
BN_print(bio_out, bn);
|
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",
|
BIO_printf(bio_out, " (%s) %s prime\n",
|
||||||
argv[0],
|
argv[0],
|
||||||
BN_check_prime(bn, NULL, NULL)
|
r == 1 ? "is" : "is not");
|
||||||
? "is" : "is not");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2703,7 +2703,7 @@ static int test_not_prime(int i)
|
||||||
|
|
||||||
for (trial = 0; trial <= 1; ++trial) {
|
for (trial = 0; trial <= 1; ++trial) {
|
||||||
if (!TEST_true(BN_set_word(r, not_primes[i]))
|
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;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue