summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Ahern <william@25thandClement.com>2015-12-17 15:39:13 +0800
committerWilliam Ahern <william@25thandClement.com>2015-12-17 15:39:13 +0800
commit05c8a666bd333c8fe14f906b51dfff266ba77e2b (patch)
tree4fce4e0221ee756faa20fe886932eb7f6512c4e5
parent60fc10973eb348cb3d99d27f083437ddeab03f14 (diff)
parentc80559d64791e42f8fec9056343f4629720323e4 (diff)
downloadluaossl-05c8a666bd333c8fe14f906b51dfff266ba77e2b.tar.gz
luaossl-05c8a666bd333c8fe14f906b51dfff266ba77e2b.tar.bz2
luaossl-05c8a666bd333c8fe14f906b51dfff266ba77e2b.zip
Merge branch 'daurnimator-13-setCipherList-args'
-rw-r--r--doc/luaossl.tex4
-rw-r--r--src/openssl.ssl.context.lua13
2 files changed, 15 insertions, 2 deletions
diff --git a/doc/luaossl.tex b/doc/luaossl.tex
index de461ba..433dd03 100644
--- a/doc/luaossl.tex
+++ b/doc/luaossl.tex
@@ -871,9 +871,9 @@ Sets the X.509 certificate \module{openssl.x509} object $crt$ to send during SSL
871 871
872Sets the private key \module{openssl.pkey} object $key$ for use during SSL connection instance handshakes. 872Sets the private key \module{openssl.pkey} object $key$ for use during SSL connection instance handshakes.
873 873
874\subsubsection[\fn{context:setCipherList}]{\fn{context:setCipherList($string$)}} 874\subsubsection[\fn{context:setCipherList}]{\fn{context:setCipherList($string$ [, ...])}}
875 875
876Sets the allowed public key and private key algorithms. The string format is documented in the \href{http://www.openssl.org/docs/apps/ciphers.html#CIPHER_LIST_FORMAT}{OpenSSL ciphers(1) utility documentation}. 876Sets the allowed public key and private key algorithm(s). The string format is documented in the \href{http://www.openssl.org/docs/apps/ciphers.html#CIPHER_LIST_FORMAT}{OpenSSL ciphers(1) utility documentation}.
877 877
878\subsubsection[\fn{context:setEphemeralKey}]{\fn{context:setEphemeralKey($key$)}} 878\subsubsection[\fn{context:setEphemeralKey}]{\fn{context:setEphemeralKey($key$)}}
879 879
diff --git a/src/openssl.ssl.context.lua b/src/openssl.ssl.context.lua
index 44a9163..2098b54 100644
--- a/src/openssl.ssl.context.lua
+++ b/src/openssl.ssl.context.lua
@@ -1,3 +1,16 @@
1local ctx = require"_openssl.ssl.context" 1local ctx = require"_openssl.ssl.context"
2 2
3local pack = table.pack or function(...) return { n = select("#", ...); ... } end
4
5-- Allow passing a vararg of ciphers, or an array
6local setCipherList; setCipherList = ctx.interpose("setCipherList", function (self, ciphers, ...)
7 if (...) then
8 local ciphers_t = pack(ciphers, ...)
9 ciphers = table.concat(ciphers_t, ":", 1, ciphers_t.n)
10 elseif type(ciphers) == "table" then
11 ciphers = table.concat(ciphers, ":")
12 end
13 return setCipherList(self, ciphers)
14end)
15
3return ctx 16return ctx