X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=apps%2Fpkcs12.c;h=6789169bdb48dc7d6c31ebad1c09abee42f66f9e;hb=1bc5dd3efc7495b72f2780b4ef8d502bd899c783;hp=963797155fc578fcd564506bacacdd9ad1aedd62;hpb=5ce42a7e68956b313bc98e85e843d561fb06b6e9;p=oweals%2Fopenssl.git diff --git a/apps/pkcs12.c b/apps/pkcs12.c index 963797155f..6789169bdb 100644 --- a/apps/pkcs12.c +++ b/apps/pkcs12.c @@ -197,7 +197,7 @@ int MAIN(int argc, char **argv) } else if (!strcmp (*args, "-caname")) { if (args[1]) { args++; - if (!canames) canames = sk_new(NULL); + if (!canames) canames = sk_new_null(); sk_push(canames, *args); } else badarg = 1; } else if (!strcmp (*args, "-in")) { @@ -350,8 +350,15 @@ int MAIN(int argc, char **argv) CRYPTO_push_info("write files"); #endif - if (!outfile) out = BIO_new_fp(stdout, BIO_NOCLOSE); - else out = BIO_new_file(outfile, "wb"); + if (!outfile) { + out = BIO_new_fp(stdout, BIO_NOCLOSE); +#ifdef VMS + { + BIO *tmpbio = BIO_new(BIO_f_linebuffer()); + out = BIO_push(tmpbio, out); + } +#endif + } else out = BIO_new_file(outfile, "wb"); if (!out) { BIO_printf(bio_err, "Error opening output file %s\n", outfile ? outfile : ""); @@ -404,7 +411,7 @@ int MAIN(int argc, char **argv) CRYPTO_push_info("reading certs from input"); #endif - certs = sk_X509_new(NULL); + certs = sk_X509_new_null(); /* Load in all certs in input file */ if(!cert_load(in, certs)) { @@ -436,7 +443,7 @@ int MAIN(int argc, char **argv) CRYPTO_push_info("reading certs from certfile"); #endif - bags = sk_PKCS12_SAFEBAG_new (NULL); + bags = sk_PKCS12_SAFEBAG_new_null (); /* Add any more certificates asked for */ if (certsin) { @@ -502,6 +509,8 @@ int MAIN(int argc, char **argv) } sk_X509_pop_free(certs, X509_free); certs = NULL; + /* ucert is part of certs so it is already freed */ + ucert = NULL; #ifdef CRYPTO_MDEBUG CRYPTO_pop_info(); @@ -525,7 +534,7 @@ int MAIN(int argc, char **argv) goto export_end; } - safes = sk_PKCS7_new (NULL); + safes = sk_PKCS7_new_null (); sk_PKCS7_push (safes, authsafe); #ifdef CRYPTO_MDEBUG @@ -541,7 +550,7 @@ int MAIN(int argc, char **argv) p8 = NULL; if (name) PKCS12_add_friendlyname (bag, name, -1); PKCS12_add_localkeyid (bag, keyid, keyidlen); - bags = sk_PKCS12_SAFEBAG_new(NULL); + bags = sk_PKCS12_SAFEBAG_new_null(); sk_PKCS12_SAFEBAG_push (bags, bag); #ifdef CRYPTO_MDEBUG @@ -655,7 +664,7 @@ int MAIN(int argc, char **argv) CRYPTO_remove_all_info(); #endif BIO_free(in); - BIO_free(out); + BIO_free_all(out); if (canames) sk_free(canames); if(passin) OPENSSL_free(passin); if(passout) OPENSSL_free(passout); @@ -878,14 +887,14 @@ int print_attribs (BIO *out, STACK_OF(X509_ATTRIBUTE) *attrlst, char *name) break; case V_ASN1_OCTET_STRING: - hex_prin(out, av->value.bit_string->data, - av->value.bit_string->length); + hex_prin(out, av->value.octet_string->data, + av->value.octet_string->length); BIO_printf(out, "\n"); break; case V_ASN1_BIT_STRING: - hex_prin(out, av->value.octet_string->data, - av->value.octet_string->length); + hex_prin(out, av->value.bit_string->data, + av->value.bit_string->length); BIO_printf(out, "\n"); break;