aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-ossl/0004-pkey.getPrivateKey-use-password-callback.patch
blob: b9317c59a380db4c299ae2d0b1c198512cfed58d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
From a1bbc97c659e72f110f68d37c2b09ef1cf32b46a Mon Sep 17 00:00:00 2001
From: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
Date: Thu, 3 May 2018 21:21:16 +0300
Subject: [PATCH 4/5] pkey.getPrivateKey: use password callback

---
 src/openssl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/openssl.c b/src/openssl.c
index 2e6d802..be585fe 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -4130,7 +4130,7 @@ static int pk_getPrivateKey(lua_State *L) {
 	char *str;
 	long len;
 
-	if (!PEM_write_bio_PrivateKey(bio, key, cipher, pass, pass ? strlen(pass) : 0, 0, 0))
+	if (!PEM_write_bio_PrivateKey(bio, key, cipher, NULL, 0, pem_pw_cb, pass))
 		return auxL_error(L, auxL_EOPENSSL, "pkey:getPrivateKey");
 	len = BIO_get_mem_data(bio, &str);
 	lua_pushlstring(L, str, len);
-- 
2.18.0