[Lake] Re: CDDL in EDHOC RFC 9528

Carsten Bormann <cabo@tzi.org> Wed, 16 October 2024 13:29 UTC

Return-Path: <cabo@tzi.org>
X-Original-To: lake@ietfa.amsl.com
Delivered-To: lake@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 2861BC1D52F5 for <lake@ietfa.amsl.com>; Wed, 16 Oct 2024 06:29:10 -0700 (PDT)
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, RCVD_IN_DNSWL_BLOCKED=0.001, 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
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 0v4jhckX8WIB for <lake@ietfa.amsl.com>; Wed, 16 Oct 2024 06:29:05 -0700 (PDT)
Received: from smtp.zfn.uni-bremen.de (smtp.zfn.uni-bremen.de [IPv6:2001:638:708:32::21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id D90F4C1CAE66 for <lake@ietf.org>; Wed, 16 Oct 2024 06:29:04 -0700 (PDT)
Received: from clients-pool1-0014.vpn.uni-bremen.de (clients-pool1-0014.vpn.uni-bremen.de [134.102.107.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.zfn.uni-bremen.de (Postfix) with ESMTPSA id 4XTBdB1bc4zDCf0; Wed, 16 Oct 2024 15:29:02 +0200 (CEST)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\))
From: Carsten Bormann <cabo@tzi.org>
In-Reply-To: <81f2c377a6194222861b92e7371916cc@jhuapl.edu>
Date: Wed, 16 Oct 2024 15:29:01 +0200
X-Mao-Original-Outgoing-Id: 750778141.666478-b6e96329c51bb7350a1bbd9a1e188084
Content-Transfer-Encoding: quoted-printable
Message-Id: <E705BE83-8273-40F8-A24D-8515A0D80A76@tzi.org>
References: <81f2c377a6194222861b92e7371916cc@jhuapl.edu>
To: "Sipos, Brian J." <Brian.Sipos@jhuapl.edu>
X-Mailer: Apple Mail (2.3608.120.23.2.7)
Message-ID-Hash: GPO3JNDKECCH3AHNKPYNHFSDO5LOQ52E
X-Message-ID-Hash: GPO3JNDKECCH3AHNKPYNHFSDO5LOQ52E
X-MailFrom: cabo@tzi.org
X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header
CC: "lake@ietf.org" <lake@ietf.org>
X-Mailman-Version: 3.3.9rc6
Precedence: list
Subject: [Lake] Re: CDDL in EDHOC RFC 9528
List-Id: Lightweight Authenticated Key Exchange <lake.ietf.org>
Archived-At: <https://mailarchive.ietf.org/arch/msg/lake/_YDvXwaqUS5wgzOHMoz10qI5-_M>
List-Archive: <https://mailarchive.ietf.org/arch/browse/lake>
List-Help: <mailto:lake-request@ietf.org?subject=help>
List-Owner: <mailto:lake-owner@ietf.org>
List-Post: <mailto:lake@ietf.org>
List-Subscribe: <mailto:lake-join@ietf.org>
List-Unsubscribe: <mailto:lake-leave@ietf.org>

Hi Brian,

thank you for looking into this.
Whatever comes out of this I would like to reflect in

https://www.ietf.org/archive/id/draft-bormann-cbor-rfc-cddl-models-04.html

(And the accompanying library of referenceable CDDL specifications in the cddlc tool.)

On 2024-10-16, at 14:41, Sipos, Brian J. <Brian.Sipos@jhuapl.edu> wrote:
> […]
>    EAD_1 = (1* ead)

Right.  Actually, this should be a + instead of a 1*, + is much more idiomatic in CDDL.

> Another is the lack of a type within the `PLAINTEXT_2` group for the field `C_R` which just seems like a simple omission.

I’m not entirely sure I understand these CDDL snippets, e.g., ID_CRED_I also isn’t defined as a type.
 
> Finally, there is the use of a type `map` within the ID_CRED_x fields, which is not actually defined anywhere for CDDL. So I added a local definition
>     map = #5
> I’m not sure if that is the best way to handle this situation. Another alternative would be something more CDDL-like
>     { * any => any }

If this is what you want, I’d prefer that a lot over #5.
But maybe it actually isn’t *any* map?

BTW, map is not a predefined name so you can say

map = { * any => any }

if you like...

> I don’t think the two differ in what they will match but maybe the second form is more tool-friendly?

The original cddl tool can be very specific in its taste, so you’ll get

  Can't generate prim 5 (RuntimeError)

for   map = #5

> As a suggestion for readability, I also think it’s helpful to have a couple of shared-type rules to make it obvious where different fields really do share the same type. One for connection IDs (shared between `C_I` and `C_R`) and one for credential IDs (shared between `ID_CRED_I` and `ID_CRED_R`) as the following
>     id_conn = bstr / -24..23
>     id_cred = map / bstr / -24..23

Very good idea.
We could include CDDL that has been combed through a bit in the above I-D.

Grüße, Carsten

>  
> Thanks for any feedback,
> Brian S.
>  
> [1] https://www.rfc-editor.org/rfc/rfc9528.html#appendix-C.2
> [2] https://crates.io/crates/cddl
> [3] https://rubygems.org/gems/cddl
>  
> -- 
> Lake mailing list -- lake@ietf.org
> To unsubscribe send an email to lake-leave@ietf.org