Re: [COSE] The one-byte saving from use of a sequence

Laurence Lundblade <lgl@island-resort.com> Fri, 14 May 2021 18:03 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 88D6A3A3B27 for <cose@ietfa.amsl.com>; Fri, 14 May 2021 11:03:28 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.896
X-Spam-Level:
X-Spam-Status: No, score=-1.896 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_BLOCKED=0.001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, 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 XcxFl1R4Fycp for <cose@ietfa.amsl.com>; Fri, 14 May 2021 11:03:24 -0700 (PDT)
Received: from p3plsmtpa12-08.prod.phx3.secureserver.net (p3plsmtpa12-08.prod.phx3.secureserver.net [68.178.252.237]) (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 3812B3A3B24 for <cose@ietf.org>; Fri, 14 May 2021 11:03:24 -0700 (PDT)
Received: from [192.168.1.81] ([76.167.193.86]) by :SMTPAUTH: with ESMTPA id hc9jl66D56cuyhc9jl79Dq; Fri, 14 May 2021 11:03:23 -0700
X-CMAE-Analysis: v=2.4 cv=W9n96Tak c=1 sm=1 tr=0 ts=609ebb6b a=t2DvPg6iSvRzsOFYbaV4uQ==:117 a=t2DvPg6iSvRzsOFYbaV4uQ==:17 a=48vgC7mUAAAA:8 a=ru_kcxgh6tSi6nUtTUoA:9 a=QEXdDO2ut3YA:10 a=Qjmw0mkrl7V9m80mZ78A:9 a=xCwaIyD39T6_dniG:21 a=_W_S_7VecoQA:10 a=w1C3t2QeGrPiZgrLijVG:22
X-SECURESERVER-ACCT: lgl@island-resort.com
From: Laurence Lundblade <lgl@island-resort.com>
Message-Id: <83523D0B-A2E0-4DBA-9E98-A9F537F52EF8@island-resort.com>
Content-Type: multipart/alternative; boundary="Apple-Mail=_C7C77FE6-EE07-4652-89B5-C8CCF76C7394"
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\))
Date: Fri, 14 May 2021 11:03:22 -0700
In-Reply-To: <D5C7BFED-0148-40AD-8434-F9F2E65130F4@ericsson.com>
Cc: cose <cose@ietf.org>
To: John Mattsson <john.mattsson=40ericsson.com@dmarc.ietf.org>
References: <CAJFkdRwmFZy7PGgJNUpr6New9Op=9cpUg56mmmNFGzhn8pWmXQ@mail.gmail.com> <YFjTK7GSzs1EtPR2@LK-Perkele-VII2.locald> <A8BC22D5-B869-47ED-9F70-C24D51DE0401@ericsson.com> <A4F794D5-94A0-48F1-9303-4A6A2E7F6E76@island-resort.com> <D5C7BFED-0148-40AD-8434-F9F2E65130F4@ericsson.com>
X-Mailer: Apple Mail (2.3445.104.17)
X-CMAE-Envelope: MS4xfHd1aX5Uw79+wWTQIuOyVhmVb6ZL8SdagCNHf2uvM+90i++kjU1NryF117bgTudRk+X0xI3fchGJqZxHs88G4JyMXiaRxkIxHXUXv6HV4H7wwBNCwEGj M1Sc2f+gnVq7pWuYrmjUcg2ZBM0BJH+c7S5MhGNvvnht63sQXSmskJa0vrpOZV3E8bdhqiAexsUPnAS5c4Ts9lr7oNtX9EWLCBI70Z2Flwn/dSAP2/gs18LC 3cX4wQLso3z4qFCd+xK3Vg==
Archived-At: <https://mailarchive.ietf.org/arch/msg/cose/YtXzS9lCr_tOZOVjtX50yCCRbOM>
Subject: Re: [COSE] The one-byte saving from use of a sequence
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: Fri, 14 May 2021 18:03:29 -0000


> On May 14, 2021, at 1:22 AM, John Mattsson <john.mattsson=40ericsson.com@dmarc.ietf.org> wrote:
> 
> > I'm I'm pretty sure it is incorrect CDDL
> I don't know why you think this was incorrect CDDL. RFC 8610 even has the following example [+(left: uint, right: uint)] (but this does not matter as I think we have already taken the decision to use arrays).
> 
> > It would not be possible to decode correctly.
>  
> I don’t think that was true. That would only be true if you cannot determine the number of elements from c509CertificateType (but this does not matter as I think we have already taken the decision to use arrays).
>  

Yes, you are right, as long as the number of items is fixed, you can count and successfully decode (didn’t think of counting like that).

You’d have to be aware of this every time you designed a CBOR protocol that uses CBORCertificate

For example, you couldn’t count for this protocol, but it works fine if CBORCertificate is an array.

   [ 
       * cert : CBORCertificate
       * vector : int
   ]

I still think everyone’s life will be easier if CBORCertificate defined as an array so it works as expected for CBOR-based protocols and you unwrap the array to save the byte in non-CBOR protocols.

LL