aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/openssl.c14
-rw-r--r--src/openssl.ssl.lua11
2 files changed, 25 insertions, 0 deletions
diff --git a/src/openssl.c b/src/openssl.c
index e49c0e7..2495a09 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -10026,6 +10026,19 @@ static int ssl_getCipherInfo(lua_State *L) {
} /* ssl_getCipherInfo() */
+static int ssl_setCipherList(lua_State *L) {
+ SSL *ssl = checksimple(L, 1, SSL_CLASS);
+ const char *ciphers = luaL_checkstring(L, 2);
+
+ if (!SSL_set_cipher_list(ssl, ciphers))
+ return auxL_error(L, auxL_EOPENSSL, "ssl:setCipherList");
+
+ lua_pushboolean(L, 1);
+
+ return 1;
+} /* ssl_setCipherList() */
+
+
#if HAVE_SSL_SET_CURVES_LIST
static int ssl_setCurvesList(lua_State *L) {
SSL *ssl = checksimple(L, 1, SSL_CLASS);
@@ -10344,6 +10357,7 @@ static const auxL_Reg ssl_methods[] = {
{ "getPeerCertificate", &ssl_getPeerCertificate },
{ "getPeerChain", &ssl_getPeerChain },
{ "getCipherInfo", &ssl_getCipherInfo },
+ { "setCipherList", &ssl_setCipherList },
#if HAVE_SSL_SET_CURVES_LIST
{ "setCurvesList", &ssl_setCurvesList },
#endif
diff --git a/src/openssl.ssl.lua b/src/openssl.ssl.lua
index 4f9f82b..22311cd 100644
--- a/src/openssl.ssl.lua
+++ b/src/openssl.ssl.lua
@@ -8,6 +8,17 @@ ssl.interpose("setStore", function(self, store)
return true
end)
+-- Allow passing a vararg of ciphers, or an array
+local setCipherList; setCipherList = ssl.interpose("setCipherList", function (self, ciphers, ...)
+ if (...) then
+ local ciphers_t = pack(ciphers, ...)
+ ciphers = table.concat(ciphers_t, ":", 1, ciphers_t.n)
+ elseif type(ciphers) == "table" then
+ ciphers = table.concat(ciphers, ":")
+ end
+ return setCipherList(self, ciphers)
+end)
+
-- Allow passing a vararg of curves, or an array
local setCurvesList = ssl.interpose("setCurvesList", nil)
if setCurvesList then