From 531d1f3eacbce95dde387f5e803ddf398057377b Mon Sep 17 00:00:00 2001 From: daurnimator Date: Wed, 12 Jun 2019 13:22:56 +1000 Subject: src/openssl.c: Add LIBRESSL_VERSION_NUMBER version field --- src/openssl.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/openssl.c b/src/openssl.c index 95a2939..c59cf22 100644 --- a/src/openssl.c +++ b/src/openssl.c @@ -3146,7 +3146,7 @@ static const char opensslconf_no[][20] = { { "" } /* in case nothing is defined above */ }; /* opensslconf_no[] */ -static const auxL_IntegerReg ssleay_version[] = { +static const auxL_IntegerReg openssl_integers[] = { #ifdef SSLEAY_VERSION_NUMBER { "SSLEAY_VERSION_NUMBER", SSLEAY_VERSION_NUMBER }, #endif @@ -3167,6 +3167,19 @@ static const auxL_IntegerReg ssleay_version[] = { #endif #ifdef SSLEAY_DIR { "SSLEAY_DIR", SSLEAY_DIR }, +#endif +#ifdef LIBRESSL_VERSION_NUMBER + { "LIBRESSL_VERSION_NUMBER", LIBRESSL_VERSION_NUMBER }, +#endif +#ifdef OPENSSL_VERSION_NUMBER + { "OPENSSL_VERSION_NUMBER", OPENSSL_VERSION_NUMBER }, +#endif +#ifdef LIBRESSL_VERSION_NUMBER + { "VERSION_NUMBER", LIBRESSL_VERSION_NUMBER }, +#elif OPENSSL_VERSION_NUMBER + { "VERSION_NUMBER", OPENSSL_VERSION_NUMBER }, +#else + { "VERSION_NUMBER", SSLEAY_VERSION_NUMBER }, #endif { NULL, 0 }, }; @@ -3183,10 +3196,7 @@ EXPORT int luaopen__openssl(lua_State *L) { } } - auxL_setintegers(L, ssleay_version); - - auxL_pushinteger(L, OPENSSL_VERSION_NUMBER); - lua_setfield(L, -2, "VERSION_NUMBER"); + auxL_setintegers(L, openssl_integers); lua_pushstring(L, OPENSSL_VERSION_TEXT); lua_setfield(L, -2, "VERSION_TEXT"); @@ -3197,11 +3207,6 @@ EXPORT int luaopen__openssl(lua_State *L) { lua_pushstring(L, SHLIB_VERSION_NUMBER); lua_setfield(L, -2, "SHLIB_VERSION_NUMBER"); -#if defined LIBRESSL_VERSION_NUMBER - auxL_pushinteger(L, LIBRESSL_VERSION_NUMBER); - lua_setfield(L, -2, "LIBRESSL_VERSION_NUMBER"); -#endif - return 1; } /* luaopen__openssl() */ -- cgit v1.2.3-59-g8ed1b