Re: [Cbor] Announcement: draft-mcnally-deterministic-cbor-03

Joe Hildebrand <hildjj@cursive.net> Mon, 07 August 2023 22:16 UTC

Return-Path: <hildjj@cursive.net>
X-Original-To: cbor@ietfa.amsl.com
Delivered-To: cbor@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 24D51C15153F for <cbor@ietfa.amsl.com>; Mon, 7 Aug 2023 15:16:48 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.106
X-Spam-Level:
X-Spam-Status: No, score=-2.106 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_BLOCKED=0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=cursive.net
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0FWSDKo6R2pQ for <cbor@ietfa.amsl.com>; Mon, 7 Aug 2023 15:16:44 -0700 (PDT)
Received: from mail-il1-x133.google.com (mail-il1-x133.google.com [IPv6:2607:f8b0:4864:20::133]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 24B47C151527 for <cbor@ietf.org>; Mon, 7 Aug 2023 15:16:43 -0700 (PDT)
Received: by mail-il1-x133.google.com with SMTP id e9e14a558f8ab-3492cd048c9so23927305ab.1 for <cbor@ietf.org>; Mon, 07 Aug 2023 15:16:43 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cursive.net; s=google; t=1691446603; x=1692051403; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=lc1zfE5M6wlUgwMeaFsHpSdFnhs5PjO2SdmmBd7YAds=; b=DYqlhhUQf79aN0CqX0mLQVTslOC1/VQ1CrQ5RfebhstQK05zdY6P05tUJaxdZuTx3k lvETTZUCE4etjgLXGeINalfGwcRKDG3W5I7BQhEbJcIhhSFOKid/U/8HNKKJNOOWk007 qRhQx7Kil7g/CDAw63kI9R8WRKIyYxx5I6ahw=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691446603; x=1692051403; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lc1zfE5M6wlUgwMeaFsHpSdFnhs5PjO2SdmmBd7YAds=; b=Km4Ed4jljsi9JnkoKYaPQUwnVjDAoshty3g2+JTSbe6tHz7ishpPUNM3lj13KxkpYh UMQSYW7ITRjIPE1oit4QCXnZs4r0aHnJTvdXX1xR15h5jA9eMq+Abxnzoso7aEP1gsJ3 +SiBTQAkG7kUNzqENEtuFmk4vNlx4n8hcPlohGvJh8yJIocpgpYj8bGh29ScUNB0CTBa dNIagzWMzjiwPrsg7WBxsROicH+T5qN/e6qWzp6m9QNiv1QcKwZUIMCcFDiPHOOjogB0 sLn8/3o2PR70pyw9xt7hBnuNL39GfUwFFJXkBYNOH9zHOj4GU1LWo1psnqVHJHTExZoy IJZw==
X-Gm-Message-State: AOJu0Ywskdecwz5EU6OzmKT6CJVVCB1POVCM9oL9mQ1pHITO90Nb58FH 8RweYnPeQrGVRONEu/9ry/w21g==
X-Google-Smtp-Source: AGHT+IEEUj11nNNVNxPGmbvewXKjtTtvzdYWcMCxDyH9EeVDSHVaUViVs6Rej5MU7rAToWNVPb+GEw==
X-Received: by 2002:a05:6e02:1286:b0:349:45c8:e3f8 with SMTP id y6-20020a056e02128600b0034945c8e3f8mr11553092ilq.31.1691446602998; Mon, 07 Aug 2023 15:16:42 -0700 (PDT)
Received: from smtpclient.apple ([2601:282:2101:423e:74ff:e8c4:c3eb:6a05]) by smtp.gmail.com with ESMTPSA id u18-20020a02c052000000b0042b2d9fbbecsm2659156jam.119.2023.08.07.15.16.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Aug 2023 15:16:42 -0700 (PDT)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\))
From: Joe Hildebrand <hildjj@cursive.net>
In-Reply-To: <CFBE7F50-E83C-4D4C-B8F2-588D2DF97029@wolfmcnally.com>
Date: Mon, 07 Aug 2023 16:16:31 -0600
Cc: cbor@ietf.org, Carsten Bormann <cabo@tzi.org>
Content-Transfer-Encoding: quoted-printable
Message-Id: <62B0B758-5F97-458F-A662-D85777E6983E@cursive.net>
References: <169130970676.57946.2391787665439799751@ietfa.amsl.com> <E0D91ECB-F88B-4A38-A4BC-9CBCD488E475@wolfmcnally.com> <4CF6297F-5873-4245-939B-D2665F000B10@cursive.net> <D1E26143-3328-4A28-80CA-2D7E040FE25B@cursive.net> <D447189D-D994-4845-BA8E-752AABC9274B@tzi.org> <CFBE7F50-E83C-4D4C-B8F2-588D2DF97029@wolfmcnally.com>
To: Wolf McNally <wolf@wolfmcnally.com>
X-Mailer: Apple Mail (2.3731.700.6)
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/8oeKyLjSg3AqtyskRQRrr6VMT9w>
Subject: Re: [Cbor] Announcement: draft-mcnally-deterministic-cbor-03
X-BeenThere: cbor@ietf.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: "Concise Binary Object Representation \(CBOR\)" <cbor.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/cbor>, <mailto:cbor-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cbor/>
List-Post: <mailto:cbor@ietf.org>
List-Help: <mailto:cbor-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/cbor>, <mailto:cbor-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 07 Aug 2023 22:16:48 -0000

Nod, that's fine with me, then.

— 
Joe Hildebrand

> On Aug 7, 2023, at 2:21 PM, Wolf McNally <wolf@wolfmcnally.com> wrote:
> 
> Joe,
> 
> Carsten’s explanation comports with my understanding, and is reflected in RFC 8949 §4.2.1 on determinism where it says, "Preferred serialization MUST be used. In particular, this means that arguments (see Section 3) for integers, lengths in major types 2 through 5, and tags MUST be as short as possible…”
> 
> This is reiterated in the dCBOR I-D §2.1: "dCBOR encoders … MUST encode variable-length integers using the shortest form possible.” The I-D also extends this with an explicit validation requirement: "In addition, dCBOR decoders … MUST reject any variable length integers that are not encoded in the shortest form possible."
> 
> https://www.ietf.org/archive/id/draft-mcnally-deterministic-cbor-04.html#section-2.1-3.1
> 
> ~ Wolf
> 
>> On Aug 7, 2023, at 9:12 AM, Carsten Bormann <cabo@tzi.org> wrote:
>> 
>> On 2023-08-07, at 18:00, Joe Hildebrand <hildjj@cursive.net> wrote:
>>> 
>>> One more thing, there may need to be another note that says that the integer descriptors for complex types (array, map, tag, byte string, utf8 string) MUST follow the rules for mt 0/1.  It's implied strongly and probably difficult to implement any other way, but 
>>> might be worth mentioning.
>> 
>> Hi Joe,
>> 
>> descriptor is not a word we use in RFC 8949.
>> We have something that is used with all of these, which is by definition an unsigned integer: The argument [1].
>> 
>> The argument can represent any integral number between 0 and 2**64-1.
>> 
>> The argument is directly used as the mt0 value (the mt1 value is -argument-1, or, in C integer arithmetic, ~argument).  For mt2 and mt3, the argument gives the length of the string in bytes.  For mt4, the number of elements in the array.  mt5, number of pairs in the map.  mt6, the tag number.  mt7 is a bit more complicated.
>> 
>> So, by definition, the argument already behaves like an mt0, because mt0 is defined by the argument...
>> 
>> Grüße, Carsten
>> 
>> [1]: https://www.rfc-editor.org/rfc/rfc8949.html#name-specification-of-the-cbor-e
>> 
>