aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatarLibravatar William Ahern <william@25thandClement.com> 2015-12-17 16:39:43 +0800
committerLibravatarLibravatar William Ahern <william@25thandClement.com> 2015-12-17 16:39:43 +0800
commitcd859abad9318b2ffb29d9a8caf3342ca01081ec (patch)
tree68b263385e15cbf6bb8704f356bef8660191927b
parent946d173bfed7d45c1413f51c890693a668615c88 (diff)
downloadluaossl-cd859abad9318b2ffb29d9a8caf3342ca01081ec.tar.gz
luaossl-cd859abad9318b2ffb29d9a8caf3342ca01081ec.tar.bz2
luaossl-cd859abad9318b2ffb29d9a8caf3342ca01081ec.zip
forgot to call BIO_reset after pushing the private key PEM text, which in the multiple argument form
caused the next PEM text to be appended. closes issue #34
-rw-r--r--src/openssl.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/openssl.c b/src/openssl.c
index 8d1435a..e91e270 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -2420,8 +2420,8 @@ static int pk_toPEM(lua_State *L) {
len = BIO_get_mem_data(bio, &pem);
lua_pushlstring(L, pem, len);
-
BIO_reset(bio);
+
break;
case 2: case 3: /* private, PrivateKey */
if (!PEM_write_bio_PrivateKey(bio, key, 0, 0, 0, 0, 0))
@@ -2429,6 +2429,7 @@ static int pk_toPEM(lua_State *L) {
len = BIO_get_mem_data(bio, &pem);
lua_pushlstring(L, pem, len);
+ BIO_reset(bio);
break;
#if 0