aboutsummaryrefslogtreecommitdiffstats
path: root/libarchive/archive_cryptor.c
diff options
context:
space:
mode:
Diffstat (limited to 'libarchive/archive_cryptor.c')
-rw-r--r--libarchive/archive_cryptor.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libarchive/archive_cryptor.c b/libarchive/archive_cryptor.c
index 71967c9d46f0..74df5c405b08 100644
--- a/libarchive/archive_cryptor.c
+++ b/libarchive/archive_cryptor.c
@@ -316,7 +316,14 @@ aes_ctr_init(archive_crypto_ctx *ctx, const uint8_t *key, size_t key_len)
memcpy(ctx->key, key, key_len);
memset(ctx->nonce, 0, sizeof(ctx->nonce));
ctx->encr_pos = AES_BLOCK_SIZE;
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
+ if (!EVP_CIPHER_CTX_reset(ctx->ctx)) {
+ EVP_CIPHER_CTX_free(ctx->ctx);
+ ctx->ctx = NULL;
+ }
+#else
EVP_CIPHER_CTX_init(ctx->ctx);
+#endif
return 0;
}