[Lake] Re: [EXT] Re: CDDL in EDHOC RFC 9528

"Sipos, Brian J." <Brian.Sipos@jhuapl.edu> Fri, 25 October 2024 16:38 UTC

Return-Path: <Brian.Sipos@jhuapl.edu>
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 61000C1519A7 for <lake@ietfa.amsl.com>; Fri, 25 Oct 2024 09:38:46 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.104
X-Spam-Level:
X-Spam-Status: No, score=-2.104 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_DNSWL_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=jhuapl.edu
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 ElSG4e33bkbe for <lake@ietfa.amsl.com>; Fri, 25 Oct 2024 09:38:41 -0700 (PDT)
Received: from aplegw02.jhuapl.edu (aplegw02.jhuapl.edu [128.244.251.169]) by ietfa.amsl.com (Postfix) with ESMTP id BEDEDC14CF12 for <lake@ietf.org>; Fri, 25 Oct 2024 09:38:41 -0700 (PDT)
Received: from pps.filterd (aplegw02.jhuapl.edu [127.0.0.1]) by aplegw02.jhuapl.edu (8.18.1.2/8.18.1.2) with ESMTP id 49PGCYru011637; Fri, 25 Oct 2024 12:38:39 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jhuapl.edu; h=cc : content-type : date : from : in-reply-to : message-id : mime-version : references : subject : to; s=JHUAPLDec2018; bh=XKeBXAEJHN3il1J0If8T3g8ThQdeKhMN+NqBLymZcDw=; b=G653L/i0yrjpBK81uNFJM4JyLUmokUI3mn2Uh42yxBqw8/WgV2AYv9p+uDzXlVs+tjmi Juzim3cDzAuFVPjCzahytBe7KJyeK5gqeOxcbt9E6GP5ygQj9f9jUI8fdPurq5kvGpll yS9WcGMm5c9DcAUw8sOJUC4RWlTpYQJ0lXIkikCTiJqL27Ll6/xGrhu5CItRLKEG5Ea6 l3lhwWCJl6arJYQcnPlr2NkfNYG9w2lY8/2OXUx56zqn3qqiuzL3zegujUbXAd6F32iD 5otV3DOFEqcdhC5+tDEyumSU3RssDBd/HHSRnSz1Uy+JMywndHZxDnA1WdCfXZieYkrb PA==
Received: from aplex25.dom1.jhuapl.edu (aplex25.dom1.jhuapl.edu [10.114.162.10]) by aplegw02.jhuapl.edu (PPS) with ESMTPS id 42en903bvx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 25 Oct 2024 12:38:39 -0400
Received: from APLEX21.dom1.jhuapl.edu (10.114.162.6) by APLEX25.dom1.jhuapl.edu (10.114.162.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 25 Oct 2024 12:38:39 -0400
Received: from APLEX21.dom1.jhuapl.edu ([fe80::20d7:9545:f01e:9b2]) by APLEX21.dom1.jhuapl.edu ([fe80::20d7:9545:f01e:9b2%5]) with mapi id 15.02.1544.011; Fri, 25 Oct 2024 12:38:39 -0400
From: "Sipos, Brian J." <Brian.Sipos@jhuapl.edu>
To: Carsten Bormann <cabo@tzi.org>
Thread-Topic: [EXT] Re: [Lake] CDDL in EDHOC RFC 9528
Thread-Index: AdsfyLvtAJW5fNKfRgOMqNCNiayP0QAKCfCAAcK43EA=
Date: Fri, 25 Oct 2024 16:38:38 +0000
Message-ID: <a03d4f2da3964856a666695168f3ffa2@jhuapl.edu>
References: <81f2c377a6194222861b92e7371916cc@jhuapl.edu> <E705BE83-8273-40F8-A24D-8515A0D80A76@tzi.org>
In-Reply-To: <E705BE83-8273-40F8-A24D-8515A0D80A76@tzi.org>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: yes
X-MS-TNEF-Correlator:
x-originating-ip: [10.114.162.19]
Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="SHA1"; boundary="----=_NextPart_000_002C_01DB26DA.D051A820"
MIME-Version: 1.0
X-CrossPremisesHeadersFilteredBySendConnector: APLEX25.dom1.jhuapl.edu
X-OrganizationHeadersPreserved: APLEX25.dom1.jhuapl.edu
X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-25_14,2024-10-25_02,2024-09-30_01
Message-ID-Hash: Z3XYXFYASUVWLUJTM4PSRLW2EXX7YUH7
X-Message-ID-Hash: Z3XYXFYASUVWLUJTM4PSRLW2EXX7YUH7
X-MailFrom: Brian.Sipos@jhuapl.edu
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: [EXT] Re: CDDL in EDHOC RFC 9528
List-Id: Lightweight Authenticated Key Exchange <lake.ietf.org>
Archived-At: <https://mailarchive.ietf.org/arch/msg/lake/dvkFu1h4jdSzSttQmXno3bfnvdo>
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>

Carsten,
For the second typo, I mean simply that the current definition looks like the following, which fails to comply with CDDL syntax.

PLAINTEXT_2 = (
  C_R,
  ID_CRED_R : map / bstr / -24..23,
  Signature_or_MAC_2 : bstr,
  ? EAD_2,
)

While it should have a type applied to `C_R` that is consistent with the text (and with the definition of `message_1` rule) like the following.

PLAINTEXT_2 = (
  C_R : bstr / -24..23,
  ID_CRED_R : map / bstr / -24..23,
  Signature_or_MAC_2 : bstr,
  ? EAD_2,
)

> -----Original Message-----
> From: Carsten Bormann <cabo@tzi.org>
> Sent: Wednesday, October 16, 2024 9:29 AM
> To: Sipos, Brian J. <Brian.Sipos@jhuapl.edu>
> Cc: lake@ietf.org
> Subject: [EXT] Re: [Lake] CDDL in EDHOC RFC 9528
> 
> APL external email warning: Verify sender cabo@tzi.org before clicking links or
> attachments
> 
> 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