]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Check password length only when verify is enabled.
authorDaniel Fiala <daniel@openssl.org>
Wed, 16 Mar 2022 06:42:55 +0000 (07:42 +0100)
committerTomas Mraz <tomas@openssl.org>
Thu, 17 Mar 2022 13:41:07 +0000 (14:41 +0100)
Fixes #16231.

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17899)

apps/apps.c

index 1a92271595f11a8385c36e921eace76a2fb2ea5f..db5b48e4cf2f27fd66215743723badff14089eba 100644 (file)
@@ -307,6 +307,8 @@ int password_callback(char *buf, int bufsiz, int verify, PW_CB_DATA *cb_tmp)
         if (cb_data != NULL && cb_data->password != NULL
                 && *(const char*)cb_data->password != '\0')
             pw_min_len = 1;
+        else if (!verify)
+            pw_min_len = 0;
         prompt = UI_construct_prompt(ui, "pass phrase", prompt_info);
         if (!prompt) {
             BIO_printf(bio_err, "Out of memory\n");