makedepend complains when a header file is included more than once in
[openssl.git] / apps / pkcs8.c
index c0becce9033776af57798a59529eb74cb8ba23ea..f86474dd2516868c9e423e28bfa3130e920fa642 100644 (file)
@@ -63,7 +63,6 @@
 #include <openssl/evp.h>
 #include <openssl/pkcs12.h>
 
-#include "apps.h"
 #define PROG pkcs8_main
 
 int MAIN(int, char **);
@@ -83,13 +82,16 @@ int MAIN(int argc, char **argv)
        int nocrypt = 0;
        X509_SIG *p8;
        PKCS8_PRIV_KEY_INFO *p8inf;
-       EVP_PKEY *pkey;
+       EVP_PKEY *pkey=NULL;
        char pass[50], *passin = NULL, *passout = NULL, *p8pass = NULL;
        int badarg = 0;
        char *engine=NULL;
 
        if (bio_err == NULL) bio_err = BIO_new_fp (stderr, BIO_NOCLOSE);
 
+       if (!load_config(bio_err, NULL))
+               goto end;
+
        informat=FORMAT_PEM;
        outformat=FORMAT_PEM;
 
@@ -219,7 +221,8 @@ int MAIN(int argc, char **argv)
        if (topk8)
                {
                BIO_free(in); /* Not needed in this section */
-               pkey = load_key(bio_err, infile, informat, passin, e, "key");
+               pkey = load_key(bio_err, infile, informat, 1,
+                       passin, e, "key");
                if (!pkey) {
                        return (1);
                }
@@ -347,6 +350,7 @@ int MAIN(int argc, char **argv)
                        return (1);
        }
 
+       end:
        EVP_PKEY_free(pkey);
        BIO_free_all(out);
        BIO_free(in);