Revert "fix leak while keeping with the intention behind using EVP_CIPHER_CTX_reset instead of EVP_CIPHER_CTX_new/EVP_CIPHER_CTX_free"
This reverts commit 71d451d4c5826bc4f19b8cc020f08093acd66b1d.
diff --git a/lib/openssl.c b/lib/openssl.c
index 848b044..92358e1 100644
--- a/lib/openssl.c
+++ b/lib/openssl.c
@@ -1290,12 +1290,12 @@
int ptls_openssl_encrypt_ticket(ptls_buffer_t *buf, ptls_iovec_t src,
int (*cb)(unsigned char *key_name, unsigned char *iv, EVP_CIPHER_CTX *ctx, HMAC_CTX *hctx, int enc))
{
- static __thread EVP_CIPHER_CTX *cctx = NULL;
+ EVP_CIPHER_CTX *cctx = NULL;
HMAC_CTX *hctx = NULL;
uint8_t *dst;
int clen, ret;
- if (!cctx && (cctx = EVP_CIPHER_CTX_new()) == NULL) {
+ if ((cctx = EVP_CIPHER_CTX_new()) == NULL) {
ret = PTLS_ERROR_NO_MEMORY;
goto Exit;
}
@@ -1350,11 +1350,11 @@
int ptls_openssl_decrypt_ticket(ptls_buffer_t *buf, ptls_iovec_t src,
int (*cb)(unsigned char *key_name, unsigned char *iv, EVP_CIPHER_CTX *ctx, HMAC_CTX *hctx, int enc))
{
- static __thread EVP_CIPHER_CTX *cctx = NULL;
+ EVP_CIPHER_CTX *cctx = NULL;
HMAC_CTX *hctx = NULL;
int clen, ret;
- if (!cctx && (cctx = EVP_CIPHER_CTX_new()) == NULL) {
+ if ((cctx = EVP_CIPHER_CTX_new()) == NULL) {
ret = PTLS_ERROR_NO_MEMORY;
goto Exit;
}