aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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");