]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
apps/pkcs12: Allow continuing on absent mac
authorTomas Mraz <tomas@openssl.org>
Fri, 5 Mar 2021 17:19:12 +0000 (18:19 +0100)
committerPauli <ppzgs1@gmail.com>
Tue, 9 Mar 2021 01:12:07 +0000 (11:12 +1000)
Just print a warning in that case.

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

apps/pkcs12.c

index c729ab5d67ae2591b33308d7a960db6662a7d07a..bd87fd4920f432a18d3442e610cda7f4247fdc18 100644 (file)
@@ -756,6 +756,14 @@ int pkcs12_main(int argc, char **argv)
              */
             unsigned char *utmp;
             int utmplen;
+            unsigned long err = ERR_peek_error();
+
+            if (ERR_GET_LIB(err) == ERR_LIB_PKCS12
+                && ERR_GET_REASON(err) == PKCS12_R_MAC_ABSENT) {
+                BIO_printf(bio_err, "Warning: MAC is absent!\n");
+                goto dump;
+            }
+
             utmp = OPENSSL_asc2uni(mpass, -1, NULL, &utmplen);
             if (utmp == NULL)
                 goto end;
@@ -773,6 +781,7 @@ int pkcs12_main(int argc, char **argv)
         }
     }
 
+ dump:
     assert(private);
     if (!dump_certs_keys_p12(out, p12, cpass, -1, options, passout, enc)) {
         BIO_printf(bio_err, "Error outputting keys and certificates\n");