address comment: revert to the simplest fix. There was no intention to keep the cctx as static.
diff --git a/lib/openssl.c b/lib/openssl.c
index 92358e1..c55ba93 100644
--- a/lib/openssl.c
+++ b/lib/openssl.c
@@ -1234,14 +1234,6 @@
return ret;
}
-static void cleanup_cipher_ctx(EVP_CIPHER_CTX *ctx)
-{
- if (!EVP_CIPHER_CTX_reset(ctx)) {
- fprintf(stderr, "EVP_CIPHER_CTX_reset() failed\n");
- abort();
- }
-}
-
int ptls_openssl_init_verify_certificate(ptls_openssl_verify_certificate_t *self, X509_STORE *store)
{
*self = (ptls_openssl_verify_certificate_t){{verify_cert}};
@@ -1341,7 +1333,7 @@
Exit:
if (cctx != NULL)
- cleanup_cipher_ctx(cctx);
+ EVP_CIPHER_CTX_free(cctx);
if (hctx != NULL)
HMAC_CTX_free(hctx);
return ret;
@@ -1411,7 +1403,7 @@
Exit:
if (cctx != NULL)
- cleanup_cipher_ctx(cctx);
+ EVP_CIPHER_CTX_free(cctx);
if (hctx != NULL)
HMAC_CTX_free(hctx);
return ret;