summaryrefslogtreecommitdiffstats
path: root/apps/pkcs8.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2014-06-17 23:35:53 +0100
committerMatt Caswell <matt@openssl.org>2014-06-17 23:35:53 +0100
commit2d7153e8f9bb27d0a0f8199116ec454b396b87a8 (patch)
treef68167c41974f6f38df8d3f13c1859a85a60f81e /apps/pkcs8.c
parent8a531c22b03dea40e09a95a01dff0639bd56ff2d (diff)
Tidied up, added include to stdlib, removed "goto bad" usage
Diffstat (limited to 'apps/pkcs8.c')
-rw-r--r--apps/pkcs8.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/apps/pkcs8.c b/apps/pkcs8.c
index a6a0852891..73873d2c9d 100644
--- a/apps/pkcs8.c
+++ b/apps/pkcs8.c
@@ -56,6 +56,7 @@
*
*/
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include "apps.h"
#include <openssl/pem.h>
@@ -173,12 +174,15 @@ int MAIN(int argc, char **argv)
topk8 = 1;
else if (!strcmp (*args, "-noiter"))
iter = 1;
- else if (!strcmp (*args, "-iter"))
- {
- if (!args[1]) goto bad;
- iter = atoi(*(++args));
- if (iter <= 0) goto bad;
- }
+ else if (!strcmp (*args, "-iter"))
+ {
+ if (args[1])
+ {
+ iter = atoi(*(++args));
+ if (iter <= 0) badarg = 1;
+ }
+ else badarg = 1;
+ }
else if (!strcmp (*args, "-nocrypt"))
nocrypt = 1;
else if (!strcmp (*args, "-nooct"))
@@ -189,19 +193,22 @@ int MAIN(int argc, char **argv)
p8_broken = PKCS8_EMBEDDED_PARAM;
else if (!strcmp(*args,"-passin"))
{
- if (!args[1]) goto bad;
- passargin= *(++args);
+ if (args[1])
+ passargin= *(++args);
+ else badarg = 1;
}
else if (!strcmp(*args,"-passout"))
{
- if (!args[1]) goto bad;
- passargout= *(++args);
+ if (args[1])
+ passargout= *(++args);
+ else badarg = 1;
}
#ifndef OPENSSL_NO_ENGINE
else if (strcmp(*args,"-engine") == 0)
{
- if (!args[1]) goto bad;
- engine= *(++args);
+ if (args[1])
+ engine= *(++args);
+ else badarg = 1;
}
#endif
else if (!strcmp (*args, "-in"))
@@ -228,7 +235,6 @@ int MAIN(int argc, char **argv)
if (badarg)
{
- bad:
BIO_printf(bio_err, "Usage pkcs8 [options]\n");
BIO_printf(bio_err, "where options are\n");
BIO_printf(bio_err, "-in file input file\n");