Commit Graph

52 Commits

Author SHA1 Message Date
Nicolas Williams
57de79ce6d asn1: Make asn1_print good for benchmarking 2021-03-11 11:58:41 -06:00
Nicolas Williams
c4ff603adf asn1: Fix asn1_print build w/ templating 2021-03-11 11:58:18 -06:00
Nicolas Williams
4d39e8c1b2 asn1: Also fuzz using X.690 sample 2021-03-11 09:36:53 -06:00
Nicolas Williams
1b5fe4a35c asn1: Test x690 sample with both backends
And remove it from the library itself.
2021-03-10 22:52:07 -06:00
Nicolas Williams
440bfeda58 asn1: Allow asn1_print to build w/o templating 2021-03-10 16:00:04 -06:00
Nicolas Williams
7559f36415 asn1: Add -q option to asn1_print 2021-03-06 14:46:52 -06:00
Nicolas Williams
88a4c6f444 asn1: Fix leak in asn1_print 2021-03-05 15:53:20 -06:00
Nicolas Williams
2035efe765 asn1: Fix braino in asn1_print 2021-03-05 14:06:17 -06:00
Nicolas Williams
6ecab8ce51 asn1: Make asn1_print a fuzzing tool 2021-03-05 13:19:38 -06:00
Nicolas Williams
1d2bfd6179 asn1: Fix warnings in asn1_print 2021-03-03 23:28:49 -06:00
Nicolas Williams
fb5ae095e9 asn1: Fix warnings 2021-03-03 10:15:18 -06:00
Nicolas Williams
a68ccb6693 asn1: Add --raw-sequence option to asn1_print 2021-03-02 21:39:00 -06:00
Nicolas Williams
32974ac421 asn1: Fix leak in asn1_print 2021-03-02 20:56:16 -06:00
Nicolas Williams
52b48de856 asn1: Further enhancements to asn1_print 2021-03-02 13:58:56 -06:00
Nicolas Williams
ece3c688e0 asn1: Enrich asn1_print with schema
Our asn1_print, like OpenSSL's, just knows how to parse and dump DER.
Ours can attempt to decode OCTET STRING and IMPLICIT-tagged constructed
values as DER, which is very useful.

But _now_ it's even better.  Now it knows about all types exported from
all ASN.1 modules in `lib/asn1/` in Heimdal, and if told to print as
some type, it will use the new printing interface to print JSON-like
representations of values:

```
$ ./asn1_print /tmp/t490/ek2.crt Certificate |
  jq '.tbsCertificate.extensions[3]._extnValue[]._values'
[
  {
    "_type": "TPMSpecification",
    "family": "2.0",
    "level": "0",
    "revision": "138"
  }
]
[
  {
    "_type": "TPMSecurityAssertions",
    "version": "0",
    "fieldUpgradable": true,
    "ekGenerationType": "655617",
    "ekGenerationLocation": "655616",
    "ekCertificateGenerationLocation": "655616",
    "ccInfo": {
      "_type": "CommonCriteriaMeasures",
      "version": "3.1",
      "assurancelevel": "4",
      "evaluationStatus": "2",
      "plus": true,
      "strengthOfFunction": null,
      "profileOid": null,
      "profileUri": null,
      "targetOid": null,
      "targetUri": null
    },
    "fipsLevel": {
      "_type": "FIPSLevel",
      "version": "140-2",
      "level": "2",
      "plus": false
    },
    "iso9000Certified": false,
    "iso9000Uri": null
  }
]
```
2021-02-28 18:15:25 -06:00
Nicolas Williams
5465b2ddec libasn1: Add OID symbol resolution
This commit adds functions for finding OIDs by symbolic name, meaning by
their symbolic names given in the ASN.1 modules that define them.

TBD:

 - Resolve OIDs to names.
 - Support a file in /etc for additional OID resolution.
 - Add support for resolving OID arc names.
2019-10-07 21:32:00 -05:00
Love Hornquist Astrand
060474df16 quel 64bit warnings, fixup implicit encoding for template, fix spelling 2013-06-03 21:46:20 -07:00
Roland C. Dowdeswell
e8779d5d4a Add -Wshadow and deal with the warnings. 2012-02-21 11:17:55 +00:00
Roland C. Dowdeswell
cc47c8fa7b Turn on -Wextra -Wno-sign-compare -Wno-unused-paramter and fix issues.
We turn on a few extra warnings and fix the fallout that occurs
when building with --enable-developer.  Note that we get different
warnings on different machines and so this will be a work in
progress.  So far, we have built on NetBSD/amd64 5.99.64 (which
uses gcc 4.5.3) and Ubuntu 10.04.3 LTS (which uses gcc 4.4.3).

Notably, we fixed

	1.  a lot of missing structure initialisers,

	2.  unchecked return values for functions that glibc
	    marks as __attribute__((warn-unused-result)),

	3.  made minor modifications to slc and asn1_compile
	    which can generate code which generates warnings,
	    and

	4.  a few stragglers here and there.

We turned off the extended warnings for many programs in appl/ as
they are nearing the end of their useful lifetime, e.g.  rsh, rcp,
popper, ftp and telnet.

Interestingly, glibc's strncmp() macro needed to be worked around
whereas the function calls did not.

We have not yet tried this on 32 bit platforms, so there will be
a few more warnings when we do.
2012-02-20 19:45:41 +00:00
Love Hornquist Astrand
0879b9831a remove trailing whitespace 2011-05-21 11:57:31 -07:00
Love Hornquist Astrand
074a30618f Try to parse inner structure of an octet string (limited to CONS SEQ right now) 2011-04-25 11:33:58 -07:00
Love Hornquist Astrand
fa4c84e6d6 make printablestring and ia5string octetstrings 2010-08-08 15:51:33 -07:00
Love Hornquist Astrand
b939943b07 first stange of asn1 table driven compiler 2009-11-21 10:24:56 -08:00
Love Hörnquist Åstrand
0e6b5c5c22 remove trailing whitespace
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@25232 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-05-28 01:17:17 +00:00
Love Hörnquist Åstrand
6937d41a02 remove trailing whitespace
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23815 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-09-13 09:21:03 +00:00
Love Hörnquist Åstrand
e172367898 switch to utf8 encoding of all files
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23814 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-09-13 08:53:55 +00:00
Love Hörnquist Åstrand
4a4c73c2c4 keep return from ret.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23502 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-08-11 10:00:07 +00:00
Love Hörnquist Åstrand
983b89b811 Add VisibleString parsing
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@19539 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-12-28 17:15:05 +00:00
Love Hörnquist Åstrand
f4f9013804 prefix primitive types with der_
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18443 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-10-14 05:36:34 +00:00
Love Hörnquist Åstrand
c5ede77a94 New der_put_heim_integer signature.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18432 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-10-14 04:57:09 +00:00
Love Hörnquist Åstrand
d4e0968cea Add printing of bignums and use der_print_heim_oid
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17678 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-06-22 03:53:48 +00:00
Love Hörnquist Åstrand
62327ac49e rename optind to optidx
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@15765 ec53bebd-3082-4978-b11e-865c3cabbd6b
2005-07-26 21:32:07 +00:00
Love Hörnquist Åstrand
cd2906e547 hint that there are IMPLICIT content when we find it
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@15700 ec53bebd-3082-4978-b11e-865c3cabbd6b
2005-07-21 19:50:59 +00:00
Love Hörnquist Åstrand
050f24465c print size_t by casting to unsigned long and use right printf format
tags are unsigned integers


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@15679 ec53bebd-3082-4978-b11e-865c3cabbd6b
2005-07-19 18:49:05 +00:00
Love Hörnquist Åstrand
b838707d0e Commit much improved ASN.1 compiler from joda-choice-branch.
Highlighs for the compiler is support for CHOICE and in general better
support for tags. This compiler support most of what is needed for
PK-INIT, LDAP, X.509, PKCS-12 and many other protocols.


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@15617 ec53bebd-3082-4978-b11e-865c3cabbd6b
2005-07-12 06:27:42 +00:00
Love Hörnquist Åstrand
ea01b7dc43 rename optind to optidx, remove shadowed variables
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@15442 ec53bebd-3082-4978-b11e-865c3cabbd6b
2005-06-16 20:09:27 +00:00
Love Hörnquist Åstrand
8e78ed6e48 prefix Der_class with ASN1_C_ to avoid problems with system headerfiles that pollute the name space
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@15255 ec53bebd-3082-4978-b11e-865c3cabbd6b
2005-05-29 14:23:01 +00:00
Love Hörnquist Åstrand
de76cc0520 don't print garabage for octet strings
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14403 ec53bebd-3082-4978-b11e-865c3cabbd6b
2004-12-17 14:02:15 +00:00
Love Hörnquist Åstrand
64f54caed8 decode IA5Stringa and UTF8String
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@12907 ec53bebd-3082-4978-b11e-865c3cabbd6b
2003-09-22 22:37:17 +00:00
Love Hörnquist Åstrand
d28e2d0ebc add support for printing Enumerated
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@12805 ec53bebd-3082-4978-b11e-865c3cabbd6b
2003-09-09 16:08:56 +00:00
Love Hörnquist Åstrand
939b444ca3 prefix typedef\'s and structs with heim_
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@12438 ec53bebd-3082-4978-b11e-865c3cabbd6b
2003-07-15 13:57:32 +00:00
Assar Westerlund
4673402bf9 use com_err/error_message API
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@11314 ec53bebd-3082-4978-b11e-865c3cabbd6b
2002-08-29 20:45:35 +00:00
Assar Westerlund
ad3f648c61 print OIDs too, based on a patch from Love <lha@stacken.kth.se>
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@11191 ec53bebd-3082-4978-b11e-865c3cabbd6b
2002-08-21 23:55:21 +00:00
Johan Danielsson
2679c5e6ad include com_right.h
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@11129 ec53bebd-3082-4978-b11e-865c3cabbd6b
2002-08-19 15:06:54 +00:00
Assar Westerlund
b5fb7b8372 print some size_t correctly
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@10507 ec53bebd-3082-4978-b11e-865c3cabbd6b
2001-08-21 09:42:51 +00:00
Assar Westerlund
67422a6b02 s/[gs]et_progname/[gs]etprogname/
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@9704 ec53bebd-3082-4978-b11e-865c3cabbd6b
2001-02-20 01:44:56 +00:00
Assar Westerlund
9d2457898b (loop): check for length longer than data. inspired by
lha@stacken.kth.se


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@9424 ec53bebd-3082-4978-b11e-865c3cabbd6b
2000-12-29 03:34:16 +00:00
Johan Danielsson
c5b916ca6f remove advertising clause
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7464 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-12-02 17:05:13 +00:00
Assar Westerlund
57c654ea11 add err.h
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7031 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-09-26 15:51:33 +00:00
Assar Westerlund
63a2e418c8 (tag_names); add another univeral tag
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7014 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-09-22 23:48:16 +00:00