diff -rup old/include/curl/curl.h new/include/curl/curl.h
--- old/include/curl/curl.h	2011-11-03 13:42:55.843466526 -0400
+++ new/include/curl/curl.h	2011-11-03 16:14:56.938264054 -0400
@@ -667,6 +667,13 @@ typedef enum {
   CURLUSESSL_LAST     /* not an option, never use */
 } curl_usessl;
 
+/* parameter for CURLOPT_SSLENGINE_WITH_OPT option */
+struct curl_sslengineinfo {
+  char* enginename; // engine name
+  char** preopt; // pre-init options
+  char** postopt; // post-init options
+};
+
 #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
                           the obsolete stuff removed! */
 
@@ -1486,6 +1493,9 @@ typedef enum {
   /* allow GSSAPI credential delegation */
   CINIT(GSSAPI_DELEGATION, LONG, 210),
 
+  /* crypto engine for the SSL-sub system with options passed */
+  CINIT(SSLENGINE_WITH_OPT, OBJECTPOINT, 218),
+
   CURLOPT_LASTENTRY /* the last unused */
 } CURLoption;
 
diff -rup old/lib/axtls.h new/lib/axtls.h
--- old/lib/axtls.h	2011-11-03 13:43:44.515739727 -0400
+++ new/lib/axtls.h	2011-11-03 10:34:29.748313851 -0400
@@ -52,6 +52,7 @@ int Curl_axtls_check_cxn(struct connectd
 #define curlssl_close Curl_axtls_close
 #define curlssl_shutdown(x,y) Curl_axtls_shutdown(x,y)
 #define curlssl_set_engine(x,y) (x=x, y=y, CURLE_NOT_BUILT_IN)
+#define curlssl_set_engine_with_opt(x,y) (x=x, y=y, CURLE_NOT_BUILT_IN)
 #define curlssl_set_engine_default(x) (x=x, CURLE_NOT_BUILT_IN)
 #define curlssl_engines_list(x) (x=x, (struct curl_slist *)NULL)
 #define curlssl_version Curl_axtls_version
diff -rup old/lib/cyassl.h new/lib/cyassl.h
--- old/lib/cyassl.h	2011-11-03 13:43:49.794338255 -0400
+++ new/lib/cyassl.h	2011-11-03 10:34:41.967271401 -0400
@@ -54,6 +54,7 @@ CURLcode Curl_cyassl_connect_nonblocking
 #define curlssl_close Curl_cyassl_close
 #define curlssl_shutdown(x,y) Curl_cyassl_shutdown(x,y)
 #define curlssl_set_engine(x,y) (x=x, y=y, CURLE_NOT_BUILT_IN)
+#define curlssl_set_engine_with_opt(x,y) (x=x, y=y, CURLE_NOT_BUILT_IN)
 #define curlssl_set_engine_default(x) (x=x, CURLE_NOT_BUILT_IN)
 #define curlssl_engines_list(x) (x=x, (struct curl_slist *)NULL)
 #define curlssl_version Curl_cyassl_version
diff -rup old/lib/gtls.h new/lib/gtls.h
--- old/lib/gtls.h	2011-11-03 13:43:53.126435771 -0400
+++ new/lib/gtls.h	2011-11-03 10:34:53.040311186 -0400
@@ -57,6 +57,7 @@ int Curl_gtls_seed(struct SessionHandle 
 #define curlssl_close Curl_gtls_close
 #define curlssl_shutdown(x,y) Curl_gtls_shutdown(x,y)
 #define curlssl_set_engine(x,y) (x=x, y=y, CURLE_NOT_BUILT_IN)
+#define curlssl_set_engine_with_opt(x,y) (x=x, y=y, CURLE_NOT_BUILT_IN)
 #define curlssl_set_engine_default(x) (x=x, CURLE_NOT_BUILT_IN)
 #define curlssl_engines_list(x) (x=x, (struct curl_slist *)NULL)
 #define curlssl_version Curl_gtls_version
diff -rup old/lib/nssg.h new/lib/nssg.h
--- old/lib/nssg.h	2011-11-03 13:43:56.658287660 -0400
+++ new/lib/nssg.h	2011-11-03 10:35:08.399298346 -0400
@@ -63,6 +63,7 @@ CURLcode Curl_nss_force_init(struct Sess
 /* NSS has no shutdown function provided and thus always fail */
 #define curlssl_shutdown(x,y) (x=x, y=y, 1)
 #define curlssl_set_engine(x,y) (x=x, y=y, CURLE_NOT_BUILT_IN)
+#define curlssl_set_engine_with_opt(x,y) (x=x, y=y, CURLE_NOT_BUILT_IN)
 #define curlssl_set_engine_default(x) (x=x, CURLE_NOT_BUILT_IN)
 #define curlssl_engines_list(x) (x=x, (struct curl_slist *)NULL)
 #define curlssl_version Curl_nss_version
diff -rup old/lib/polarssl.h new/lib/polarssl.h
--- old/lib/polarssl.h	2011-11-03 13:44:15.282400869 -0400
+++ new/lib/polarssl.h	2011-11-03 10:35:20.543329545 -0400
@@ -47,6 +47,7 @@ int Curl_polarssl_shutdown(struct connec
 #define curlssl_close Curl_polarssl_close
 #define curlssl_shutdown(x,y) 0
 #define curlssl_set_engine(x,y) (x=x, y=y, CURLE_NOT_BUILT_IN)
+#define curlssl_set_engine_with_opt(x,y) (x=x, y=y, CURLE_NOT_BUILT_IN)
 #define curlssl_set_engine_default(x) (x=x, CURLE_NOT_BUILT_IN)
 #define curlssl_engines_list(x) (x=x, (struct curl_slist *)NULL)
 #define curlssl_version Curl_polarssl_version
diff -rup old/lib/qssl.h new/lib/qssl.h
--- old/lib/qssl.h	2011-11-03 13:44:20.034276154 -0400
+++ new/lib/qssl.h	2011-11-03 10:35:33.167343445 -0400
@@ -51,6 +51,7 @@ int Curl_qsossl_check_cxn(struct connect
 #define curlssl_close Curl_qsossl_close
 #define curlssl_shutdown(x,y) Curl_qsossl_shutdown(x,y)
 #define curlssl_set_engine(x,y) CURLE_NOT_BUILT_IN
+#define curlssl_set_engine_with_opt(x,y) CURLE_NOT_BUILT_IN
 #define curlssl_set_engine_default(x) CURLE_NOT_BUILT_IN
 #define curlssl_engines_list(x) NULL
 #define curlssl_version Curl_qsossl_version
diff -rup old/lib/sslgen.c new/lib/sslgen.c
--- old/lib/sslgen.c	2011-11-03 13:49:59.823341370 -0400
+++ new/lib/sslgen.c	2011-11-03 15:46:19.407417061 -0400
@@ -403,6 +403,13 @@ CURLcode Curl_ssl_set_engine(struct Sess
   return curlssl_set_engine(data, engine);
 }
 
+/* Selects an SSL crypto engine
+ */
+CURLcode Curl_ssl_set_engine_with_opt(struct SessionHandle *data, const struct curl_sslengineinfo* ei)
+{
+  return curlssl_set_engine_with_opt(data, ei);
+}
+
 /* Selects the default SSL crypto engine
  */
 CURLcode Curl_ssl_set_engine_default(struct SessionHandle *data)
diff -rup old/lib/sslgen.h new/lib/sslgen.h
--- old/lib/sslgen.h	2011-11-03 13:52:00.146376299 -0400
+++ new/lib/sslgen.h	2011-11-03 15:46:19.408351501 -0400
@@ -42,6 +42,7 @@ void Curl_ssl_close_all(struct SessionHa
 void Curl_ssl_close(struct connectdata *conn, int sockindex);
 CURLcode Curl_ssl_shutdown(struct connectdata *conn, int sockindex);
 CURLcode Curl_ssl_set_engine(struct SessionHandle *data, const char *engine);
+CURLcode Curl_ssl_set_engine_with_opt(struct SessionHandle *data, const struct curl_sslengineinfo* ei);
 /* Sets engine as default for all SSL operations */
 CURLcode Curl_ssl_set_engine_default(struct SessionHandle *data);
 struct curl_slist *Curl_ssl_engines_list(struct SessionHandle *data);
diff -rup old/lib/ssluse.c new/lib/ssluse.c
--- old/lib/ssluse.c	2011-11-03 13:44:27.233317535 -0400
+++ new/lib/ssluse.c	2011-11-03 15:46:19.408351501 -0400
@@ -782,6 +782,83 @@ CURLcode Curl_ossl_set_engine(struct Ses
 #endif
 }
 
+/*struct engineinfo {
+  char* engine; // engine name
+  char** preopt; // pre-init options
+  char** postopt; // post-init options
+}*/
+
+/* Selects an OpenSSL crypto engine and initilizes it with options passed
+ *  */
+CURLcode Curl_ossl_set_engine_with_opt(struct SessionHandle *data, const struct curl_sslengineinfo *ei)
+{
+#if defined(USE_SSLEAY) && defined(HAVE_OPENSSL_ENGINE_H)
+  ENGINE *e;
+
+#if OPENSSL_VERSION_NUMBER >= 0x00909000L
+  e = ENGINE_by_id(ei->enginename);
+#else
+  /* avoid memory leak */
+  for(e = ENGINE_get_first(); e; e = ENGINE_get_next(e)) {
+    const char *e_id = ENGINE_get_id(e);
+    if(!strcmp(ei->enginename, e_id))
+      break;
+  }
+#endif
+
+  if(!e) {
+    failf(data, "SSL Engine '%s' not found", ei->enginename);
+    return CURLE_SSL_ENGINE_NOTFOUND;
+  }
+
+  if(data->state.engine) {
+    ENGINE_finish(data->state.engine);
+    ENGINE_free(data->state.engine);
+    data->state.engine = NULL;
+  }
+  if (ei->preopt) {
+    int x;
+    // cycle through array of option name/value pairs. value can be null. a null name signifies the end of the array.
+    for (x=0; ei->preopt[x]; x+=2) {
+      if(!ENGINE_ctrl_cmd_string(e, ei->preopt[x], ei->preopt[x+1], 0)) {
+        char buf[256];
+
+        ENGINE_free(e);
+        failf(data, "Failed to initialise pre-options for SSL Engine '%s':\n%s", ei->enginename, SSL_strerror(ERR_get_error(), buf, sizeof(buf)));
+        return CURLE_SSL_ENGINE_INITFAILED;
+      }
+    }
+  }
+  if(!ENGINE_init(e)) {
+    char buf[256];
+
+    ENGINE_free(e);
+    failf(data, "Failed to initialise SSL Engine '%s':\n%s",
+          ei->enginename, SSL_strerror(ERR_get_error(), buf, sizeof(buf)));
+    return CURLE_SSL_ENGINE_INITFAILED;
+  }
+  if (ei->postopt) {
+    int x;
+    // cycle through array of option name/value pairs. value can be null. a null name signifies the end of the array.
+    for (x=0; ei->postopt[x]; x+=2) {
+      if(!ENGINE_ctrl_cmd_string(e, ei->postopt[x], ei->postopt[x+1], 0)) {
+        char buf[256];
+
+        ENGINE_free(e);
+        failf(data, "Failed to initialise post-options for SSL Engine '%s':\n%s", ei->enginename, SSL_strerror(ERR_get_error(), buf, sizeof(buf)));
+        return CURLE_SSL_ENGINE_INITFAILED;
+      }
+    }
+  }
+  data->state.engine = e;
+  return CURLE_OK;
+#else
+  (void)ei;
+  failf(data, "SSL Engine not supported");
+  return CURLE_SSL_ENGINE_NOTFOUND;
+#endif
+}
+
 /* Sets engine as default for all SSL operations
  */
 CURLcode Curl_ossl_set_engine_default(struct SessionHandle *data)
diff -rup old/lib/ssluse.h new/lib/ssluse.h
--- old/lib/ssluse.h	2011-11-03 13:44:26.033319465 -0400
+++ new/lib/ssluse.h	2011-11-03 15:46:19.408351501 -0400
@@ -46,6 +46,9 @@ int Curl_ossl_close_all(struct SessionHa
 /* Sets an OpenSSL engine */
 CURLcode Curl_ossl_set_engine(struct SessionHandle *data, const char *engine);
 
+/* Sets an OpenSSL engine with options passed */
+CURLcode Curl_ossl_set_engine_with_opt(struct SessionHandle *data, const struct curl_sslengineinfo* ei);
+
 /* function provided for the generic SSL-layer, called when a session id
    should be freed */
 void Curl_ossl_session_free(void *ptr);
@@ -77,6 +80,7 @@ bool Curl_ossl_data_pending(const struct
 #define curlssl_close Curl_ossl_close
 #define curlssl_shutdown(x,y) Curl_ossl_shutdown(x,y)
 #define curlssl_set_engine(x,y) Curl_ossl_set_engine(x,y)
+#define curlssl_set_engine_with_opt(x,y) Curl_ossl_set_engine_with_opt(x,y)
 #define curlssl_set_engine_default(x) Curl_ossl_set_engine_default(x)
 #define curlssl_engines_list(x) Curl_ossl_engines_list(x)
 #define curlssl_version Curl_ossl_version
diff -rup old/lib/url.c new/lib/url.c
--- old/lib/url.c	2011-11-03 13:44:31.538264911 -0400
+++ new/lib/url.c	2011-11-03 10:43:01.994488602 -0400
@@ -1925,6 +1925,12 @@ CURLcode Curl_setopt(struct SessionHandl
     if(argptr && argptr[0])
       result = Curl_ssl_set_engine(data, argptr);
     break;
+  case CURLOPT_SSLENGINE_WITH_OPT:
+    /*
+     * struct curl_sslengineinfo that holds the SSL crypto engine name and options.
+     */
+    result = Curl_ssl_set_engine_with_opt(data, va_arg(param, struct curl_sslengineinfo *));
+    break;
 
   case CURLOPT_SSLENGINE_DEFAULT:
     /*
