diff --git a/src/compat.h b/src/compat.h index 23b03d5..e199a06 100644 --- a/src/compat.h +++ b/src/compat.h @@ -8,6 +8,8 @@ #ifndef LSEC_COMPAT_H #define LSEC_COMPAT_H +#include + #if defined(_WIN32) #define LSEC_API __declspec(dllexport) #else @@ -28,4 +30,8 @@ #define setfuncs(L, R) luaL_setfuncs(L, R, 0) #endif +#if (!defined(LIBRESSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER >= 0x1010000fL)) +#define LSEC_ENABLE_DANE +#endif + #endif diff --git a/src/config.c b/src/config.c index 236f755..9ba3806 100644 --- a/src/config.c +++ b/src/config.c @@ -74,7 +74,7 @@ LSEC_API int luaopen_ssl_config(lua_State *L) lua_pushboolean(L, 1); lua_rawset(L, -3); -#if (OPENSSL_VERSION_NUMBER >= 0x1010000fL) +#if defined(LSEC_ENABLE_DANE) // DANE lua_pushstring(L, "dane"); lua_pushboolean(L, 1); diff --git a/src/context.c b/src/context.c index d483359..43b30c3 100644 --- a/src/context.c +++ b/src/context.c @@ -21,6 +21,7 @@ #include #include +#include "compat.h" #include "context.h" #include "options.h" @@ -703,7 +704,7 @@ static int set_alpn_cb(lua_State *L) return 1; } -#if (OPENSSL_VERSION_NUMBER >= 0x1010000fL) +#if defined(LSEC_ENABLE_DANE) /* * DANE */ @@ -739,7 +740,7 @@ static luaL_Reg funcs[] = { {"setcurve", set_curve}, {"setcurveslist", set_curves_list}, #endif -#if (OPENSSL_VERSION_NUMBER >= 0x1010000fL) +#if defined(LSEC_ENABLE_DANE) {"setdane", set_dane}, #endif {NULL, NULL} diff --git a/src/ssl.c b/src/ssl.c index a8c42c8..178755a 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -826,7 +826,7 @@ static int meth_copyright(lua_State *L) return 1; } -#if (OPENSSL_VERSION_NUMBER >= 0x1010000fL) +#if defined(LSEC_ENABLE_DANE) static int meth_dane(lua_State *L) { int ret; @@ -878,7 +878,7 @@ static luaL_Reg methods[] = { {"settimeout", meth_settimeout}, {"sni", meth_sni}, {"want", meth_want}, -#if (OPENSSL_VERSION_NUMBER >= 0x1010000fL) +#if defined(LSEC_ENABLE_DANE) {"setdane", meth_dane}, {"settlsa", meth_tlsa}, #endif