summaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2012-09-22 00:31:13 +0200
committerRusty Russell <rusty@rustcorp.com.au>2012-10-08 05:20:19 +0200
commit4520c6a49af833c83de6c74525ce8e07bbe6d783 (patch)
tree66b6b43e95cf270e00aa5cb308a12534f33216d9 /init
parentX.509: Add utility functions to render OIDs as strings (diff)
downloadlinux-4520c6a49af833c83de6c74525ce8e07bbe6d783.tar.xz
linux-4520c6a49af833c83de6c74525ce8e07bbe6d783.zip
X.509: Add simple ASN.1 grammar compiler
Add a simple ASN.1 grammar compiler. This produces a bytecode output that can be fed to a decoder to inform the decoder how to interpret the ASN.1 stream it is trying to parse. Action functions can be specified in the grammar by interpolating: ({ foo }) after a type, for example: SubjectPublicKeyInfo ::= SEQUENCE { algorithm AlgorithmIdentifier, subjectPublicKey BIT STRING ({ do_key_data }) } The decoder is expected to call these after matching this type and parsing the contents if it is a constructed type. The grammar compiler does not currently support the SET type (though it does support SET OF) as I can't see a good way of tracking which members have been encountered yet without using up extra stack space. Currently, the grammar compiler will fail if more than 256 bytes of bytecode would be produced or more than 256 actions have been specified as it uses 8-bit jump values and action indices to keep space usage down. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'init')
-rw-r--r--init/Kconfig8
1 files changed, 8 insertions, 0 deletions
diff --git a/init/Kconfig b/init/Kconfig
index af6c7f8ba019..66cc885abbc6 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1612,4 +1612,12 @@ config PADATA
depends on SMP
bool
+config ASN1
+ tristate
+ help
+ Build a simple ASN.1 grammar compiler that produces a bytecode output
+ that can be interpreted by the ASN.1 stream decoder and used to
+ inform it as to what tags are to be expected in a stream and what
+ functions to call on what tags.
+
source "kernel/Kconfig.locks"