initialise buf if wrong_info not used
[openssl.git] / engines / e_chil.c
index 04f2a535de6bcee19095eef75d7f12dda0ceabf1..30693353d15ac6639c907e7ffc554d171e720c23 100644 (file)
@@ -1,6 +1,6 @@
 /* crypto/engine/e_chil.c -*- mode: C; c-file-style: "eay" -*- */
 /* Written by Richard Levitte (richard@levitte.org), Geoff Thorpe
 /* crypto/engine/e_chil.c -*- mode: C; c-file-style: "eay" -*- */
 /* Written by Richard Levitte (richard@levitte.org), Geoff Thorpe
- * (geoff@geoffthorpe.net) and Dr Stephen N Henson (shenson@bigfoot.com)
+ * (geoff@geoffthorpe.net) and Dr Stephen N Henson (steve@openssl.org)
  * for the OpenSSL project 2000.
  */
 /* ====================================================================
  * for the OpenSSL project 2000.
  */
 /* ====================================================================
@@ -164,11 +164,11 @@ static const ENGINE_CMD_DEFN hwcrhk_cmd_defns[] = {
                ENGINE_CMD_FLAG_STRING},
        {HWCRHK_CMD_FORK_CHECK,
                "FORK_CHECK",
                ENGINE_CMD_FLAG_STRING},
        {HWCRHK_CMD_FORK_CHECK,
                "FORK_CHECK",
-               "Turns fork() checking on or off (boolean)",
+               "Turns fork() checking on (non-zero) or off (zero)",
                ENGINE_CMD_FLAG_NUMERIC},
        {HWCRHK_CMD_THREAD_LOCKING,
                "THREAD_LOCKING",
                ENGINE_CMD_FLAG_NUMERIC},
        {HWCRHK_CMD_THREAD_LOCKING,
                "THREAD_LOCKING",
-               "Turns thread-safe locking on or off (boolean)",
+               "Turns thread-safe locking on (zero) or off (non-zero)",
                ENGINE_CMD_FLAG_NUMERIC},
        {HWCRHK_CMD_SET_USER_INTERFACE,
                "SET_USER_INTERFACE",
                ENGINE_CMD_FLAG_NUMERIC},
        {HWCRHK_CMD_SET_USER_INTERFACE,
                "SET_USER_INTERFACE",
@@ -588,12 +588,6 @@ static int hwcrhk_init(ENGINE *e)
                        hwcrhk_globals.mutex_release = hwcrhk_mutex_unlock;
                        hwcrhk_globals.mutex_destroy = hwcrhk_mutex_destroy;
                        }
                        hwcrhk_globals.mutex_release = hwcrhk_mutex_unlock;
                        hwcrhk_globals.mutex_destroy = hwcrhk_mutex_destroy;
                        }
-               else if (CRYPTO_get_locking_callback() != NULL)
-                       {
-                       HWCRHKerr(HWCRHK_F_HWCRHK_INIT,HWCRHK_R_LOCKING_MISSING);
-                       ERR_add_error_data(1,"You HAVE to add dynamic locking callbacks via CRYPTO_set_dynlock_{create,lock,destroy}_callback()");
-                       goto err;
-                       }
                }
 
        /* Try and get a context - if not, we may have a DSO but no
                }
 
        /* Try and get a context - if not, we may have a DSO but no
@@ -1207,6 +1201,11 @@ static int hwcrhk_get_pass(const char *prompt_info,
        pem_password_cb *callback = NULL;
        void *callback_data = NULL;
         UI_METHOD *ui_method = NULL;
        pem_password_cb *callback = NULL;
        void *callback_data = NULL;
         UI_METHOD *ui_method = NULL;
+       /* Despite what the documentation says prompt_info can be
+        * an empty string.
+        */
+       if (prompt_info && !*prompt_info)
+               prompt_info = NULL;
 
         if (cactx)
                 {
 
         if (cactx)
                 {
@@ -1308,10 +1307,14 @@ static int hwcrhk_insert_card(const char *prompt_info,
                {
                char answer;
                char buf[BUFSIZ];
                {
                char answer;
                char buf[BUFSIZ];
-
-               if (wrong_info)
+               /* Despite what the documentation says wrong_info can be
+                * an empty string.
+                */
+               if (wrong_info && *wrong_info)
                        BIO_snprintf(buf, sizeof(buf)-1,
                                "Current card: \"%s\"\n", wrong_info);
                        BIO_snprintf(buf, sizeof(buf)-1,
                                "Current card: \"%s\"\n", wrong_info);
+               else
+                       buf[0] = 0;
                ok = UI_dup_info_string(ui, buf);
                if (ok >= 0 && prompt_info)
                        {
                ok = UI_dup_info_string(ui, buf);
                if (ok >= 0 && prompt_info)
                        {