Re: [core] AD review of draft-ietf-core-oscore-edhoc-08

Paul Wouters <paul.wouters@aiven.io> Thu, 12 October 2023 23:07 UTC

Return-Path: <paul.wouters@aiven.io>
X-Original-To: core@ietfa.amsl.com
Delivered-To: core@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 057ACC14CE44 for <core@ietfa.amsl.com>; Thu, 12 Oct 2023 16:07:15 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.213
X-Spam-Level:
X-Spam-Status: No, score=-1.213 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, HTML_MESSAGE=0.001, MIME_HTML_ONLY=0.1, MIME_HTML_ONLY_MULTI=0.001, MIME_QP_LONG_LINE=0.001, MPART_ALT_DIFF=0.79, 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_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=no autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=aiven.io
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 WQpfkHTzixkZ for <core@ietfa.amsl.com>; Thu, 12 Oct 2023 16:07:10 -0700 (PDT)
Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) (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 A9AFEC14CE30 for <core@ietf.org>; Thu, 12 Oct 2023 16:07:10 -0700 (PDT)
Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-9b275afb6abso560866966b.1 for <core@ietf.org>; Thu, 12 Oct 2023 16:07:10 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aiven.io; s=google; t=1697152029; x=1697756829; darn=ietf.org; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:from:to:cc:subject:date:message-id :reply-to; bh=clHKP8hn0oLpy4Jh/617rCBiLmcBZjZtkYLXWnWULCQ=; b=KV7wxq7aHHr0GOjAui5ii7ro8D0WaLcVO8ONmbNnrdsIfH4ZfST404VbW32PURIswW 9joj8tlzzLGYzRe+yVqBHwZE2Kvfv5x8QcgdL2TTSLzaju5856zmQQDUZUXMF7ec6yEK u0DE1ZAqeDQKrcD7k8n932uIXNCnQp6ikCHOA=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697152029; x=1697756829; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=clHKP8hn0oLpy4Jh/617rCBiLmcBZjZtkYLXWnWULCQ=; b=JJCRCkfG9HB271tetqn+jibQO3XdnXVAFvwjMWbvy28+uRdwsuOi5MkysPAeZ8hBuT FOGP1jamqZKuz5QMWrhCxoJHJ9eBA/T+VF0v8U+I1sH5p1fNMUwidR5SfnvD7j9W5h57 Yu7HF6zdoPlv+RlTSNBiX10603QIYJLz1/OBzTKhS7p+WrsPCHEM3A5AGY3WyBo6wnND HzkDNuOXq8QKAg+I5Y+dQOWMYBlKIZ7/+u9Eq7q+zU4mjHNMh2X6hq5x/1CMmzeTyhtQ IHQebgMnmVjYsIzml+y6EsvmEXFjvNLvU2KqJDyTqHlDDgWR7htfsDNl13H3GAvT+JYF 2P3w==
X-Gm-Message-State: AOJu0Yx6CTTW7pkDiGJMnJ7TLDDiJnW7S4EHMjN/yDw7ZhDpWXNbIoR6 o0At2c7Pyf8TtqRa83ztp8Ltew==
X-Google-Smtp-Source: AGHT+IEW/gcAtvpnUKWJ8UXHPj+pVSQHW4DYTEeQ2uSBRwCbA5pIX2QwYcupGVn+R931hdurezHbeA==
X-Received: by 2002:a17:906:99c5:b0:9ae:3768:f0ce with SMTP id s5-20020a17090699c500b009ae3768f0cemr21787448ejn.0.1697152028599; Thu, 12 Oct 2023 16:07:08 -0700 (PDT)
Received: from smtpclient.apple ([74.122.52.94]) by smtp.gmail.com with ESMTPSA id u14-20020a170906c40e00b009920a690cd9sm11535888ejz.59.2023.10.12.16.07.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 Oct 2023 16:07:07 -0700 (PDT)
Content-Type: multipart/alternative; boundary="Apple-Mail-84F62053-7010-4D92-B2D7-7DB82700D549"
Content-Transfer-Encoding: 7bit
From: Paul Wouters <paul.wouters@aiven.io>
Mime-Version: 1.0 (1.0)
Date: Thu, 12 Oct 2023 19:06:52 -0400
Message-Id: <ECABA2DC-6511-42D0-A8F1-1D7A55CE8BDD@aiven.io>
References: <ac116eb5-97ee-4cd0-9ea8-2bcb2d3d5602@ri.se>
Cc: stefan.hristozov@eriptic.com, rikard.hoglund@ri.se, Göran Selander <goran.selander@ericsson.com>, Francesca Palombini <francesca.palombini@ericsson.com>, core@ietf.org
In-Reply-To: <ac116eb5-97ee-4cd0-9ea8-2bcb2d3d5602@ri.se>
To: Marco Tiloca <marco.tiloca@ri.se>
X-Mailer: iPhone Mail (21A360)
Archived-At: <https://mailarchive.ietf.org/arch/msg/core/YYHFc5BoEMGKDRqK9LVpQgc0PXw>
Subject: Re: [core] AD review of draft-ietf-core-oscore-edhoc-08
X-BeenThere: core@ietf.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: "Constrained RESTful Environments \(CoRE\) Working Group list" <core.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/core>, <mailto:core-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/core/>
List-Post: <mailto:core@ietf.org>
List-Help: <mailto:core-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/core>, <mailto:core-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 12 Oct 2023 23:07:15 -0000

Thanks, all looks good.

Paul


On Oct 12, 2023, at 16:51, Marco Tiloca <marco.tiloca@ri.se> wrote:

 Hi Paul,

Thanks a lot for your review! Please see in line below our detailed reply.

Based on your comments, we have prepared the PR #14 at [1].

If there is no objection, we plan to merge the PR and submit the result as version -09 soon.

Best,
/Marco

[1] https://github.com/core-wg/oscore-edhoc/pull/14" rel="nofollow">https://github.com/core-wg/oscore-edhoc/pull/14


On 2023-09-28 22:08, Paul Wouters wrote:
Hi,

Overall the document looks good. I have a few comments/nits below and one issue.

Issue:

         The request payload consists of the EDHOC connection identifier
         C_R encoded as per Section 3.3 of [I-D.ietf-lake-edhoc],
         concatenated with EDHOC message_3.

A last minute change in EDHOC was to encrypt C_R. It is unfortunate that
this now seems to send C_R in the clear again. Can this be avoided?

==>MT

TL;DR: per the EDHOC specification, the encrypted C_R is the one in EDHOC message_2. Instead, the plain C_R mentioned in the text is the one prepended to EDHOC message_3, both of which are conveyed in the CoAP payload. The latter C_R is not and cannot be encrypted by EDHOC.

The quoted text is part of the overview of EDHOC "as-is" and is aligned with draft-ietf-lake-edhoc, with no difference as to the prepending of C_R in EDHOC message_3 when transported in CoAP.

In fact, it is consistent with what is shown in Figure 18 at

https://datatracker.ietf.org/doc/html/draft-ietf-lake-edhoc-22#name-the-forward-message-flow" rel="nofollow">https://datatracker.ietf.org/doc/html/draft-ietf-lake-edhoc-22#name-the-forward-message-flow

when considering the forward message flow of EDHOC transported over CoAP. In that Figure 18, the payload of the second request includes EDHOC message_3 prepended by C_R.

Please note that the mentioned C_R in the CoAP request message is not encrypted by EDHOC, since:

* C_R is not part of EDHOC message_3 in itself; and

* C_R has to be prepended to EDHOC message_3, due to the message correlation properties of CoAP

The recently introduced encryption of C_R is for the C_R included in EDHOC message_2, in which case C_R is indeed part of the PLAINTEXT_2 processed when composing EDHOC message_2.

Also, please note that, irrespective of using the vanilla or the optimized workflow of EDHOC, C_R is later going to be repeatedly exposed in plain anyway when using OSCORE. That's because C_R is the OSCORE Sender ID of the CoAP Client (i.e., the EDHOC Initiator). Therefore, it is going to be included in the 'kid' field of the OSCORE Option in each OSCORE-protected CoAP request sent by the Client to the Server.

When discussing about encrypting C_R in the LAKE WG, the points above were also highlighted on the LAKE WG mailing list. In particular, please see:

https://mailarchive.ietf.org/arch/msg/lake/zTdTw7elW_al7D54DQWdKSVTIcg/" rel="nofollow">https://mailarchive.ietf.org/arch/msg/lake/zTdTw7elW_al7D54DQWdKSVTIcg/

As an attempt to clarify that Section 2 and its Figure 1 of the present document overview EDHOC as-is, we have made the following updates in Section 2:

OLD
> Appendix A.2 of [I-D.ietf-lake-edhoc] specifies how to transfer EDHOC over CoAP. That is, the EDHOC data (i.e., the EDHOC message possibly with a prepended connection identifier) are transported in the payload of CoAP requests and responses. The default, forward message flow of EDHOC consists in the CoAP client acting as Initiator and the CoAP server acting as Responder. Alternatively, the two roles can be reversed, as per the reverse message flow of EDHOC. In the rest of this document, EDHOC messages are considered to be transferred over CoAP.

NEW
> Appendix A.2 of [I-D.ietf-lake-edhoc] specifies how to transfer EDHOC over CoAP. That is, the EDHOC data (i.e., the EDHOC message possibly with a prepended connection identifier) are transported in the payload of CoAP requests and responses. The default, forward message flow of EDHOC consists in the CoAP client acting as Initiator and the CoAP server acting as Responder (see Appendix A.2.1 of [I-D.ietf-lake-edhoc]). Alternatively, the two roles can be reversed, as per the reverse message flow of EDHOC (see Appendix A.2.2 of [I-D.ietf-lake-edhoc]). In the rest of this document, EDHOC messages are considered to be transferred over CoAP.


OLD
> Figure 1 shows a CoAP client and a CoAP server running EDHOC as Initiator and Responder, respectively. That is, the client ...

NEW
> Figure 1 shows a CoAP client and a CoAP server running EDHOC as Initiator and Responder, respectively. In particular, it extends Figure 18 from Appendix A.2.1 of [I-D.ietf-lake-edhoc], by highlighting when the two peers perform EDHOC verification and establish the OSCORE Security Context, and by adding an exchange of OSCORE-protected CoAP messages after completing the EDHOC execution.
>
> That is, the client ...

<==


Comments:

        This optimization is desirable, since the number of protocol
        round trips influences the minimum number of flights,

I don't fully understand this sentence. I think it is trying to say that
doing two protocols fully sequencially one after the other causes more
roundtrips and thus more latency? Perhaps that can be formulated without
the use if "number of flights" ? (which to me is confusing, also because
actual flights talk about legs :)

==>MT

Trying to avoid "flights" altogether, we have instead focused on "messages exchanges" and "round trips", and have updated the text as follows.

OLD
> This optimization is desirable, since the number of protocol round trips influences the minimum number of flights, which in turn can have a substantial impact on the latency of conveying the first OSCORE request, when using certain radio technologies.
>
> Without this optimization, it is not possible, not even in theory, to achieve the minimum number of flights. This optimization makes it possible also in practice, since the last message of the EDHOC protocol can be made relatively small (see Section 1.2 of [I-D.ietf-lake-edhoc]), thus allowing additional OSCORE-protected CoAP data within target MTU sizes.

NEW
> This optimization is desirable, since the number of message exchanges can have a substantial impact on the latency of conveying the first OSCORE request, when using certain radio technologies.
>
> Without this optimization, it is not possible, not even in theory, to achieve the minimum number of round trips. This optimization makes it possible also in practice, since the message_3 of the EDHOC protocol can be made relatively small (see Section 1.2 of [I-D.ietf-lake-edhoc]), thus allowing additional OSCORE-protected CoAP data within target MTU sizes.

<==

       
        That is, the EDHOC data (referred to as "EDHOC messages")

Why not also just call it "EDHOC messages" in this document?

==>MT

They are two different things.

We consistently use "EDHOC data" to indicate the combination of the prepended connection identifier (if any) and the actual EDHOC message.

We have updated the sentence as follows:

OLD
> That is, the EDHOC data (referred to as "EDHOC messages") ...

NEW
> That is, the EDHOC data (i.e., the EDHOC message possibly with a prepended connection identifier) ...

<==


        Finally, the client sends a POST request to the same EDHOC
        resource used earlier to send EDHOC message_1.

This really is confusing to read. I initially read it as "send EDHOC message_1".
How about:

        Finally, the client sends a POST request to the same EDHOC
        resource used earlier when it sent EDHOC message_1.

==>MT

Thanks, we have fixed it as suggested.

<==


Section 3.2: Perhaps change the sentence in "Step 1" to:

        Compose EDHOC message_3 into EDHOC_MSG_3 as per Section 5.4.2 of [I-D.ietf-lake-edhoc].

so it properly introduces EDHOC_MSG_3 before its first use?

==>MT

Yes, good point. We have fixed it as suggested.

<==


        the server discontinues the protocol [...]

        the Initiator MUST discontinue the protocol [...]

We changed "discontinues the protocol" to "aborts the session" in the EDHOC document.
You don't mean discontinue to use the protocol defined in this RFC :)

==>MT

Indeed. We have changed the text to say "the server aborts the session" (in Section 3.3) and "the Initiator MUST abort the session" (in Section 4.1.3).

<==


        The server MUST NOT establish a new OSCORE Security Context from
        the present EDHOC session with the client, hence the CoAP response
        conveying the EDHOC error message is not protected with OSCORE.

I don't understand this sentence? Did you mean "as" instead of "hence" ?

==>MT

We really mean "hence". The order of event and their causal relation is:

- An OSCORE Security Context is not derived; hence
- The response transporting the EDHOC error message is not protected with OSCORE (as it cannot be).

In order to avoid confusion altogether, we simplified the sentence as follows:

NEW
> The server MUST NOT establish a new OSCORE Security Context from the present EDHOC session with the client. The CoAP response conveying the EDHOC error message is not protected with OSCORE.

<==


        The CoAP response conveying the EDHOC error message MUST have
        Content-Format set to application/edhoc+cbor-seq defined in
        Section 9.9 of [I-D.ietf-lake-edhoc].

There is no section 9.9. I think you mean Section 10.9 (just as Appendix A.2.3
does that reference)

==>MT

We have fixed the numbers of the referred sections from draft-ietf-lake-edhoc.

<==


       As per Section 3.3.2 of [I-D.ietf-lake-edhoc], when using the
        purely-sequential flow shown in Figure 1, the same C_R with
        value 0x01 would be encoded on the wire as the CBOR integer 1
        (0x01 in CBOR encoding), and prepended to EDHOC message_3 in
        the payload of the second EDHOC request.

I'm a bit confused by "on the wire" of C_R because EDHOC message_3
contains: AEAD( ID_CRED_I, Signature_or_MAC_3, EAD_3 )
Do you mean as part of CoAP?


==>MT

In short: yes, as part of CoAP.

Indeed EDHOC message_3 includes only AEAD( ID_CRED_I, Signature_or_MAC_3, EAD_3 ), but this does not contradict the quoted text.

In the vanilla workflow, C_R is prepended to EDHOC message_3, and indeed it is not part of EDHOC message_3 in itself.

Yet, due to the message correlation properties of CoAP, C_R has to be prepended to the EDHOC message_3 in the payload of the CoAP request of the forward message flow (see also Appendix A.2.1 of draft-ietf-lake-edhoc).

Therefore, C_R is on the wire, since it is part of the payload of the sent CoAP message.

<==


        The EDHOC Connection Identifier C_I is equal to the EDHOC
        Connection Identifier C_R specified in EDHOC message_2 (i.e.,
        after its decoding as per Section 3.3 of [I-D.ietf-lake-edhoc]).

Since C_R is now encrypted in EDHOC message_2, I guess "decoding" is no longer
the right word. After decrypting ?

==>MT

As a clarification, CIPHERTEXT_2 has to be decrypted first. After that, one retrieves from PLAINTEXT_2 the wire-encoding of C_R, which has to be decoded into its native, binary form.

In order to avoid confusion altogether, we have simplified the quoted paragraph in Section 4.1.3 and an analogous paragraph in Section 4.1.2 as follows:

OLD (Section 4.1.3)
> The EDHOC Connection Identifier C_I is equal to the EDHOC Connection Identifier C_R specified in EDHOC message_2 (i.e., after its decoding as per Section 3.3 of [I-D.ietf-lake-edhoc]).

NEW (Section 4.1.3)
> The EDHOC Connection Identifier C_I is equal to the EDHOC Connection Identifier C_R received in EDHOC message_2.


OLD (Section 4.1.2)
> The Responder MUST choose a C_R that is neither used in any current EDHOC session as this peer's EDHOC Connection Identifier, nor is equal to the EDHOC Connection Identifier C_I specified in the EDHOC message_1 of the present EDHOC session (i.e., after its decoding as per Section 3.3 of [I-D.ietf-lake-edhoc]), nor is ...

NEW (Section 4.1.2)
> The Responder MUST choose a C_R that is neither used in any current EDHOC session as this peer's EDHOC Connection Identifier, nor is equal to the EDHOC Connection Identifier C_I received in the EDHOC message_1 of the present EDHOC session, nor is ...

<==


        Section 9.10 of [I-D.ietf-lake-edhoc] registers the resource type
        "core.edhoc"

This should be Section 10.10.

==>MT

We have fixed the numbers of the referred sections from draft-ietf-lake-edhoc.

<==


        which is taken from the 'Label' column of the "EDHOC External
        Authorization Data" registry defined in Section 9.5 of
        [I-D.ietf-lake-edhoc].

Should be section 10.5. (Please check all section 9 references in the doc for update)

==>MT

We have fixed the numbers of the referred sections from draft-ietf-lake-edhoc.

<==


        by expanding their semantics and specifying admitted values.

What does "admitted" here mean? Maybe "specifying additional values" ?

==>MT

We have rephrased as follows:

> (Future documents may update the definition of the parameters 'ed-i', 'ed-r', and 'ed-comb-req', by expanding their semantics and specifying what they can take as value.)

<==



        the Change Controller is IESG,

I believe the IESG preference is to list IETF as change controller ?


==>MT

We have changed it to "IETF".

<==





nits:

Personal pet peeve: I dislike using +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
and prefer +-------+---------+---+-------------+-----+ style :)
I have also never seen the usage of open ended boxes, so I would change:

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|Ver| T |  TKL  |      Code     |          Message ID           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Token (if any, TKL bytes) ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Observe Option| OSCORE Option ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| EDHOC Option  | Other Options (if any) ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|1 1 1 1 1 1 1 1| Payload ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

to:

+---+---+-------+---------------+-------------------------------+
|Ver| T |  TKL  |      Code     |          Message ID           |
+---+---+-------+---------------+-------------------------------+
| Token (if any, TKL bytes)                                     ~
~                                                               ~
+---------------+-----------------------------------------------+
| Observe Option| OSCORE Option                                 ~
+---------------+                                               ~
~                                                               ~
+---------------+-----------------------------------------------+
| EDHOC Option  | Other Options (if any)                        ~
+---------------+                                               ~
~                                                               ~
+---------------+-----------------------------------------------+
|1 1 1 1 1 1 1 1| Payload                                       ~
+---------------+
~                                                               ~
+---------------------------------------------------------------+



==>MT

As also raised in

https://mailarchive.ietf.org/arch/msg/core/LBLmCFK_lY86iwlRGfAMWwQNNOw/" rel="nofollow">https://mailarchive.ietf.org/arch/msg/core/LBLmCFK_lY86iwlRGfAMWwQNNOw/

we have preferred to preserve the same style used since RFC 7252.

<==

Paul


-- 
Marco Tiloca
Ph.D., Senior Researcher

Phone: +46 (0)70 60 46 501

RISE Research Institutes of Sweden AB
Box 1263
164 29 Kista (Sweden)

Division: Digital Systems
Department: Computer Science
Unit: Cybersecurity

https://www.ri.se" rel="nofollow">https://www.ri.se
<OpenPGP_0xEE2664B40E58DA43.asc>