Files
heimdal/lib/asn1
Nicolas Williams 6747e16283 asn1: Use unsigned bitfields for named bitsets
Signed 1-bit bitfields are undefined in C.
2021-02-25 17:33:18 -06:00
..
2019-01-15 13:21:25 -06:00
2009-05-28 01:17:17 +00:00
2021-01-13 20:17:58 -06:00
2021-01-13 20:17:58 -06:00
2021-01-20 21:04:34 -06:00
2010-09-29 13:32:39 -07:00
2021-01-20 21:04:34 -06:00
2008-09-13 09:21:03 +00:00
2013-06-21 23:09:44 -05:00
2011-05-21 11:57:31 -07:00
2015-04-19 14:03:59 -05:00
2008-09-13 09:21:03 +00:00
2008-09-13 09:21:03 +00:00
2019-12-04 21:34:44 -06:00
2017-05-26 23:24:30 -04:00
2021-01-13 20:17:58 -06:00
2021-02-10 14:51:38 -06:00
2021-01-25 16:28:44 -06:00
2021-01-13 20:17:58 -06:00
2020-12-18 00:44:47 -06:00
2012-01-17 12:10:14 -06:00
2009-05-28 01:17:17 +00:00
2021-01-20 21:04:34 -06:00
2021-01-20 21:04:34 -06:00
2013-06-05 20:01:11 -07:00
2009-01-11 21:38:56 +00:00

#!/bin/sh

size .libs/libasn1.dylib
size .libs/libasn1base.a | awk '{sum += $1} END {print sum}' | sed 's/^/TEXT baselib: /'
size .libs/asn1_*.o | awk '{sum += $1} END {print sum}' | sed 's/^/generated code stubs: /'
size *_asn1-template.o | awk '{sum += $1} END {print sum}' | sed 's/^/TEXT stubs: /'

exit 0

Notes about the template parser:

- assumption: code is large, tables smaller

- smaller tables and code, smaller cache footprint, better performance

- how to generate template based stubs:

	make check asn1_compile_FLAGS=--template > log

  or 

        ./configure --enable-asn1-templating

- pretty much the same as the generate code, except uses tables instead of code

- much easier to extend!  adding new encoding rules is just adding a few
  functions to template.c, one set of length/encode/decode functions per ER,
  so we could add OER/PER/XDR/GSER/JER with very little work outside that one
  file and gen_template.c (to generate stub functions) and gen.c (to generate
  declarations of those stub functions).

TODO:
	- Fuzzing tests

	- Performance testing

	- ASN1_MALLOC_ENCODE() as a function, replaces encode_ and length_

	- Fix SIZE constraits

        - Proper implementation of `SET { ... }`

	- Compact types that only contain on entry to not having a header.

          Or maybe not.  We can afford larger template footprint if we can get
          more bang for that.  For example, if we add type and member names to
          the templates, we could have template interpreters that implement JER
          (JSON Encoding Rules) and/or GSER (Generic String Encoding Rules),
          and it will cost only the size of the new interpreters plust the
          extra metadata (type and member names).

          Perhaps we could rely on `dladdr()` to find the names of template
          data structures and work out the type and member names from that?
          But then, making more of those static / stripping them would save us
          some of the cost of adding type and member names to the templates.
          Using `dladdr()` might be a problem because it's not really portable,
          and our implementation in lib/roken for WIN32 does not report a
          symbol name, but there is a way to get that in WIN32
          (see https://github.com/dlfcn-win32/dlfcn-win32/).

          E.g., if we know the name of a template table as
          "asn1_TBSCertificate_tag_version_28" then we can work out that it's
          for the member named `version` in the type named `TBSCertificate`.


SIZE - Futher down is later generations of the template parser

	code:
	==================
	__TEXT	__DATA	__OBJC	others	dec	hex
	462848	12288	0	323584	798720	c3000 (O2)

	trivial types:
	==================
	__TEXT	__DATA	__OBJC	others	dec	hex
	446464	12288	0	323584	782336	bf000 (O2)

	OPTIONAL
	==================
	__TEXT	__DATA	__OBJC	others	dec	hex
	425984	16384	0	323584	765952	bb000 (O2)

	SEQ OF
	==================
	__TEXT	__DATA	__OBJC	others	dec	hex
	368640	32768	0	327680	729088	b2000 (O2)
	348160	32768	0	327680	708608	ad000 (Os)

	BOOLEAN
	==================
	339968	32768	0	327680	700416	ab000 (Os)

	TYPE_EXTERNAL:
	==================
	331776	32768	0	327680	692224	a9000 (Os)

	SET OF
	==================
	327680	32768	0	327680	688128	a8000 (Os)

	TYPE_EXTERNAL everywhere
	==================
	__TEXT	__DATA	__OBJC	others	dec	hex
	167936	69632	0	327680	565248	8a000 (Os)

	TAG uses ->ptr (header and trailer)
	==================
	229376	102400	0	421888	753664	b8000 (O0)

	TAG uses ->ptr (header only)
	==================
	221184	77824	0	421888	720896	b0000 (O0)

	BER support for octet string (not working)
	==================
	180224	73728	0	417792	671744	a4000 (O2)

	CHOICE and BIT STRING missign
	==================
	__TEXT	__DATA	__OBJC	others	dec	hex
	172032	73728	0	417792	663552	a2000 (Os)

	No accessor functions to global variable
	==================
	__TEXT	__DATA	__OBJC	others	dec	hex
	159744	73728	0	393216	626688	99000 (Os)

	All types tables (except choice) (id still objects)
	==================
	__TEXT	__DATA	__OBJC	others	dec	hex
	167936	77824	0	421888	667648	a3000
	base lib: 22820

	__TEXT	__DATA	__OBJC	others	dec	hex
	==================
	167936	77824	0	421888	667648	a3000 (Os)
	baselib: 22820
	generated code stubs: 41472
	TEXT stubs: 112560

	All types, id still objects
	==================
	__TEXT	__DATA	__OBJC	others	dec	hex
	155648	81920	0	430080	667648	a3000 (Os)
	TEXT baselib: 23166
	generated code stubs: 20796
	TEXT stubs: 119891

	All types, id still objects, dup compression
	==================
	__TEXT	__DATA	__OBJC	others	dec	hex
	143360	65536	0	376832	585728	8f000 (Os)
	TEXT baselib: 23166
	generated code stubs: 20796
	TEXT stubs: 107147

	All types, dup compression, id vars
	==================
	__TEXT	__DATA	__OBJC	others	dec	hex
	131072	65536	0	352256	548864	86000
	TEXT baselib: 23166
	generated code stubs: 7536
	TEXT stubs: 107147