From 8327753dd8f85e2a971e778389f974614146e12d Mon Sep 17 00:00:00 2001 From: daurnimator Date: Tue, 8 Nov 2016 16:58:33 +1100 Subject: openssl.pkey: Use reset bio after :encrypt() and :decrypt() --- src/openssl.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/openssl.c b/src/openssl.c index 85c7503..8ff21ce 100644 --- a/src/openssl.c +++ b/src/openssl.c @@ -3225,12 +3225,15 @@ static int pk_decrypt(lua_State *L) { lua_pushlstring(L, buf->data, outlen); + BIO_reset(*bio); + return 1; sslerr: if (ctx) { EVP_PKEY_CTX_free(ctx); ctx = NULL; } + BIO_reset(*bio); return auxL_error(L, auxL_EOPENSSL, "pkey:decrypt"); } /* pk_decrypt() */ @@ -3280,12 +3283,15 @@ static int pk_encrypt(lua_State *L) { lua_pushlstring(L, buf->data, outlen); + BIO_reset(*bio); + return 1; sslerr: if (ctx) { EVP_PKEY_CTX_free(ctx); ctx = NULL; } + BIO_reset(*bio); return auxL_error(L, auxL_EOPENSSL, "pkey:encrypt"); } /* pk_encrypt() */ -- cgit v1.2.3-55-g6feb