diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/openssl.c | 6 | ||||
-rw-r--r-- | src/openssl.ssl.context.lua | 13 |
2 files changed, 19 insertions, 0 deletions
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) { | |||
1819 | if (!BN_mod(r, a, b, getctx(L))) | 1819 | if (!BN_mod(r, a, b, getctx(L))) |
1820 | return auxL_error(L, auxL_EOPENSSL, "bignum:__mod"); | 1820 | return auxL_error(L, auxL_EOPENSSL, "bignum:__mod"); |
1821 | 1821 | ||
1822 | /* lua has different rounding behaviour for mod than C */ | ||
1823 | if (!BN_is_zero(r) && (BN_is_negative(a) ^ BN_is_negative(b))) { | ||
1824 | if (!BN_add(r, r, b)) | ||
1825 | return auxL_error(L, auxL_EOPENSSL, "bignum:__mod"); | ||
1826 | } | ||
1827 | |||
1822 | return 1; | 1828 | return 1; |
1823 | } /* bn__mod() */ | 1829 | } /* bn__mod() */ |
1824 | 1830 | ||
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 @@ | |||
1 | local ctx = require"_openssl.ssl.context" | 1 | local ctx = require"_openssl.ssl.context" |
2 | 2 | ||
3 | local pack = table.pack or function(...) return { n = select("#", ...); ... } end | ||
4 | |||
5 | -- Allow passing a vararg of ciphers, or an array | ||
6 | local 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) | ||
14 | end) | ||
15 | |||
3 | return ctx | 16 | return ctx |