From patchwork Wed Nov 13 00:44:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 1193919 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="R7Wzp6Qe"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 47CR2949B9z9sPh for ; Wed, 13 Nov 2019 11:53:53 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id F265DC21FA8; Wed, 13 Nov 2019 00:48:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id C6723C21F92; Wed, 13 Nov 2019 00:46:05 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 40617C21F6D; Wed, 13 Nov 2019 00:45:36 +0000 (UTC) Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by lists.denx.de (Postfix) with ESMTPS id 6B5A8C21F16 for ; Wed, 13 Nov 2019 00:45:33 +0000 (UTC) Received: by mail-pf1-f195.google.com with SMTP id p26so328520pfq.8 for ; Tue, 12 Nov 2019 16:45:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=L5tXV0DyHKT6e6apJtsQZkJL8V5//cSUW9rY0m8SyEA=; b=R7Wzp6Qewwdtjc0bIJSgpnNLJhormx0GdjaDbh63D/JsejJPcQ83KNUOiGIk13xRrT O3rBpLITML1XpyZsdYuYw0KWg3sjSe0WXmSoz5ZxkIQwq9vtobAQ1mea2HNmYMWWvulv t+Thzqe1VnYjnJlpBQ1qzi3yy/iWNrBVIYihcn6cXlkxJjdbXaZHlC5sKGYbEFu/NU3J L+4ivlN0Yywg3bE6sU75d8GQj5Fb3X+e+HWivysWggLLVfCnyybB9sqQLNlQvPpCn9+x AWbCG6/y4zfJ5b5wH5FnLYpDR2D7MQEtamxlxjcf3mt8puEXf9pIV9Ypea0S4Y0PzTKD ek0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=L5tXV0DyHKT6e6apJtsQZkJL8V5//cSUW9rY0m8SyEA=; b=qpGJ8uPIxVwCgzoPOCtZNpCCFaWcczALCC+SgtH8GPjAkpIZ29VoMEWlczpqX6vfj0 2mgTvpCadA7GKeOqiMxlLpQwbYoZHY7qR0FJQRoDcRxl9k38vqCmqR+15gH347iam1T4 pXxwEknemmprtzPJwzef3X7RAoEnKaviZDbLqvHxleb+8vl+P9GAuR6jA60O2u2wjywN KDU7h7wybfyOA8/1BP/ejbit1SIqyul21cJae+231P0aVd/E7/vrmqSmPvSUtwtMRdtc x0v6aovK87+YyQrtaozkk42d9SnNp2vHDrSDhMWbwoV0hv0l4yQjKaHX7YinwKDTcAjL kGbQ== X-Gm-Message-State: APjAAAWSF7EznDJv5FGWe5TPstfu/TzCXnCTbkVkxZtG/XwAEp8uoUwY G/2APokNEM6p+4qaBjSN73fH8A== X-Google-Smtp-Source: APXvYqzD1C6v5ZD45fwT0gBnGTHRvD+HuOx6Cs6DZSlXunv33pEh5H8b6otbcSizzs2MSpS3lBPa5A== X-Received: by 2002:a62:1953:: with SMTP id 80mr977296pfz.72.1573605932089; Tue, 12 Nov 2019 16:45:32 -0800 (PST) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id c64sm149248pfb.177.2019.11.12.16.45.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Nov 2019 16:45:31 -0800 (PST) From: AKASHI Takahiro To: trini@konsulko.com, xypron.glpk@gmx.de, agraf@csgraf.de Date: Wed, 13 Nov 2019 09:44:56 +0900 Message-Id: <20191113004502.29986-11-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191113004502.29986-1-takahiro.akashi@linaro.org> References: <20191113004502.29986-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 Cc: u-boot@lists.denx.de, mail@patrick-wildt.de Subject: [U-Boot] [PATCH v3 10/16] doc: add README for asn1 compiler and decoder X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This document gives a brief description about ASN1 compiler as well as ASN1 decoder. Signed-off-by: AKASHI Takahiro --- doc/README.asn1 | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 doc/README.asn1 diff --git a/doc/README.asn1 b/doc/README.asn1 new file mode 100644 index 000000000000..1359b93aef0b --- /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] + + : ASN1 input file + : generated C 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.