diff options
author | daurnimator <quae@daurnimator.com> | 2016-11-08 16:58:33 +1100 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2016-11-08 16:58:33 +1100 |
commit | 8327753dd8f85e2a971e778389f974614146e12d (patch) | |
tree | c222f3532470d7bbba4d5d13b2fef0f235db7d2d | |
parent | d74ec1dc86f4e0e9b3f677628ed136ca4139668c (diff) | |
download | luaossl-8327753dd8f85e2a971e778389f974614146e12d.tar.gz luaossl-8327753dd8f85e2a971e778389f974614146e12d.tar.bz2 luaossl-8327753dd8f85e2a971e778389f974614146e12d.zip |
openssl.pkey: Use reset bio after :encrypt() and :decrypt()
-rw-r--r-- | src/openssl.c | 6 |
1 files changed, 6 insertions, 0 deletions
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) { | |||
3225 | 3225 | ||
3226 | lua_pushlstring(L, buf->data, outlen); | 3226 | lua_pushlstring(L, buf->data, outlen); |
3227 | 3227 | ||
3228 | BIO_reset(*bio); | ||
3229 | |||
3228 | return 1; | 3230 | return 1; |
3229 | sslerr: | 3231 | sslerr: |
3230 | if (ctx) { | 3232 | if (ctx) { |
3231 | EVP_PKEY_CTX_free(ctx); | 3233 | EVP_PKEY_CTX_free(ctx); |
3232 | ctx = NULL; | 3234 | ctx = NULL; |
3233 | } | 3235 | } |
3236 | BIO_reset(*bio); | ||
3234 | 3237 | ||
3235 | return auxL_error(L, auxL_EOPENSSL, "pkey:decrypt"); | 3238 | return auxL_error(L, auxL_EOPENSSL, "pkey:decrypt"); |
3236 | } /* pk_decrypt() */ | 3239 | } /* pk_decrypt() */ |
@@ -3280,12 +3283,15 @@ static int pk_encrypt(lua_State *L) { | |||
3280 | 3283 | ||
3281 | lua_pushlstring(L, buf->data, outlen); | 3284 | lua_pushlstring(L, buf->data, outlen); |
3282 | 3285 | ||
3286 | BIO_reset(*bio); | ||
3287 | |||
3283 | return 1; | 3288 | return 1; |
3284 | sslerr: | 3289 | sslerr: |
3285 | if (ctx) { | 3290 | if (ctx) { |
3286 | EVP_PKEY_CTX_free(ctx); | 3291 | EVP_PKEY_CTX_free(ctx); |
3287 | ctx = NULL; | 3292 | ctx = NULL; |
3288 | } | 3293 | } |
3294 | BIO_reset(*bio); | ||
3289 | 3295 | ||
3290 | return auxL_error(L, auxL_EOPENSSL, "pkey:encrypt"); | 3296 | return auxL_error(L, auxL_EOPENSSL, "pkey:encrypt"); |
3291 | } /* pk_encrypt() */ | 3297 | } /* pk_encrypt() */ |