aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-ossl/0001-pkey-getPrivateKey-method.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/lua-ossl/0001-pkey-getPrivateKey-method.patch')
-rw-r--r--main/lua-ossl/0001-pkey-getPrivateKey-method.patch45
1 files changed, 45 insertions, 0 deletions
diff --git a/main/lua-ossl/0001-pkey-getPrivateKey-method.patch b/main/lua-ossl/0001-pkey-getPrivateKey-method.patch
new file mode 100644
index 0000000000..d5a6496c43
--- /dev/null
+++ b/main/lua-ossl/0001-pkey-getPrivateKey-method.patch
@@ -0,0 +1,45 @@
+From 3f9c54caeb4b70c4e3a1776951b13daec3accf07 Mon Sep 17 00:00:00 2001
+From: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
+Date: Mon, 30 Apr 2018 13:19:28 +0300
+Subject: [PATCH 1/5] pkey: getPrivateKey method
+
+---
+ src/openssl.c | 15 +++++++++++++++
+ 1 file changed, 15 insertions(+)
+
+diff --git a/src/openssl.c b/src/openssl.c
+index 5d757a2..0df6b61 100644
+--- a/src/openssl.c
++++ b/src/openssl.c
+@@ -4103,6 +4103,20 @@ static int pk_toPEM(lua_State *L) {
+ } /* pk_toPEM() */
+
+
++static int pk_getPrivateKey(lua_State *L) {
++ BIO *bio = getbio(L);
++ char *str;
++ long len;
++
++ if (!PEM_write_bio_PrivateKey(bio, checksimple(L, 1, PKEY_CLASS), 0, 0, 0, 0, 0))
++ return auxL_error(L, auxL_EOPENSSL, "pkey:getPrivateKey");
++ len = BIO_get_mem_data(bio, &str);
++ lua_pushlstring(L, str, len);
++
++ return 1;
++} /* pk_getPrivateKey() */
++
++
+ static int pk_getDefaultDigestName(lua_State *L) {
+ EVP_PKEY *key = checksimple(L, 1, PKEY_CLASS);
+ int nid;
+@@ -4680,6 +4694,7 @@ static const auxL_Reg pk_methods[] = {
+ { "toPEM", &pk_toPEM },
+ { "tostring", &pk__tostring },
+ { "verify", &pk_verify },
++ { "getPrivateKey", &pk_getPrivateKey },
+ { NULL, NULL },
+ };
+
+--
+2.18.0
+