aports/main/lua-ossl/0002-pkey.toPEM-accept-table-arguments.patch
Kaarle Ritvanen 96eb0e947a main/lua-ossl: align with latest patch set
available at https://github.com/wahern/luaossl/pull/128

Earlier, an empty password was returned when the callback raised a Lua
error. Now the error is propagated to the OpenSSL level.

This commit also enables the -dbg subpackage.
2025-02-12 15:07:18 +02:00

35 lines
963 B
Diff

From 24ff6dab4a15529b1c71e3c70119cde65976dfcf 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 2/9] 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 35ff49a..6df0a17 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.48.1