[openssl-dev] [PATCH] Fix broken argument parsing for genrsa

Adam Eijdenberg eijdenberg at google.com
Tue Jul 28 14:51:32 UTC 2015


HI openssl-dev,

This is my first patch, so hope I'm following the right process.  The
argument parsing for "openssl genrsa" is missing a "break;" statement and
as a consequence control the users gets a set of spurious warnings about a
missing engine that they didn't actually intentionally specify.  A quick
grep found 2 other similar issues.

I created a pull request on Friday (
https://github.com/openssl/openssl/pull/339) but since I didn't hear
anything there I am attaching the small (3 line) patch to this message.

Cheers, Adam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mta.openssl.org/pipermail/openssl-dev/attachments/20150728/dc35ffdf/attachment.html>
-------------- next part --------------
From 36f4de1c10acb4b16fd9dda01d3389f28b15da46 Mon Sep 17 00:00:00 2001
From: Adam Eijdenberg <adam.eijdenberg at gmail.com>
Date: Fri, 24 Jul 2015 19:27:39 -0700
Subject: [PATCH] Fix missing break for -out argument parsing that causes
 genrsa to attempt to load engine with name of out.key.

e.g. without fix, operation succeeds but with warnings:

$ apps/openssl genrsa -out out.key
invalid engine "out.key"
140735214080848:error:25066067:DSO support routines:DLFCN_LOAD:could not load the shared library:dso_dlfcn.c:172:filename(/usr/local/ssl/lib/engines/libout.key.dylib): dlopen(/usr/local/ssl/lib/engines/libout.key.dylib, 2): image not found
140735214080848:error:25070067:DSO support routines:DSO_load:could not load the shared library:dso_lib.c:228:
140735214080848:error:260B6084:engine routines:DYNAMIC_LOAD:dso not found:eng_dyn.c:458:
140735214080848:error:2606A074:engine routines:ENGINE_by_id:no such engine:eng_list.c:379:id=out.key
140735214080848:error:25066067:DSO support routines:DLFCN_LOAD:could not load the shared library:dso_dlfcn.c:172:filename(libout.key.dylib): dlopen(libout.key.dylib, 2): image not found
140735214080848:error:25070067:DSO support routines:DSO_load:could not load the shared library:dso_lib.c:228:
140735214080848:error:260B6084:engine routines:DYNAMIC_LOAD:dso not found:eng_dyn.c:458:
Generating RSA private key, 2048 bit long modulus
.............+++
.............................................................................................................+++
e is 65537 (0x010001)

A quick grep for "=" on a line before "case" found two other similar issues addressed in same commit.
---
 apps/genrsa.c  | 1 +
 apps/pkeyutl.c | 1 +
 apps/req.c     | 1 -
 3 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/apps/genrsa.c b/apps/genrsa.c
index bb8437f..1fea351 100644
--- a/apps/genrsa.c
+++ b/apps/genrsa.c
@@ -141,6 +141,7 @@ int genrsa_main(int argc, char **argv)
             break;
         case OPT_OUT:
             outfile = opt_arg();
+            break;
         case OPT_ENGINE:
             e = setup_engine(opt_arg(), 0);
             break;
diff --git a/apps/pkeyutl.c b/apps/pkeyutl.c
index 4c267c1..741dd64 100644
--- a/apps/pkeyutl.c
+++ b/apps/pkeyutl.c
@@ -200,6 +200,7 @@ int pkeyutl_main(int argc, char **argv)
             break;
         case OPT_REV:
             rev = 1;
+            break;
         case OPT_ENCRYPT:
             pkey_op = EVP_PKEY_OP_ENCRYPT;
             break;
diff --git a/apps/req.c b/apps/req.c
index b3220ba..a16febd 100644
--- a/apps/req.c
+++ b/apps/req.c
@@ -344,7 +344,6 @@ int req_main(int argc, char **argv)
         case OPT_NO_ASN1_KLUDGE:
             kludge = 0;
             break;
-            multirdn = 1;
         case OPT_DAYS:
             days = atoi(opt_arg());
             break;
-- 
2.5.0.rc2.392.g76e840b



More information about the openssl-dev mailing list