Allow to *just* print key and IV of unstreamable modes when no input files
authorEasySec <easy.sec@free.fr>
Wed, 9 Mar 2022 00:00:19 +0000 (01:00 +0100)
committerMatt Caswell <matt@openssl.org>
Thu, 10 Mar 2022 14:33:20 +0000 (14:33 +0000)
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17843)

apps/enc.c

index d50baa6d2f632813f412ec477af99396b7b20e55..eb06756c5c409e58237c782bda5c71a7b97fed79 100644 (file)
@@ -334,7 +334,7 @@ int enc_main(int argc, char **argv)
     buff = app_malloc(EVP_ENCODE_LENGTH(bsize), "evp buffer");
 
     if (infile == NULL) {
-        if (!streamable) {
+        if (!streamable && printkey != 2) {  /* if just print key and exit, it's ok */
             BIO_printf(bio_err, "Unstreamable cipher mode\n");
             goto end;
         }