2017-06-17 03:53:59 +02:00
|
|
|
/*--------------------------------------------------------------------------
|
2021-08-14 15:16:35 +02:00
|
|
|
* LuaSec 1.0.2
|
2017-06-17 03:53:59 +02:00
|
|
|
*
|
2021-01-30 14:29:53 +01:00
|
|
|
* Copyright (C) 2006-2021 Bruno Silvestre.
|
2017-06-17 03:53:59 +02:00
|
|
|
*
|
|
|
|
*--------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
#include "compat.h"
|
|
|
|
#include "options.h"
|
|
|
|
#include "ec.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Registre the module.
|
|
|
|
*/
|
|
|
|
LSEC_API int luaopen_ssl_config(lua_State *L)
|
|
|
|
{
|
2019-10-09 19:49:58 +02:00
|
|
|
lsec_ssl_option_t *opt;
|
2017-06-17 03:53:59 +02:00
|
|
|
|
|
|
|
lua_newtable(L);
|
|
|
|
|
|
|
|
// Options
|
|
|
|
lua_pushstring(L, "options");
|
|
|
|
lua_newtable(L);
|
2019-10-09 19:49:58 +02:00
|
|
|
for (opt = lsec_get_ssl_options(); opt->name; opt++) {
|
2017-06-17 03:53:59 +02:00
|
|
|
lua_pushstring(L, opt->name);
|
|
|
|
lua_pushboolean(L, 1);
|
|
|
|
lua_rawset(L, -3);
|
|
|
|
}
|
|
|
|
lua_rawset(L, -3);
|
|
|
|
|
|
|
|
// Protocols
|
|
|
|
lua_pushstring(L, "protocols");
|
|
|
|
lua_newtable(L);
|
|
|
|
|
|
|
|
lua_pushstring(L, "tlsv1");
|
|
|
|
lua_pushboolean(L, 1);
|
|
|
|
lua_rawset(L, -3);
|
|
|
|
lua_pushstring(L, "tlsv1_1");
|
|
|
|
lua_pushboolean(L, 1);
|
|
|
|
lua_rawset(L, -3);
|
|
|
|
lua_pushstring(L, "tlsv1_2");
|
|
|
|
lua_pushboolean(L, 1);
|
|
|
|
lua_rawset(L, -3);
|
2019-10-14 03:11:55 +02:00
|
|
|
#ifdef TLS1_3_VERSION
|
2018-09-13 00:06:46 +02:00
|
|
|
lua_pushstring(L, "tlsv1_3");
|
|
|
|
lua_pushboolean(L, 1);
|
|
|
|
lua_rawset(L, -3);
|
|
|
|
#endif
|
2018-09-12 23:27:43 +02:00
|
|
|
|
2017-06-17 03:53:59 +02:00
|
|
|
lua_rawset(L, -3);
|
|
|
|
|
|
|
|
// Algorithms
|
|
|
|
lua_pushstring(L, "algorithms");
|
|
|
|
lua_newtable(L);
|
|
|
|
|
|
|
|
#ifndef OPENSSL_NO_EC
|
|
|
|
lua_pushstring(L, "ec");
|
|
|
|
lua_pushboolean(L, 1);
|
|
|
|
lua_rawset(L, -3);
|
|
|
|
#endif
|
|
|
|
lua_rawset(L, -3);
|
|
|
|
|
|
|
|
// Curves
|
|
|
|
lua_pushstring(L, "curves");
|
|
|
|
lsec_get_curves(L);
|
|
|
|
lua_rawset(L, -3);
|
|
|
|
|
|
|
|
// Capabilities
|
|
|
|
lua_pushstring(L, "capabilities");
|
|
|
|
lua_newtable(L);
|
|
|
|
|
2018-08-27 20:10:18 +02:00
|
|
|
// ALPN
|
|
|
|
lua_pushstring(L, "alpn");
|
|
|
|
lua_pushboolean(L, 1);
|
|
|
|
lua_rawset(L, -3);
|
|
|
|
|
2019-10-14 03:11:55 +02:00
|
|
|
#ifdef LSEC_ENABLE_DANE
|
2019-07-11 15:09:39 +02:00
|
|
|
// DANE
|
|
|
|
lua_pushstring(L, "dane");
|
2021-09-16 00:53:32 +02:00
|
|
|
#ifdef DANE_FLAG_NO_DANE_EE_NAMECHECKS
|
|
|
|
lua_createtable(L, 0, 1);
|
|
|
|
lua_pushstring(L, "no_ee_namechecks");
|
2019-07-11 15:09:39 +02:00
|
|
|
lua_pushboolean(L, 1);
|
|
|
|
lua_rawset(L, -3);
|
2021-09-16 00:53:32 +02:00
|
|
|
#else
|
|
|
|
lua_pushboolean(L, 1);
|
|
|
|
#endif
|
|
|
|
lua_rawset(L, -3);
|
2019-07-11 15:09:39 +02:00
|
|
|
#endif
|
|
|
|
|
2017-06-17 03:53:59 +02:00
|
|
|
#ifndef OPENSSL_NO_EC
|
|
|
|
lua_pushstring(L, "curves_list");
|
|
|
|
lua_pushboolean(L, 1);
|
|
|
|
lua_rawset(L, -3);
|
|
|
|
lua_pushstring(L, "ecdh_auto");
|
|
|
|
lua_pushboolean(L, 1);
|
|
|
|
lua_rawset(L, -3);
|
|
|
|
#endif
|
|
|
|
lua_rawset(L, -3);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|