partial rewrite of the ASN.1 encoders
authorKen Raeburn <raeburn@mit.edu>
Sat, 25 Oct 2008 07:03:11 +0000 (07:03 +0000)
committerKen Raeburn <raeburn@mit.edu>
Sat, 25 Oct 2008 07:03:11 +0000 (07:03 +0000)
commit2637c91329faa84bd91a343f07bfbe2810a39833
tree825cbc69bfa090eae2849162b1728ec200f8b5c7
parent887c33561e4731da0238c14420a277f0609680c9
partial rewrite of the ASN.1 encoders

Instead of a pile of macros generating code, that have to be threaded
together in just the right way to get a valid ASN.1 encoding, we now
have a pile of macros for defining data structures describing the
objects and the ASN.1 types they should be encoded as, which
structures are interpreted by recursive invocations of an encoder
engine; there should be somewhat less rope for accidentally creating
invalid encodings.  The new macros are commented in asn1_k_encode.c.

Putting most of the work into the encoder engine also reduces the code
size (in one configuration, including LDAP-KDB and PKINIT encoders,
code size went from 37K to <16K, though 10K of tables were added, and
the PKINIT encoders are still open-coded).

Some encoder interfaces have been revised to be more regular -- all
now take one pointer to const argument (no two-input encoders, no
pointer-to-non-const-pointer-to-const).  A few encoders were
eliminated or disabled because they were neither used nor exported
from the library.

The LDAP-KDB encoder has been converted, but the PKINIT encoders have
not as there are no regression tests for them currently.

There is still plenty of room for improvement; some notes on specific
ideas have been added.

String encoding primitives have been combined to reduce code size.  A
primitive for encoding bit strings has been added.

Some miscellaneous warnings in the decoders have been cleaned up.

A new dejagnu test case is added that ensures that KRB-SAFE messages
get exercised.

ticket: new

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20923 dc483132-0cff-0310-8789-dd5450dbe970
19 files changed:
src/include/k5-int.h
src/kdc/kdc_preauth.c
src/lib/krb5/asn.1/TODO.asn1 [new file with mode: 0644]
src/lib/krb5/asn.1/asn1_encode.c
src/lib/krb5/asn.1/asn1_encode.h
src/lib/krb5/asn.1/asn1_k_decode.c
src/lib/krb5/asn.1/asn1_k_encode.c
src/lib/krb5/asn.1/asn1_k_encode.h
src/lib/krb5/asn.1/asn1buf.c
src/lib/krb5/asn.1/asn1buf.h
src/lib/krb5/asn.1/krb5_encode.c
src/lib/krb5/asn.1/krbasn1.h
src/lib/krb5/asn.1/ldap_key_seq.c
src/lib/krb5/krb/chpw.c
src/lib/krb5/krb/rd_safe.c
src/lib/krb5/krb/send_tgs.c
src/tests/asn.1/Makefile.in
src/tests/asn.1/krb5_encode_test.c
src/tests/dejagnu/krb-standalone/simple.exp [new file with mode: 0644]