diff options
-rw-r--r-- | doc/luaossl.pdf | bin | 288460 -> 289161 bytes | |||
-rw-r--r-- | doc/luaossl.tex | 4 | ||||
-rw-r--r-- | src/openssl.c | 6 | ||||
-rw-r--r-- | src/openssl.ssl.context.lua | 13 |
4 files changed, 21 insertions, 2 deletions
diff --git a/doc/luaossl.pdf b/doc/luaossl.pdf Binary files differindex 0823b81..dccba97 100644 --- a/doc/luaossl.pdf +++ b/doc/luaossl.pdf 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 Sets the private key \module{openssl.pkey} object $key$ for use during SSL connection instance handshakes. -\subsubsection[\fn{context:setCipherList}]{\fn{context:setCipherList($string$)}} +\subsubsection[\fn{context:setCipherList}]{\fn{context:setCipherList($string$ [, ...])}} -Sets 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}. +Sets 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}. \subsubsection[\fn{context:setEphemeralKey}]{\fn{context:setEphemeralKey($key$)}} diff --git a/src/openssl.c b/src/openssl.c index 8fadb02..4da28ef 100644 --- a/src/openssl.c +++ b/src/openssl.c @@ -1819,6 +1819,12 @@ static int bn__mod(lua_State *L) { if (!BN_mod(r, a, b, getctx(L))) return auxL_error(L, auxL_EOPENSSL, "bignum:__mod"); + /* lua has different rounding behaviour for mod than C */ + if (!BN_is_zero(r) && (BN_is_negative(a) ^ BN_is_negative(b))) { + if (!BN_add(r, r, b)) + return auxL_error(L, auxL_EOPENSSL, "bignum:__mod"); + } + return 1; } /* bn__mod() */ 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 @@ local ctx = require"_openssl.ssl.context" +local pack = table.pack or function(...) return { n = select("#", ...); ... } end + +-- Allow passing a vararg of ciphers, or an array +local setCipherList; setCipherList = ctx.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) + return ctx |