diff options
author | David Howells <dhowells@redhat.com> | 2012-09-24 12:11:16 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2012-10-07 23:20:20 -0400 |
commit | 42d5ec27f873c654a68f7f865dcd7737513e9508 (patch) | |
tree | a52fdc8d71dfc3724e4b2828fd53958e3774c761 /lib/Makefile | |
parent | 4520c6a49af833c83de6c74525ce8e07bbe6d783 (diff) |
X.509: Add an ASN.1 decoder
Add an ASN.1 BER/DER/CER decoder. This uses the bytecode from the ASN.1
compiler in the previous patch to inform it as to what to expect to find in the
encoded byte stream. The output from the compiler also tells it what functions
to call on what tags, thus allowing the caller to retrieve information.
The decoder is called as follows:
int asn1_decoder(const struct asn1_decoder *decoder,
void *context,
const unsigned char *data,
size_t datalen);
The decoder argument points to the bytecode from the ASN.1 compiler. context
is the caller's context and is passed to the action functions. data and
datalen define the byte stream to be decoded.
Note that the decoder is currently limited to datalen being less than 64K.
This reduces the amount of stack space used by the decoder because ASN.1 is a
nested construct. Similarly, the decoder is limited to a maximum of 10 levels
of constructed data outside of a leaf node also in an effort to keep stack
usage down.
These restrictions can be raised if necessary.
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'lib/Makefile')
-rw-r--r-- | lib/Makefile | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/Makefile b/lib/Makefile index b0428960939f..ca856b69a21d 100644 --- a/lib/Makefile +++ b/lib/Makefile | |||
@@ -140,6 +140,8 @@ $(foreach file, $(libfdt_files), \ | |||
140 | $(eval CFLAGS_$(file) = -I$(src)/../scripts/dtc/libfdt)) | 140 | $(eval CFLAGS_$(file) = -I$(src)/../scripts/dtc/libfdt)) |
141 | lib-$(CONFIG_LIBFDT) += $(libfdt_files) | 141 | lib-$(CONFIG_LIBFDT) += $(libfdt_files) |
142 | 142 | ||
143 | obj-$(CONFIG_ASN1) += asn1_decoder.o | ||
144 | |||
143 | hostprogs-y := gen_crc32table | 145 | hostprogs-y := gen_crc32table |
144 | clean-files := crc32table.h | 146 | clean-files := crc32table.h |
145 | 147 | ||