aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatarLibravatar John Regan <john@jrjrtech.com> 2022-05-04 23:05:24 +0200
committerLibravatarLibravatar John Regan <john@jrjrtech.com> 2022-05-04 23:05:24 +0200
commit03ffa376011ff5ddf346657c4bb377dde9ecb584 (patch)
treee2f9e23888d91e4c64e12d9c7275d02285edab71
parent719fa58363ab4e5f6ebd77b4d17f11339d762d3e (diff)
downloadluaossl-03ffa376011ff5ddf346657c4bb377dde9ecb584.tar.gz
luaossl-03ffa376011ff5ddf346657c4bb377dde9ecb584.tar.bz2
luaossl-03ffa376011ff5ddf346657c4bb377dde9ecb584.zip
openssl 3.0.0: use new BN_check_prime
-rw-r--r--src/openssl.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/openssl.c b/src/openssl.c
index 92e91ea..c23988e 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -3920,8 +3920,12 @@ static int bn_generatePrime(lua_State *L) {
static int bn_isPrime(lua_State *L) {
BIGNUM *bn = checksimple(L, 1, BIGNUM_CLASS);
+#if OPENSSL_PREREQ(3,0,0)
+ int res = BN_check_prime(bn, getctx(L), NULL);
+#else
int nchecks = luaL_optinteger(L, 2, BN_prime_checks);
int res = BN_is_prime_ex(bn, nchecks, getctx(L), NULL);
+#endif
if (res == -1)
return auxL_error(L, auxL_EOPENSSL, "bignum:isPrime");