summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorAKASHI Takahiro <takahiro.akashi@linaro.org>2019-11-13 09:44:56 +0900
committerTom Rini <trini@konsulko.com>2019-12-06 16:44:20 -0500
commite2c04fafc836274c4b04c2439511675350c6df31 (patch)
treef3dd7df2e1618616ce0200f8d6feb6055b1d1288 /doc
parentab8a0e069dbe2db51bc762a1b03d2cda8a118196 (diff)
downloadu-boot-e2c04fafc836274c4b04c2439511675350c6df31.tar.gz
u-boot-e2c04fafc836274c4b04c2439511675350c6df31.tar.xz
u-boot-e2c04fafc836274c4b04c2439511675350c6df31.zip
doc: add README for asn1 compiler and decoder
This document gives a brief description about ASN1 compiler as well as ASN1 decoder. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Diffstat (limited to 'doc')
-rw-r--r--doc/README.asn140
1 files changed, 40 insertions, 0 deletions
diff --git a/doc/README.asn1 b/doc/README.asn1
new file mode 100644
index 0000000000..1359b93aef
--- /dev/null
+++ b/doc/README.asn1
@@ -0,0 +1,40 @@
+ASN1
+====
+
+Abstract Syntax Notation One (or ASN1) is a standard by ITU-T and ISO/IEC
+and used as a description language for defining data structure in
+an independent manner.
+Any data described in ASN1 notation can be serialized (or encoded) and
+de-serialized (or decoded) with well-defined encoding rules.
+
+A combination of ASN1 compiler and ASN1 decoder library function will
+provide a function interface for parsing encoded binary into specific
+data structure:
+1) define data structure in a text file (*.asn1)
+2) define "action" routines for specific "tags" defined in (1)
+3) generate bytecode as a C file (*.asn1.[ch]) from *.asn1 file
+ with ASN1 compiler (tools/asn1_compiler)
+4) call a ASN1 decoder (asn1_ber_decoder()) with bytecode and data
+
+Usage of ASN1 compiler
+----------------------
+ asn1_compiler [-v] [-d] <grammar-file> <c-file> <hdr-file>
+
+ <grammar-file>: ASN1 input file
+ <c-file>: generated C file
+ <hdr-file>: generated include file
+
+Usage of ASN1 decoder
+---------------------
+ int asn1_ber_decoder(const struct asn1_decoder *decoder, void *context,
+ const unsigned char *data, size_t datalen);
+
+ @decoder: bytecode binary
+ @context: context for decoder
+ @data: data to be parsed
+ @datalen: size of data
+
+
+As of writing this, ASN1 compiler and decoder are used to implement
+X509 certificate parser, pcks7 message parser and RSA public key parser
+for UEFI secure boot.