--- stunnel-4.14/src/ssl.c	Thu Oct 27 09:42:54 2005 UTC
+++ stunnel/src/ssl.c	Tue Mar 28 08:48:03 2006 UTC
@@ -122,6 +143,21 @@
 }
 
 #if (SSLEAY_VERSION_NUMBER >= 0x00907000L) && defined(HAVE_OSSL_ENGINE_H)
+static ENGINE *load_dynamic_engine(const char *engine)
+{
+	ENGINE *e = ENGINE_by_id("dynamic");
+	if (e)
+  {
+		if (!ENGINE_ctrl_cmd_string(e, "SO_PATH", engine, 0)
+				|| !ENGINE_ctrl_cmd_string(e, "LOAD", NULL, 0))
+		{
+			ENGINE_free(e);
+			e = NULL;
+		}
+	}
+	return e;
+}
+
 static void init_engine(void) {
     ENGINE *e;
 
@@ -133,9 +169,12 @@
     }
     e=ENGINE_by_id(options.engine);
     if(!e) {
+        e = load_dynamic_engine(options.engine);
+        if (!e) {
         s_log(LOG_ERR, "Engine not found");
         exit(1);
     }
+    }
     if(!ENGINE_init(e)) {
         s_log(LOG_ERR, "Engine can't be initialized");
         ENGINE_free(e);
