X-Git-Url: https://git.openssl.org/?a=blobdiff_plain;f=apps%2Fasn1pars.c;h=3b29801b47daf1f35c6547a1a4dcc162cb071d78;hb=1b4d0e3c1ed556b890b93d8326978a6a90cfc0fe;hp=8881ad4e33789f77521610a1840bbf545f9d74be;hpb=d303b9d85e1888494785f87ebd9bd233e63564a9;p=openssl.git diff --git a/apps/asn1pars.c b/apps/asn1pars.c index 8881ad4e33..3b29801b47 100644 --- a/apps/asn1pars.c +++ b/apps/asn1pars.c @@ -81,8 +81,8 @@ OPTIONS asn1parse_options[] = { {"inform", OPT_INFORM, 'F', "input format - one of DER PEM"}, {"in", OPT_IN, '<', "input file"}, {"out", OPT_OUT, '>', "output file (output format is always DER)"}, - {"i", OPT_INDENT, 0, "entries"}, - {"noout", OPT_NOOUT, 0, "don't produce any output"}, + {"i", OPT_INDENT, 0, "indents the output"}, + {"noout", OPT_NOOUT, 0, "do not produce any output"}, {"offset", OPT_OFFSET, 'p', "offset into file"}, {"length", OPT_LENGTH, 'p', "length of section in file"}, {"oid", OPT_OID, '<', "file of extra oid definitions"}, @@ -184,23 +184,21 @@ int asn1parse_main(int argc, char **argv) } } argc = opt_num_rest(); - argv = opt_rest(); - - if (!app_load_modules(NULL)) - goto end; + if (argc != 0) + goto opthelp; if (oidfile != NULL) { - in = bio_open_default(oidfile, "r"); + in = bio_open_default(oidfile, 'r', FORMAT_TEXT); if (in == NULL) goto end; OBJ_create_objects(in); BIO_free(in); } - if ((in = bio_open_default(infile, RB(informat))) == NULL) + if ((in = bio_open_default(infile, 'r', informat)) == NULL) goto end; - if (derfile && (derout = bio_open_default(derfile, "wb")) == NULL) + if (derfile && (derout = bio_open_default(derfile, 'w', FORMAT_ASN1)) == NULL) goto end; if (strictpem) { @@ -279,9 +277,9 @@ int asn1parse_main(int argc, char **argv) } typ = ASN1_TYPE_get(at); if ((typ == V_ASN1_OBJECT) + || (typ == V_ASN1_BOOLEAN) || (typ == V_ASN1_NULL)) { - BIO_printf(bio_err, "Can't parse %s type\n", - typ == V_ASN1_NULL ? "NULL" : "OBJECT"); + BIO_printf(bio_err, "Can't parse %s type\n", ASN1_tag2str(typ)); ERR_print_errors(bio_err); goto end; } @@ -329,7 +327,6 @@ int asn1parse_main(int argc, char **argv) OPENSSL_free(str); ASN1_TYPE_free(at); sk_OPENSSL_STRING_free(osk); - OBJ_cleanup(); return (ret); }