Loading apps/pkcs12.c +11 −16 Original line number Original line Diff line number Diff line Loading @@ -96,7 +96,7 @@ int MAIN(int argc, char **argv) ENGINE *e = NULL; ENGINE *e = NULL; char *infile=NULL, *outfile=NULL, *keyname = NULL; char *infile=NULL, *outfile=NULL, *keyname = NULL; char *certfile=NULL; char *certfile=NULL; BIO *in=NULL, *out = NULL, *inkey = NULL, *certsin = NULL; BIO *in=NULL, *out = NULL; char **args; char **args; char *name = NULL; char *name = NULL; char *csp_name = NULL; char *csp_name = NULL; Loading Loading @@ -346,6 +346,7 @@ int MAIN(int argc, char **argv) goto end; goto end; } } #if 0 if (certfile) { if (certfile) { if(!(certsin = BIO_new_file(certfile, "r"))) { if(!(certsin = BIO_new_file(certfile, "r"))) { BIO_printf(bio_err, "Can't open certificate file %s\n", certfile); BIO_printf(bio_err, "Can't open certificate file %s\n", certfile); Loading @@ -361,6 +362,7 @@ int MAIN(int argc, char **argv) goto end; goto end; } } } } #endif #ifdef CRYPTO_MDEBUG #ifdef CRYPTO_MDEBUG CRYPTO_pop_info(); CRYPTO_pop_info(); Loading Loading @@ -414,12 +416,9 @@ int MAIN(int argc, char **argv) CRYPTO_push_info("process -export_cert"); CRYPTO_push_info("process -export_cert"); CRYPTO_push_info("reading private key"); CRYPTO_push_info("reading private key"); #endif #endif key = PEM_read_bio_PrivateKey(inkey ? inkey : in, NULL, NULL, passin); key = load_key(bio_err, keyname ? keyname : infile, FORMAT_PEM, if (!inkey) (void) BIO_reset(in); passin, e, "private key"); else BIO_free(inkey); if (!key) { if (!key) { BIO_printf (bio_err, "Error loading private key\n"); ERR_print_errors(bio_err); goto export_end; goto export_end; } } Loading @@ -428,12 +427,9 @@ int MAIN(int argc, char **argv) CRYPTO_push_info("reading certs from input"); CRYPTO_push_info("reading certs from input"); #endif #endif certs = sk_X509_new_null(); /* Load in all certs in input file */ /* Load in all certs in input file */ if(!cert_load(in, certs)) { if(!(certs = load_certs(bio_err, infile, FORMAT_PEM, NULL, e, BIO_printf(bio_err, "Error loading certificates from input\n"); "certificates"))) { ERR_print_errors(bio_err); goto export_end; goto export_end; } } Loading Loading @@ -463,13 +459,11 @@ int MAIN(int argc, char **argv) bags = sk_PKCS12_SAFEBAG_new_null (); bags = sk_PKCS12_SAFEBAG_new_null (); /* Add any more certificates asked for */ /* Add any more certificates asked for */ if (certsin) { if (certfile) { if(!cert_load(certsin, certs)) { if(!(certs = load_certs(bio_err, certfile, FORMAT_PEM, NULL, e, BIO_printf(bio_err, "Error loading certificates from certfile\n"); "certificates from certfile"))) { ERR_print_errors(bio_err); goto export_end; goto export_end; } } BIO_free(certsin); } } #ifdef CRYPTO_MDEBUG #ifdef CRYPTO_MDEBUG Loading Loading @@ -686,6 +680,7 @@ int MAIN(int argc, char **argv) if (canames) sk_free(canames); if (canames) sk_free(canames); if(passin) OPENSSL_free(passin); if(passin) OPENSSL_free(passin); if(passout) OPENSSL_free(passout); if(passout) OPENSSL_free(passout); apps_shutdown(); EXIT(ret); EXIT(ret); } } Loading Loading
apps/pkcs12.c +11 −16 Original line number Original line Diff line number Diff line Loading @@ -96,7 +96,7 @@ int MAIN(int argc, char **argv) ENGINE *e = NULL; ENGINE *e = NULL; char *infile=NULL, *outfile=NULL, *keyname = NULL; char *infile=NULL, *outfile=NULL, *keyname = NULL; char *certfile=NULL; char *certfile=NULL; BIO *in=NULL, *out = NULL, *inkey = NULL, *certsin = NULL; BIO *in=NULL, *out = NULL; char **args; char **args; char *name = NULL; char *name = NULL; char *csp_name = NULL; char *csp_name = NULL; Loading Loading @@ -346,6 +346,7 @@ int MAIN(int argc, char **argv) goto end; goto end; } } #if 0 if (certfile) { if (certfile) { if(!(certsin = BIO_new_file(certfile, "r"))) { if(!(certsin = BIO_new_file(certfile, "r"))) { BIO_printf(bio_err, "Can't open certificate file %s\n", certfile); BIO_printf(bio_err, "Can't open certificate file %s\n", certfile); Loading @@ -361,6 +362,7 @@ int MAIN(int argc, char **argv) goto end; goto end; } } } } #endif #ifdef CRYPTO_MDEBUG #ifdef CRYPTO_MDEBUG CRYPTO_pop_info(); CRYPTO_pop_info(); Loading Loading @@ -414,12 +416,9 @@ int MAIN(int argc, char **argv) CRYPTO_push_info("process -export_cert"); CRYPTO_push_info("process -export_cert"); CRYPTO_push_info("reading private key"); CRYPTO_push_info("reading private key"); #endif #endif key = PEM_read_bio_PrivateKey(inkey ? inkey : in, NULL, NULL, passin); key = load_key(bio_err, keyname ? keyname : infile, FORMAT_PEM, if (!inkey) (void) BIO_reset(in); passin, e, "private key"); else BIO_free(inkey); if (!key) { if (!key) { BIO_printf (bio_err, "Error loading private key\n"); ERR_print_errors(bio_err); goto export_end; goto export_end; } } Loading @@ -428,12 +427,9 @@ int MAIN(int argc, char **argv) CRYPTO_push_info("reading certs from input"); CRYPTO_push_info("reading certs from input"); #endif #endif certs = sk_X509_new_null(); /* Load in all certs in input file */ /* Load in all certs in input file */ if(!cert_load(in, certs)) { if(!(certs = load_certs(bio_err, infile, FORMAT_PEM, NULL, e, BIO_printf(bio_err, "Error loading certificates from input\n"); "certificates"))) { ERR_print_errors(bio_err); goto export_end; goto export_end; } } Loading Loading @@ -463,13 +459,11 @@ int MAIN(int argc, char **argv) bags = sk_PKCS12_SAFEBAG_new_null (); bags = sk_PKCS12_SAFEBAG_new_null (); /* Add any more certificates asked for */ /* Add any more certificates asked for */ if (certsin) { if (certfile) { if(!cert_load(certsin, certs)) { if(!(certs = load_certs(bio_err, certfile, FORMAT_PEM, NULL, e, BIO_printf(bio_err, "Error loading certificates from certfile\n"); "certificates from certfile"))) { ERR_print_errors(bio_err); goto export_end; goto export_end; } } BIO_free(certsin); } } #ifdef CRYPTO_MDEBUG #ifdef CRYPTO_MDEBUG Loading Loading @@ -686,6 +680,7 @@ int MAIN(int argc, char **argv) if (canames) sk_free(canames); if (canames) sk_free(canames); if(passin) OPENSSL_free(passin); if(passin) OPENSSL_free(passin); if(passout) OPENSSL_free(passout); if(passout) OPENSSL_free(passout); apps_shutdown(); EXIT(ret); EXIT(ret); } } Loading