Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenSSL 3.0.0 #199

Merged
merged 7 commits into from
Jun 30, 2022
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1475,7 +1475,11 @@ static const char *auxL_pusherror(lua_State *L, int error, const char *fun) {
if (!ERR_peek_error())
return lua_pushliteral(L, "oops: no OpenSSL errors set");

#if OPENSSL_PREREQ(3,0,0)
code = ERR_get_error_all(&path, &line, NULL, NULL, NULL);
#else
code = ERR_get_error_line(&path, &line);
#endif

if ((file = strrchr(path, '/'))) {
++file;
Expand Down Expand Up @@ -2842,8 +2846,13 @@ typedef const CRYPTO_EX_DATA const_CRYPTO_EX_DATA;
typedef CRYPTO_EX_DATA const_CRYPTO_EX_DATA;
#endif

#if OPENSSL_PREREQ(3,0,0)
/* the function signature was fixed in version 3.0.0 */
static int ex_ondup(CRYPTO_EX_DATA *to NOTUSED, const_CRYPTO_EX_DATA *from NOTUSED, void **from_d, int idx NOTUSED, long argl NOTUSED, void *argp NOTUSED) {
#else
static int ex_ondup(CRYPTO_EX_DATA *to NOTUSED, const_CRYPTO_EX_DATA *from NOTUSED, void *from_d, int idx NOTUSED, long argl NOTUSED, void *argp NOTUSED) {
struct ex_data **data = from_d;
#endif
struct ex_data **data = (struct ex_data **)from_d;

if (*data)
(*data)->refs++;
Expand Down Expand Up @@ -3911,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);
daurnimator marked this conversation as resolved.
Show resolved Hide resolved
int res = BN_is_prime_ex(bn, nchecks, getctx(L), NULL);
#endif

if (res == -1)
return auxL_error(L, auxL_EOPENSSL, "bignum:isPrime");
Expand Down