[Suit] CBOR pull parsing vs. packed binary format extraction

Brendan Moran <Brendan.Moran@arm.com> Tue, 13 November 2018 12:24 UTC

Return-Path: <Brendan.Moran@arm.com>
X-Original-To: suit@ietfa.amsl.com
Delivered-To: suit@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 672EF130DD5 for <suit@ietfa.amsl.com>; Tue, 13 Nov 2018 04:24:26 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.902
X-Spam-Level:
X-Spam-Status: No, score=-1.902 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XQ36hah1Lq3u for <suit@ietfa.amsl.com>; Tue, 13 Nov 2018 04:24:22 -0800 (PST)
Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on0628.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0d::628]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 2372A12D4EF for <suit@ietf.org>; Tue, 13 Nov 2018 04:24:21 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bd3uKRDHezO9wMN6+r5xP50SXFJevNjw9Tprxqd9tLk=; b=R1R03OreGpxQnIhxnAe1ABM/IZX81q70CRWhKureaUn09ahzOCler57QqOr+IdbqgLdQFV2drUI0ce5LaaTjCi3e+ryD8+W4uxQWugLHe0m7zQj54OL2GLqMZmnWNICNvnNqMmHFZF0rhko19UBxkvM5GlX7jPZwzVMuoSj+jhY=
Received: from DB6PR0801MB1879.eurprd08.prod.outlook.com (10.168.85.13) by DB6PR0801MB1336.eurprd08.prod.outlook.com (10.168.11.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.30; Tue, 13 Nov 2018 12:24:17 +0000
Received: from DB6PR0801MB1879.eurprd08.prod.outlook.com ([fe80::acf2:1e1b:193a:4971]) by DB6PR0801MB1879.eurprd08.prod.outlook.com ([fe80::acf2:1e1b:193a:4971%3]) with mapi id 15.20.1294.045; Tue, 13 Nov 2018 12:24:17 +0000
From: Brendan Moran <Brendan.Moran@arm.com>
To: suit <suit@ietf.org>
Thread-Topic: CBOR pull parsing vs. packed binary format extraction
Thread-Index: AQHUe0vLj/vkzYlH5UqFZoje4UGxSw==
Date: Tue, 13 Nov 2018 12:24:17 +0000
Message-ID: <77A2FE52-4828-481A-AA09-F20FCF0C3605@arm.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-mailer: Apple Mail (2.3445.9.1)
authentication-results: spf=none (sender IP is ) smtp.mailfrom=Brendan.Moran@arm.com;
x-originating-ip: [217.140.106.54]
x-ms-publictraffictype: Email
x-microsoft-exchange-diagnostics: 1; DB6PR0801MB1336; 6:r+j64boeyQqFQexfOkhjcZbWFEfAy2c94ZJdy2cec6QOfyCiHa2xGEw7qUTQajXbm/e3sLhHl6ZVdUVm6VXPaGDMfvoqxqfJnRbYxzOoxciOXexwNW5QwAuH75lBzA9sJ0wkenSX4++D+ffE46mFEeRVkzNirKCSQ05QBcG54wLo3FkjNJfUxLIi3F3cYgNXdefKNGi4MqZM3Kgt8RgMpgqdGVE41YN2GCCc+pWOy2PEOuiHforrsENwdpzHkcetpkxpizTKaVZHlKX9pyQMFT/HBXq/YHr/RwEStatwwvNxRkLxJVF94M7mN7MFHs3BoeFOwjnyrp3aDrUP3SnOxaztCYZO198QWlOp6vaR8qmHv1F5jWtsTBlIW6iv9IZh6H26Nww+aD0IgokrPtUlc5ZbS6S4fsV90lZLONuLODjUuH5Y5Sb7l3L3pKGcDwq+Rvk5zlHu8x0HVtfszi/RgQ==; 5:RYpLpTNLRvXnQJ2SRhclDWhn299ydwQUBEXA2FEvKQBGpojfVCh7qw/FIjUBOwzP/+Xpk+fGTrr5W4TQ7v16NmWyfBLAhweiRfO+pdyJRBnrHAWX/SPB0Q/WLQtAn3UaVf07Ne+ow7DWyOeYL9awDTRaQ9dRqpKRfeU0QbQdJm8=; 7:6t4dV3HnCZwCgGTPh7xckw9Pr7UkF9IoscLyZWpSgjXZvGk+jqLdRXfGjHNpajedQgiBZhKgCJhjWwz9Nbg8KkyUHv0f3Kendf3U1zfuXBLcRYYzKrqRpkx6oDbmwktr45TtUHpI62D4JCraxW0tXA==
x-ms-exchange-antispam-srfa-diagnostics: SOS;
x-ms-office365-filtering-correlation-id: 889cae10-157a-4c44-9d0e-08d64962ee6d
x-ms-office365-filtering-ht: Tenant
x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390060)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB6PR0801MB1336;
x-ms-traffictypediagnostic: DB6PR0801MB1336:
x-microsoft-antispam-prvs: <DB6PR0801MB13360DE169B978D7C6E9518DEAC20@DB6PR0801MB1336.eurprd08.prod.outlook.com>
x-exchange-antispam-report-test: UriScan:(166708455590820);
x-ms-exchange-senderadcheck: 1
x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231382)(944501410)(52105112)(3002001)(10201501046)(93006095)(93001095)(6055026)(148016)(149066)(150057)(6041310)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:DB6PR0801MB1336; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0801MB1336;
x-forefront-prvs: 085551F5A8
x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(396003)(366004)(346002)(39860400002)(376002)(40434004)(199004)(189003)(6116002)(105586002)(99286004)(72206003)(478600001)(3846002)(106356001)(316002)(71200400001)(71190400001)(8936002)(83716004)(81166006)(7736002)(305945005)(81156014)(8676002)(50226002)(486006)(86362001)(2616005)(57306001)(6436002)(2906002)(476003)(97736004)(6306002)(5660300001)(68736007)(6512007)(33656002)(53936002)(966005)(102836004)(6506007)(186003)(66066001)(5024004)(14444005)(26005)(256004)(2900100001)(36756003)(6916009)(6486002)(14454004)(82746002)(25786009); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0801MB1336; H:DB6PR0801MB1879.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1;
received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts)
x-microsoft-antispam-message-info: 7/vuvjd0Li282yQeCJqc7gagvHaPhjepZ0ZdJDA8jdkFhtlCBLXafD1CFqpBceU/vFFYUwa+zjdF5PfqRSq8DRYsejNdmbW7cPb9PSfnJKbuqoWDkWMPRC/tWdHdQO01kCWGflmjljDYx6EXTdKzpzlOAB1DeQMEfMK0dHvkgXzDDxhuidd4/J/yECKKoKd6VWi7pOtmbHl+Ci/k5L7bh2HKx1dex6PR4VHVe/tmjV1OTvq6TGXEgrab5SmeSv3fpCw8m/s1wHmVTc7yeohyM4F1XE6lY+FwNBUAg1T0i/ToewSRYIncWEr7KfNp45peZWZxTUswLosgpnrMrBbgA/LBjiJXpGELwmn+Cj/5538=
spamdiagnosticoutput: 1:99
spamdiagnosticmetadata: NSPM
Content-Type: text/plain; charset="us-ascii"
Content-ID: <A0B134A09C6A284F936F1F4C4BC4FA55@eurprd08.prod.outlook.com>
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-OriginatorOrg: arm.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 889cae10-157a-4c44-9d0e-08d64962ee6d
X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Nov 2018 12:24:17.3556 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1336
Archived-At: <https://mailarchive.ietf.org/arch/msg/suit/CB5HPoyzlCsqdeDWyetnKzIUgtk>
Subject: [Suit] CBOR pull parsing vs. packed binary format extraction
X-BeenThere: suit@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Software Updates for Internet of Things <suit.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/suit>, <mailto:suit-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/suit/>
List-Post: <mailto:suit@ietf.org>
List-Help: <mailto:suit-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/suit>, <mailto:suit-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 13 Nov 2018 12:24:26 -0000

I have worked up an example pull parser for Class 1 devices. It is published in the suit-manifest-generator repo:

https://github.com/ARMmbed/suit-manifest-generator/tree/master/parser-example

This repo demonstrates constructing a highly specialised parser for the draft-moran-suit-manifest-03 draft (with one small modification that will be included in the 04 draft) as detailed in README.md.

The parser has been built for ARM Cortex-M4 to evaluate size:

The parser consumes 560 bytes of flash, uses only a single pointer of state between function calls, returns interpreted integers and references to byte strings to save memory when called, and uses no dynamic memory. It is guaranteed not to issue unaligned accesses, since all accesses are explicitly byte-wise.

The parser can be used in a low-resource mode, consuming 333 bytes of flash, but giving up structural validation of the CBOR, and assuming that any fixed components (such as containers) of the manifest are correct


I have also provided, for comparison, an unserialised binary structure using the same information and the same parser API. In this instance, the parser consumes 102 bytes of flash. This is not the manifest as defined in draft-pagel-suit-manifest-00.

Martin, would you be able to offer an implementation of an updater for class 1 devices using your manifest draft so that we can compare the compiled size?

Best Regards,
Brendan

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.