git: a694dad26ba5 - stable/13 - factor: support OpenSSL 3
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 24 Sep 2025 22:17:08 UTC
The branch stable/13 has been updated by ngie:
URL: https://cgit.FreeBSD.org/src/commit/?id=a694dad26ba59b815ce22e0d1b82c94e0467126d
commit a694dad26ba59b815ce22e0d1b82c94e0467126d
Author: Enji Cooper <ngie@FreeBSD.org>
AuthorDate: 2023-05-27 04:55:12 +0000
Commit: Enji Cooper <ngie@FreeBSD.org>
CommitDate: 2025-09-24 05:36:59 +0000
factor: support OpenSSL 3
This change ports the BN APIs to an OpenSSL 3 compatible set of APIs.
This removes the need for requesting OpenSSL 1.1 compatible APIs.
MFC after: 1 week
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D40298
(cherry picked from commit 537cd766435c80e61e72bb9369f77aa9630a1537)
---
usr.bin/factor/factor.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/usr.bin/factor/factor.c b/usr.bin/factor/factor.c
index 279028572fe3..523547086f6d 100644
--- a/usr.bin/factor/factor.c
+++ b/usr.bin/factor/factor.c
@@ -206,7 +206,11 @@ pr_fact(BIGNUM *val)
if (!BN_sqr(bnfact, bnfact, ctx))
errx(1, "error in BN_sqr()");
if (BN_cmp(bnfact, val) > 0 ||
+#if OPENSSL_VERSION_NUMBER >= 0x30000000L
+ BN_check_prime(val, NULL, NULL) == 1)
+#else
BN_is_prime_ex(val, PRIME_CHECKS, NULL, NULL) == 1)
+#endif
pr_print(val);
else
pollard_pminus1(val);
@@ -279,7 +283,11 @@ newbase:
errx(1, "error in BN_gcd()");
if (!BN_is_one(x)) {
+#if OPENSSL_VERSION_NUMBER >= 0x30000000L
+ if (BN_check_prime(x, NULL, NULL) == 1)
+#else
if (BN_is_prime_ex(x, PRIME_CHECKS, NULL, NULL) == 1)
+#endif
pr_print(x);
else
pollard_pminus1(x);
@@ -288,8 +296,13 @@ newbase:
BN_div(num, NULL, val, x, ctx);
if (BN_is_one(num))
return;
- if (BN_is_prime_ex(num, PRIME_CHECKS, NULL,
- NULL) == 1) {
+#if OPENSSL_VERSION_NUMBER >= 0x30000000L
+ if (BN_check_prime(num, NULL, NULL) == 1)
+#else
+ if (BN_is_prime_ex(num, PRIME_CHECKS, NULL, NULL)
+ == 1)
+#endif
+ {
pr_print(num);
fflush(stdout);
return;