summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Ahern <william@25thandClement.com>2015-12-17 16:39:43 +0800
committerWilliam 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) {
2420 2420
2421 len = BIO_get_mem_data(bio, &pem); 2421 len = BIO_get_mem_data(bio, &pem);
2422 lua_pushlstring(L, pem, len); 2422 lua_pushlstring(L, pem, len);
2423
2424 BIO_reset(bio); 2423 BIO_reset(bio);
2424
2425 break; 2425 break;
2426 case 2: case 3: /* private, PrivateKey */ 2426 case 2: case 3: /* private, PrivateKey */
2427 if (!PEM_write_bio_PrivateKey(bio, key, 0, 0, 0, 0, 0)) 2427 if (!PEM_write_bio_PrivateKey(bio, key, 0, 0, 0, 0, 0))
@@ -2429,6 +2429,7 @@ static int pk_toPEM(lua_State *L) {
2429 2429
2430 len = BIO_get_mem_data(bio, &pem); 2430 len = BIO_get_mem_data(bio, &pem);
2431 lua_pushlstring(L, pem, len); 2431 lua_pushlstring(L, pem, len);
2432 BIO_reset(bio);
2432 2433
2433 break; 2434 break;
2434#if 0 2435#if 0