Re: [COSE] [Rats] RAM requirements for COSE/CWT

Laurence Lundblade <lgl@island-resort.com> Tue, 01 March 2022 05:39 UTC

Return-Path: <lgl@island-resort.com>
X-Original-To: cose@ietfa.amsl.com
Delivered-To: cose@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 75DB43A18F9 for <cose@ietfa.amsl.com>; Mon, 28 Feb 2022 21:39:48 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.905
X-Spam-Level:
X-Spam-Status: No, score=-1.905 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_BLOCKED=0.001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
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 ihzpcwAb8jSf for <cose@ietfa.amsl.com>; Mon, 28 Feb 2022 21:39:43 -0800 (PST)
Received: from p3plsmtpa08-01.prod.phx3.secureserver.net (p3plsmtpa08-01.prod.phx3.secureserver.net [173.201.193.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id CF24B3A0AA8 for <cose@ietf.org>; Mon, 28 Feb 2022 21:39:43 -0800 (PST)
Received: from [192.168.1.7] ([75.80.148.139]) by :SMTPAUTH: with ESMTPSA id OvEbnf9mq5SpGOvEcn4Wbq; Mon, 28 Feb 2022 22:39:42 -0700
X-CMAE-Analysis: v=2.4 cv=fetod2cF c=1 sm=1 tr=0 ts=621db19e a=qS/Wyu6Nw1Yro6yF1S+Djg==:117 a=qS/Wyu6Nw1Yro6yF1S+Djg==:17 a=gKmFwSsBAAAA:8 a=W4_2ROo46K8fUIwON-YA:9 a=QEXdDO2ut3YA:10 a=-F49n0WADCVw7yqD:21 a=_W_S_7VecoQA:10 a=nnPW6aIcBuj1ljLj_o6Q:22
X-SECURESERVER-ACCT: lgl@island-resort.com
From: Laurence Lundblade <lgl@island-resort.com>
Message-Id: <33373B82-D46C-498B-A0EB-78E34870C8A7@island-resort.com>
Content-Type: multipart/alternative; boundary="Apple-Mail=_1A814C4B-627C-4F24-8E4B-07B309721F76"
Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.1\))
Date: Mon, 28 Feb 2022 21:39:41 -0800
In-Reply-To: <2A13AF29-6309-4FA3-9A84-59D4E0C8F089@tzi.org>
Cc: "rats@ietf.org" <rats@ietf.org>, cbor@ietf.org, "cose@ietf.org" <cose@ietf.org>
To: Carsten Bormann <cabo@tzi.org>
References: <e8995f0c-ad85-f702-da6b-051ffdc4cb08@gmail.com> <DBBPR08MB5915B874FD16107A7B0105AAFA3A9@DBBPR08MB5915.eurprd08.prod.outlook.com> <1a16c80d-40cd-baba-b1ce-2033dd0db294@gmail.com> <D22D0D63-F76C-48B3-A034-F8B5B2BB6005@tzi.org> <2c8be442-9899-d117-155c-f6f2096b7055@gmail.com> <92C7CF7C-ED23-41B3-AB32-8438C4C88C20@tzi.org> <14c8d106-3b4b-f973-94b8-018852ff4769@gmail.com> <8C2C6592-D5B9-430A-B878-E1009E9BCF22@tzi.org> <AB9F0C55-9C23-43F1-A83F-91D4159C888F@island-resort.com> <59939C29-5370-4385-AE61-A21ADDC0D194@tzi.org> <ED025590-3CA0-42B8-B50E-030D94FA88D6@island-resort.com> <E74C7303-E7D5-45EA-886C-158DB6D83844@tzi.org> <E5AD55D7-33B2-4E50-83EA-5BD1C1462F01@island-resort.com> <2A13AF29-6309-4FA3-9A84-59D4E0C8F089@tzi.org>
X-Mailer: Apple Mail (2.3608.120.23.2.1)
X-CMAE-Envelope: MS4xfP7MLZ30PUfHQc6iYVNMyBFz8yvnQ1PdH+e4n4H3WnSJt/PVeTtqNR91GO0z4mgruimmSVPzjy9xFqhFp49azGJC7jTt18lXiUwNg06MqMOg9kFK0A9a 2j7/R8Z6/xGF5wZcZs41rusbdw89Q36+Ql3CvC1hV6IXPxsTSBRQUy07mupZQKsK10gGrHn8PtfPwZLKTxJerCt2/x4wQhAKBk0Kflzr9Jc79M9HUHIFmuwR f5NpqzIihlDmIiLLqR1ttg==
Archived-At: <https://mailarchive.ietf.org/arch/msg/cose/LGmKq29mVS9gPKihMelxN-q4X24>
Subject: Re: [COSE] [Rats] RAM requirements for COSE/CWT
X-BeenThere: cose@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: CBOR Object Signing and Encryption <cose.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/cose>, <mailto:cose-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cose/>
List-Post: <mailto:cose@ietf.org>
List-Help: <mailto:cose-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/cose>, <mailto:cose-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 01 Mar 2022 05:39:57 -0000

> On Feb 23, 2022, at 1:08 PM, Carsten Bormann <cabo@tzi.org> wrote:
> 
> Hi Laurence,
> 
>> 
>> I know in reality most decoders will handle non-preferred serialization, but I don’t see anything in section 5.2 that says that they must. (non-preferred is still well formed).
> 
> What part of the first sentence of section 5.2:
> 
>>> A generic CBOR decoder can decode all well-formed encoded CBOR data items and present the data items to an application.
> 
> ...could we have phrased better?


Well, um, maybe.  :-)

It’s a small sentence with potentially big implications. 

If your generic decoder is like the pseudo code the implications aren’t big, but for decoders like QCBOR that do a lot more work for you, the implications are large — deep combined nesting of interleaved definite length and indefinite lengths maps and arrays, huge indefinite length strings, multiple levels of tag nesting for a data item that is a map label, a nested set of maps that is used as a map label,…

I haven’t checked, but there might not be very many truly conformant generic decoders. QCBOR definitely isn’t, because it has limits like a max of 4GB for encoded input, max levels of map, array and tag nesting and such to be efficient with code size and memory.

That said, probably most decoders can handle non-preferred integers, the topic at hand, just fine because it is trivial.

Yes you are of course right that 5.2 that defines generic decoders says non-preferred serialization must be supported.

LL