Imported Upstream version 2.1.8
[platform/upstream/gpg2.git] / agent / genkey.c
index df17880..13858ca 100644 (file)
@@ -189,6 +189,9 @@ check_passphrase_constraints (ctrl_t ctrl, const char *pw,
   char *msg2 = NULL;
   char *msg3 = NULL;
 
+  if (ctrl && ctrl->pinentry_mode == PINENTRY_MODE_LOOPBACK)
+    return 0;
+
   if (!pw)
     pw = "";
 
@@ -371,13 +374,13 @@ agent_ask_new_passphrase (ctrl_t ctrl, const char *prompt,
        return err;
     }
 
-  pi = gcry_calloc_secure (2, sizeof (*pi) + 100);
-  pi2 = pi + (sizeof *pi + 100);
-  pi->max_length = 100;
+  pi = gcry_calloc_secure (2, sizeof (*pi) + MAX_PASSPHRASE_LEN + 1);
+  pi2 = pi + (sizeof *pi + MAX_PASSPHRASE_LEN + 1);
+  pi->max_length = MAX_PASSPHRASE_LEN + 1;
   pi->max_tries = 3;
   pi->with_qualitybar = 1;
   pi->with_repeat = 1;
-  pi2->max_length = 100;
+  pi2->max_length = MAX_PASSPHRASE_LEN + 1;
   pi2->max_tries = 3;
   pi2->check_cb = reenter_compare_cb;
   pi2->check_cb_arg = pi->pin;