mirror of
https://github.com/brunoos/luasec.git
synced 2025-04-28 19:36:45 +02:00
Fix: check if PSK is available
This commit is contained in:
parent
c297c5204c
commit
e01c6e63cd
@ -54,4 +54,10 @@
|
|||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#if !defined(LIBRESSL_VERSION_NUMBER) && !defined(OPENSSL_NO_PSK)
|
||||||
|
#define LSEC_ENABLE_PSK
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -74,6 +74,12 @@ LSEC_API int luaopen_ssl_config(lua_State *L)
|
|||||||
lua_pushboolean(L, 1);
|
lua_pushboolean(L, 1);
|
||||||
lua_rawset(L, -3);
|
lua_rawset(L, -3);
|
||||||
|
|
||||||
|
#ifdef LSEC_ENABLE_PSK
|
||||||
|
lua_pushstring(L, "psk");
|
||||||
|
lua_pushboolean(L, 1);
|
||||||
|
lua_rawset(L, -3);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef LSEC_ENABLE_DANE
|
#ifdef LSEC_ENABLE_DANE
|
||||||
// DANE
|
// DANE
|
||||||
lua_pushstring(L, "dane");
|
lua_pushstring(L, "dane");
|
||||||
|
@ -707,6 +707,7 @@ static int set_alpn_cb(lua_State *L)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(LSEC_ENABLE_PSK)
|
||||||
/**
|
/**
|
||||||
* Callback to select the PSK.
|
* Callback to select the PSK.
|
||||||
*/
|
*/
|
||||||
@ -841,6 +842,7 @@ static int set_client_psk_cb(lua_State *L) {
|
|||||||
lua_pushboolean(L, 1);
|
lua_pushboolean(L, 1);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(LSEC_ENABLE_DANE)
|
#if defined(LSEC_ENABLE_DANE)
|
||||||
/*
|
/*
|
||||||
@ -893,9 +895,11 @@ static luaL_Reg funcs[] = {
|
|||||||
{"setdhparam", set_dhparam},
|
{"setdhparam", set_dhparam},
|
||||||
{"setverify", set_verify},
|
{"setverify", set_verify},
|
||||||
{"setoptions", set_options},
|
{"setoptions", set_options},
|
||||||
|
#if defined(LSEC_ENABLE_PSK)
|
||||||
{"setpskhint", set_psk_identity_hint},
|
{"setpskhint", set_psk_identity_hint},
|
||||||
{"setserverpskcb", set_server_psk_cb},
|
{"setserverpskcb", set_server_psk_cb},
|
||||||
{"setclientpskcb", set_client_psk_cb},
|
{"setclientpskcb", set_client_psk_cb},
|
||||||
|
#endif
|
||||||
{"setmode", set_mode},
|
{"setmode", set_mode},
|
||||||
#if !defined(OPENSSL_NO_EC)
|
#if !defined(OPENSSL_NO_EC)
|
||||||
{"setcurve", set_curve},
|
{"setcurve", set_curve},
|
||||||
|
@ -202,7 +202,7 @@ local function newcontext(cfg)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- PSK
|
-- PSK
|
||||||
if cfg.psk then
|
if config.capabilities.psk and cfg.psk then
|
||||||
if cfg.mode == "client" then
|
if cfg.mode == "client" then
|
||||||
if type(cfg.psk) ~= "function" then
|
if type(cfg.psk) ~= "function" then
|
||||||
return nil, "invalid PSK configuration"
|
return nil, "invalid PSK configuration"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user