mirror of
https://github.com/brunoos/luasec.git
synced 2024-11-08 06:28:26 +01:00
Add 'ciphersuites' property for TLS 1.3
This commit is contained in:
parent
1c9401ae54
commit
1efa37087e
@ -436,14 +436,31 @@ static int set_cipher(lua_State *L)
|
||||
const char *list = luaL_checkstring(L, 2);
|
||||
if (SSL_CTX_set_cipher_list(ctx, list) != 1) {
|
||||
lua_pushboolean(L, 0);
|
||||
lua_pushfstring(L, "error setting cipher list (%s)",
|
||||
ERR_reason_error_string(ERR_get_error()));
|
||||
lua_pushfstring(L, "error setting cipher list (%s)", ERR_reason_error_string(ERR_get_error()));
|
||||
return 2;
|
||||
}
|
||||
lua_pushboolean(L, 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the cipher suites.
|
||||
*/
|
||||
static int set_ciphersuites(lua_State *L)
|
||||
{
|
||||
#if defined(TLS1_3_VERSION)
|
||||
SSL_CTX *ctx = lsec_checkcontext(L, 1);
|
||||
const char *list = luaL_checkstring(L, 2);
|
||||
if (SSL_CTX_set_ciphersuites(ctx, list) != 1) {
|
||||
lua_pushboolean(L, 0);
|
||||
lua_pushfstring(L, "error setting cipher list (%s)", ERR_reason_error_string(ERR_get_error()));
|
||||
return 2;
|
||||
}
|
||||
#endif
|
||||
lua_pushboolean(L, 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the depth for certificate checking.
|
||||
*/
|
||||
@ -690,19 +707,20 @@ static int set_alpn_cb(lua_State *L)
|
||||
* Package functions
|
||||
*/
|
||||
static luaL_Reg funcs[] = {
|
||||
{"create", create},
|
||||
{"locations", load_locations},
|
||||
{"loadcert", load_cert},
|
||||
{"loadkey", load_key},
|
||||
{"checkkey", check_key},
|
||||
{"setalpn", set_alpn},
|
||||
{"setalpncb", set_alpn_cb},
|
||||
{"setcipher", set_cipher},
|
||||
{"setdepth", set_depth},
|
||||
{"setdhparam", set_dhparam},
|
||||
{"setverify", set_verify},
|
||||
{"setoptions", set_options},
|
||||
{"setmode", set_mode},
|
||||
{"create", create},
|
||||
{"locations", load_locations},
|
||||
{"loadcert", load_cert},
|
||||
{"loadkey", load_key},
|
||||
{"checkkey", check_key},
|
||||
{"setalpn", set_alpn},
|
||||
{"setalpncb", set_alpn_cb},
|
||||
{"setcipher", set_cipher},
|
||||
{"setciphersuites", set_ciphersuites},
|
||||
{"setdepth", set_depth},
|
||||
{"setdhparam", set_dhparam},
|
||||
{"setverify", set_verify},
|
||||
{"setoptions", set_options},
|
||||
{"setmode", set_mode},
|
||||
|
||||
#if !defined(OPENSSL_NO_EC)
|
||||
{"setcurve", set_curve},
|
||||
|
@ -112,7 +112,12 @@ local function newcontext(cfg)
|
||||
succ, msg = context.setcipher(ctx, cfg.ciphers)
|
||||
if not succ then return nil, msg end
|
||||
end
|
||||
-- Set the verification options
|
||||
-- Set SSL cipher suites
|
||||
if cfg.ciphersuites then
|
||||
succ, msg = context.setciphersuites(ctx, cfg.ciphersuites)
|
||||
if not succ then return nil, msg end
|
||||
end
|
||||
-- Set the verification options
|
||||
succ, msg = optexec(context.setverify, cfg.verify, ctx)
|
||||
if not succ then return nil, msg end
|
||||
-- Set SSL options
|
||||
|
Loading…
Reference in New Issue
Block a user