Tidied up, added include to stdlib, removed "goto bad" usage
This commit is contained in:
parent
8a531c22b0
commit
2d7153e8f9
18
apps/pkcs8.c
18
apps/pkcs8.c
@ -56,6 +56,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "apps.h"
|
#include "apps.h"
|
||||||
#include <openssl/pem.h>
|
#include <openssl/pem.h>
|
||||||
@ -175,9 +176,12 @@ int MAIN(int argc, char **argv)
|
|||||||
iter = 1;
|
iter = 1;
|
||||||
else if (!strcmp (*args, "-iter"))
|
else if (!strcmp (*args, "-iter"))
|
||||||
{
|
{
|
||||||
if (!args[1]) goto bad;
|
if (args[1])
|
||||||
|
{
|
||||||
iter = atoi(*(++args));
|
iter = atoi(*(++args));
|
||||||
if (iter <= 0) goto bad;
|
if (iter <= 0) badarg = 1;
|
||||||
|
}
|
||||||
|
else badarg = 1;
|
||||||
}
|
}
|
||||||
else if (!strcmp (*args, "-nocrypt"))
|
else if (!strcmp (*args, "-nocrypt"))
|
||||||
nocrypt = 1;
|
nocrypt = 1;
|
||||||
@ -189,19 +193,22 @@ int MAIN(int argc, char **argv)
|
|||||||
p8_broken = PKCS8_EMBEDDED_PARAM;
|
p8_broken = PKCS8_EMBEDDED_PARAM;
|
||||||
else if (!strcmp(*args,"-passin"))
|
else if (!strcmp(*args,"-passin"))
|
||||||
{
|
{
|
||||||
if (!args[1]) goto bad;
|
if (args[1])
|
||||||
passargin= *(++args);
|
passargin= *(++args);
|
||||||
|
else badarg = 1;
|
||||||
}
|
}
|
||||||
else if (!strcmp(*args,"-passout"))
|
else if (!strcmp(*args,"-passout"))
|
||||||
{
|
{
|
||||||
if (!args[1]) goto bad;
|
if (args[1])
|
||||||
passargout= *(++args);
|
passargout= *(++args);
|
||||||
|
else badarg = 1;
|
||||||
}
|
}
|
||||||
#ifndef OPENSSL_NO_ENGINE
|
#ifndef OPENSSL_NO_ENGINE
|
||||||
else if (strcmp(*args,"-engine") == 0)
|
else if (strcmp(*args,"-engine") == 0)
|
||||||
{
|
{
|
||||||
if (!args[1]) goto bad;
|
if (args[1])
|
||||||
engine= *(++args);
|
engine= *(++args);
|
||||||
|
else badarg = 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else if (!strcmp (*args, "-in"))
|
else if (!strcmp (*args, "-in"))
|
||||||
@ -228,7 +235,6 @@ int MAIN(int argc, char **argv)
|
|||||||
|
|
||||||
if (badarg)
|
if (badarg)
|
||||||
{
|
{
|
||||||
bad:
|
|
||||||
BIO_printf(bio_err, "Usage pkcs8 [options]\n");
|
BIO_printf(bio_err, "Usage pkcs8 [options]\n");
|
||||||
BIO_printf(bio_err, "where options are\n");
|
BIO_printf(bio_err, "where options are\n");
|
||||||
BIO_printf(bio_err, "-in file input file\n");
|
BIO_printf(bio_err, "-in file input file\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user