From 7119335e42107f982c0a9166ca0b372a3d87e22c Mon Sep 17 00:00:00 2001 From: olszomal Date: Wed, 13 Nov 2024 12:04:45 +0100 Subject: [PATCH] Bind helper methods in engine_ctrl() only for OpenSSL versions older than 3.0. With OpenSSL 3.x, an engine might be used if defined in `openssl.cnf`. This causes memory leaks when engine control commands are set in the config file. For OpenSSL 3.0 and newer, add engine routines only after loading keys. --- src/eng_front.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/eng_front.c b/src/eng_front.c index 6ad7abbe..bc9e4786 100644 --- a/src/eng_front.c +++ b/src/eng_front.c @@ -202,7 +202,9 @@ static int engine_ctrl(ENGINE *engine, int cmd, long i, void *p, void (*f) ()) ctx = get_ctx(engine); if (!ctx) return 0; +#if OPENSSL_VERSION_NUMBER < 0x30000000L bind_helper_methods(engine); +#endif return ctx_engine_ctrl(ctx, cmd, i, p, f); }