--- ../curl-7.13.0/src/main.c	2005-01-27 17:59:01.000000000 +0200
+++ src/main.c	2005-02-14 02:10:17.000000000 +0200
@@ -343,6 +343,9 @@
     "    --key-type <type> Private key file type (DER/PEM/ENG) (SSL)",
     "    --pass  <pass>  Pass phrase for the private key (SSL)",
     "    --engine <eng>  Crypto engine to use (SSL). \"--engine list\" for list",
+    "    --engine-path <path> Path of the dynamic crypto engine (SSL).",
+    "    --engine-id <id> Id of the dynamic crypto engine (SSL).",
+    "    --engine-pkcs11 <path> Path of the PKCS#11 module to use with engine (SSL).",
     "    --cacert <file> CA certificate to verify peer against (SSL)",
     "    --capath <directory> CA directory (made using c_rehash) to verify",
     "                    peer against (SSL)",
@@ -493,6 +496,9 @@
   char *key_type;
   char *key_passwd;
   char *engine;
+  char *engine_path;
+  char *engine_id;
+  char *engine_pkcs11;
   bool list_engines;
   bool crlf;
   char *customrequest;
@@ -1279,6 +1285,9 @@
     {"Ee","pass",        TRUE},
     {"Ef","engine",      TRUE},
     {"Eg","capath ",     TRUE},
+    {"Eh","engine-path", TRUE},
+    {"Ei","engine-id",   TRUE},
+    {"Ej","engine-pkcs11", TRUE},    
     {"f", "fail",        FALSE},
     {"F", "form",        TRUE},
     {"g", "globoff",     FALSE},
@@ -1795,6 +1804,15 @@
         /* CA cert directory */
         GetStr(&config->capath, nextarg);
         break;
+      case 'h': /* crypto engine path */
+        GetStr(&config->engine_path, nextarg);
+        break;
+      case 'i': /* crypto engine id */
+        GetStr(&config->engine_id, nextarg);
+        break;
+      case 'j': /* pkcs11 path  */
+        GetStr(&config->engine_pkcs11, nextarg);
+        break;
       default: /* certificate file */
         {
           char *ptr = strchr(nextarg, ':');
@@ -3622,6 +3640,15 @@
         res = CURLE_OK;
 
         /* new in curl ?? */
+        if (config->engine_path) {
+          res = curl_easy_setopt(curl, CURLOPT_SSLENGINE_PATH, config->engine_path);
+        }
+        if (config->engine_id) {
+          res = curl_easy_setopt(curl, CURLOPT_SSLENGINE_ID, config->engine_id);
+        }
+        if (config->engine_pkcs11) {
+          res = curl_easy_setopt(curl, CURLOPT_SSLENGINE_PKCS11, config->engine_pkcs11);
+        }
         if (config->engine) {
           res = curl_easy_setopt(curl, CURLOPT_SSLENGINE, config->engine);
           curl_easy_setopt(curl, CURLOPT_SSLENGINE_DEFAULT, 1);
--- ../curl-7.13.0/lib/ssluse.c	2005-02-01 00:55:32.000000000 +0200
+++ lib/ssluse.c	2005-02-14 02:30:29.000000000 +0200
@@ -524,7 +524,7 @@
     return;
 
   init_ssl++; /* never again */
-
+#define HAVE_ENGINE_LOAD_BUILTIN_ENGINES 1
 #ifdef HAVE_ENGINE_LOAD_BUILTIN_ENGINES
   ENGINE_load_builtin_engines();
 #endif
@@ -595,6 +595,30 @@
     ENGINE_free(data->state.engine);
   }
   data->state.engine = NULL;
+  
+  if (!strcmp(engine, "dynamic")) {
+    if ((!data->state.engine_path || !data->state.engine_id)
+        || !ENGINE_ctrl_cmd_string(e, "SO_PATH", data->state.engine_path, 0)
+        || !ENGINE_ctrl_cmd_string(e, "ID", data->state.engine_id, 0)
+        || !ENGINE_ctrl_cmd_string(e, "LIST_ADD", "1", 0)) {
+      ENGINE_free(e);
+      failf(data, "Failed to set attributes of dynamic engine!");
+      return (CURLE_SSL_ENGINE_NOTFOUND);
+    }
+  }
+  
+  if (!ENGINE_ctrl_cmd_string(e, "LOAD", NULL, 0)) {
+    failf(data, "Failed to load dynamic engine!");
+    ENGINE_free(e);
+    return (CURLE_SSL_ENGINE_NOTFOUND);
+  }
+  
+  if (data->state.engine_pkcs11 && !ENGINE_ctrl_cmd_string(e, "MODULE_PATH", data->state.engine_pkcs11, 0)) {
+    failf(data, "Failed to load pkcs11 module!");
+    ENGINE_free(e);
+    return (CURLE_SSL_ENGINE_NOTFOUND);
+  }
+   
   if (!ENGINE_init(e)) {
     char buf[256];
 

