aboutsummaryrefslogtreecommitdiffstats
path: root/main/lua-ossl/0009-pkey.toPEM-use-password-callback.patch
blob: 108621099ecc2140e2add870ed203629e53ba0d4 (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 4899a210dfdd91fa75b77601d29df0152aecc382 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 09/10] pkey.toPEM: 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 937ffa6..3af285b 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -4748,7 +4748,7 @@ static int pk_toPEM(lua_State *L) {
 					return luaL_error(L, "pkey:toPEM: password not defined");
 			}
 
-			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:__tostring");
 
 			len = BIO_get_mem_data(bio, &pem);
-- 
2.24.1