? curl-7.14.0-CVS.tar.gz
? libcurl.pc
? src/config.h.in
? tests/runtests.html
? tests/runtests.pdf
? tests/testcurl.html
? tests/testcurl.pdf
Index: docs/curl.1
===================================================================
RCS file: /cvsroot/curl/curl/docs/curl.1,v
retrieving revision 1.152
diff -u -u -r1.152 curl.1
--- docs/curl.1	7 Apr 2005 07:30:02 -0000	1.152
+++ docs/curl.1	16 Apr 2005 08:53:06 -0000
@@ -275,6 +275,14 @@
 operations. Use \fI--engine list\fP to print a list of build-time supported
 engines. Note that not all (or none) of the engines may be available at
 run-time.
+.IP "--engine-id <name>"
+Set the name of the engine that shall be assigned to the \fIdynamic\fP engine.
+.IP "--engine-path <path>"
+Path to the dynamic OpenSSL engine to be used cor crypto operations.
+.IP "--engine-pkcs11 <path>"
+Path to the PKCS#11 module to be used with dynamic OpenSSL engine provided
+by OpenSC project.
+
 .IP "--environment"
 (RISC OS ONLY) Sets a range of environment variables, using the names the -w
 option supports, to easier allow extraction of useful information after having
Index: include/curl/curl.h
===================================================================
RCS file: /cvsroot/curl/curl/include/curl/curl.h,v
retrieving revision 1.281
diff -u -u -r1.281 curl.h
--- include/curl/curl.h	7 Apr 2005 15:18:51 -0000	1.281
+++ include/curl/curl.h	16 Apr 2005 08:53:06 -0000
@@ -889,6 +889,15 @@
   /* zero terminated string for pass on to the FTP server when asked for
      "account" info */
   CINIT(FTP_ACCOUNT, OBJECTPOINT, 134),
+  
+  /* Path of the dynamic engine */
+  CINIT(SSLENGINE_PATH, OBJECTPOINT, 135),
+
+  /* ID of the dynamic module */
+  CINIT(SSLENGINE_ID, OBJECTPOINT, 136),
+  
+  /* Path of the PKCS#11 module */
+  CINIT(SSLENGINE_PKCS11, OBJECTPOINT, 137),
 
   CURLOPT_LASTENTRY /* the last unused */
 } CURLoption;
Index: lib/ssluse.c
===================================================================
RCS file: /cvsroot/curl/curl/lib/ssluse.c,v
retrieving revision 1.134
diff -u -u -r1.134 ssluse.c
--- lib/ssluse.c	13 Apr 2005 06:52:03 -0000	1.134
+++ lib/ssluse.c	16 Apr 2005 08:53:07 -0000
@@ -539,6 +539,7 @@
  */
 int Curl_ossl_init(void)
 {
+#define HAVE_ENGINE_LOAD_BUILTIN_ENGINES 1
 #ifdef HAVE_ENGINE_LOAD_BUILTIN_ENGINES
   ENGINE_load_builtin_engines();
 #endif
@@ -597,6 +598,30 @@
     ENGINE_free(data->state.engine);
   }
   data->state.engine = NULL;
+  
+  if (!strcmp(engine, "dynamic")) {
+    if ((!data->set.engine_path || !data->set.engine_id)
+        || !ENGINE_ctrl_cmd_string(e, "SO_PATH", data->set.engine_path, 0)
+        || !ENGINE_ctrl_cmd_string(e, "ID", data->set.engine_id, 0)
+        || !ENGINE_ctrl_cmd_string(e, "LIST_ADD", "1", 0)) {
+      ENGINE_free(e);
+      failf(data, "Failed to set attributes of dynamic engine! %s %s", data->set.engine_path,data->set.engine_id);
+      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->set.engine_pkcs11 && !ENGINE_ctrl_cmd_string(e, "MODULE_PATH", data->set.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];
 
Index: lib/url.c
===================================================================
RCS file: /cvsroot/curl/curl/lib/url.c,v
retrieving revision 1.454
diff -u -u -r1.454 url.c
--- lib/url.c	7 Apr 2005 15:27:14 -0000	1.454
+++ lib/url.c	16 Apr 2005 08:53:07 -0000
@@ -1158,6 +1158,28 @@
      */
     result = Curl_ssl_set_engine_default(data);
     break;
+
+  case CURLOPT_SSLENGINE_PATH:
+    /*
+     * Set the path of the dynamic module
+     */
+    data->set.engine_path = va_arg(param, char *);
+    break;
+
+  case CURLOPT_SSLENGINE_ID:
+    /*
+     * Set the path of the dynamic module
+     */
+    data->set.engine_id = va_arg(param, char *);
+    break;    
+
+  case CURLOPT_SSLENGINE_PKCS11:
+    /*
+     * Set the path of the PKCS#11 module
+     */
+    data->set.engine_pkcs11 = va_arg(param, char *);
+    break;
+
   case CURLOPT_CRLF:
     /*
      * Kludgy option to enable CRLF convertions. Subject for removal.
Index: lib/urldata.h
===================================================================
RCS file: /cvsroot/curl/curl/lib/urldata.h,v
retrieving revision 1.266
diff -u -u -r1.266 urldata.h
--- lib/urldata.h	8 Apr 2005 16:59:13 -0000	1.266
+++ lib/urldata.h	16 Apr 2005 08:53:07 -0000
@@ -1056,7 +1056,9 @@
   bool no_signal;        /* do not use any signal/alarm handler */
   bool global_dns_cache; /* subject for future removal */
   bool tcp_nodelay;      /* whether to enable TCP_NODELAY or not */
-
+  char *engine_path;     /* path of the dynamic SSL engine */
+  char *engine_id;       /* ID for the dynamic engine */
+  char *engine_pkcs11;   /* Path of PKCS#11 module to be used with OpenSC engine_pkcs11 SSL engine */
 };
 
 /*
Index: src/main.c
===================================================================
RCS file: /cvsroot/curl/curl/src/main.c,v
retrieving revision 1.316
diff -u -u -r1.316 main.c
--- src/main.c	28 Mar 2005 22:17:49 -0000	1.316
+++ src/main.c	16 Apr 2005 08:53:08 -0000
@@ -342,6 +342,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)",
@@ -494,6 +497,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;
@@ -1286,6 +1292,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},
     {"Fs","form-string", TRUE},
@@ -1808,6 +1817,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, ':');
@@ -3641,6 +3659,15 @@
         res = CURLE_OK;
 
         /* new in curl ?? */
+        if (config->engine_path) {
+          curl_easy_setopt(curl, CURLOPT_SSLENGINE_PATH, config->engine_path);
+        }
+        if (config->engine_id) {
+          curl_easy_setopt(curl, CURLOPT_SSLENGINE_ID, config->engine_id);
+        }
+        if (config->engine_pkcs11) {
+          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);
