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>
Loading
-
mentioned in commit ef2518ba
-
mentioned in commit 1f166fb6
-
mentioned in commit 85e0828a
-
mentioned in commit 9a55bad4
-
mentioned in commit 64c1e016
-
mentioned in commit 65264660
-
mentioned in commit b59a0d09
-
mentioned in commit 6bcc9130
-
mentioned in commit 5dddee19
-
mentioned in commit 0e71d53f
-
mentioned in commit 65be20f6
-
mentioned in commit c9fa5fe3
-
mentioned in commit f84a7f4a
-
mentioned in commit a6696787
-
mentioned in commit 5c015c60
-
mentioned in commit a35ae421
-
mentioned in commit fe80dca0
-
mentioned in commit b49c05c7
-
mentioned in commit 14312aeb
-
mentioned in commit c0338fa2
-
mentioned in commit 624f5ab8
Please sign in to comment