From 8d91ac802732222ba1b775712543601137d2bf20 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Mon, 3 Apr 2017 11:01:54 +1000 Subject: openssl.ssl.context: Add ctx:setCurvesList --- src/openssl.ssl.context.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/openssl.ssl.context.lua') diff --git a/src/openssl.ssl.context.lua b/src/openssl.ssl.context.lua index 2098b54..3263fb1 100644 --- a/src/openssl.ssl.context.lua +++ b/src/openssl.ssl.context.lua @@ -13,4 +13,18 @@ local setCipherList; setCipherList = ctx.interpose("setCipherList", function (se return setCipherList(self, ciphers) end) +-- Allow passing a vararg of curves, or an array +local setCurvesList = ctx.interpose("setCurvesList", nil) +if setCurvesList then + ctx.interpose("setCurvesList", function (self, curves, ...) + if (...) then + local curves_t = pack(curves, ...) + curves = table.concat(curves_t, ":", 1, curves_t.n) + elseif type(curves) == "table" then + curves = table.concat(curves, ":") + end + return setCurvesList(self, curves) + end) +end + return ctx -- cgit v1.2.3-59-g8ed1b