aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-ossl/0002-pkey.toPEM-accept-table-arguments.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/lua-ossl/0002-pkey.toPEM-accept-table-arguments.patch')
-rw-r--r--main/lua-ossl/0002-pkey.toPEM-accept-table-arguments.patch35
1 files changed, 35 insertions, 0 deletions
diff --git a/main/lua-ossl/0002-pkey.toPEM-accept-table-arguments.patch b/main/lua-ossl/0002-pkey.toPEM-accept-table-arguments.patch
new file mode 100644
index 0000000000..28fd10fa82
--- /dev/null
+++ b/main/lua-ossl/0002-pkey.toPEM-accept-table-arguments.patch
@@ -0,0 +1,35 @@
+From 2fb6331a5304927fcfe915d5d42535d3d500f540 Mon Sep 17 00:00:00 2001
+From: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
+Date: Sun, 2 Sep 2018 13:18:48 +0300
+Subject: [PATCH 02/10] pkey.toPEM: accept table arguments
+
+---
+ src/openssl.c | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/src/openssl.c b/src/openssl.c
+index acb8289..1905693 100644
+--- a/src/openssl.c
++++ b/src/openssl.c
+@@ -4681,8 +4681,17 @@ static int pk_toPEM(lua_State *L) {
+ // "params", "Parameters",
+ NULL,
+ };
++ int type;
+
+- switch (auxL_checkoption(L, i, NULL, types, 1)) {
++ if (!lua_istable(L, i))
++ lua_pushvalue(L, i);
++ else if (!getfield(L, i, "type"))
++ lua_pushliteral(L, "public");
++
++ type = auxL_checkoption(L, -1, NULL, types, 1);
++ lua_pop(L, 1);
++
++ switch (type) {
+ case 0: case 1: /* public, PublicKey */
+ if (!PEM_write_bio_PUBKEY(bio, key))
+ return auxL_error(L, auxL_EOPENSSL, "pkey:__tostring");
+--
+2.24.1
+