Re: [MLS] Message Protection

"Alexey Ermishkin" <scratch@virgilsecurity.com> Fri, 29 June 2018 07:39 UTC

Return-Path: <scratch@virgilsecurity.com>
X-Original-To: mls@ietfa.amsl.com
Delivered-To: mls@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id B6244130E6A for <mls@ietfa.amsl.com>; Fri, 29 Jun 2018 00:39:11 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.901
X-Spam-Level:
X-Spam-Status: No, score=-1.901 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, SPF_PASS=-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 4mxcxh_co1-E for <mls@ietfa.amsl.com>; Fri, 29 Jun 2018 00:39:09 -0700 (PDT)
Received: from VirgilSecurity.com (mail.virgilsecurity.com [199.58.211.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 9E84A130E09 for <mls@ietf.org>; Fri, 29 Jun 2018 00:39:08 -0700 (PDT)
Received: from BIGONE (unknown [176.226.241.68]) by VirgilSecurity.com (Postfix) with ESMTPSA id C8E9C105AA9916; Fri, 29 Jun 2018 03:39:06 -0400 (EDT)
From: Alexey Ermishkin <scratch@virgilsecurity.com>
To: 'Martin Thomson' <martin.thomson@gmail.com>, 'Katriel Cohn-Gordon' <me@katriel.co.uk>
Cc: mls@ietf.org
References: <CAL02cgREuhjySYZXmhaE3RuF3fZ5iwCgyW2ChtgwPYhDgdaYUQ@mail.gmail.com> <11392542-5C22-4033-99F6-009F066F48DD@vigilsec.com> <CABkgnnVZMNhrSE0mL7-yehuoR-uE-Kj3zZC9nqRY4zHE2gmVPg@mail.gmail.com> <640CFF9E-5231-4188-888A-CAB4376393F6@vigilsec.com> <1530198719.3129780.1423592624.575CB8EA@webmail.messagingengine.com> <CABkgnnV81G0umQ91MFXfd3WhMA6WUJZmjUaL6=KGC4kpC3k8CQ@mail.gmail.com>
In-Reply-To: <CABkgnnV81G0umQ91MFXfd3WhMA6WUJZmjUaL6=KGC4kpC3k8CQ@mail.gmail.com>
Date: Fri, 29 Jun 2018 12:39:04 +0500
Message-ID: <01e701d40f7c$430f3b20$c92db160$@virgilsecurity.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Mailer: Microsoft Outlook 16.0
Thread-Index: AQLM+wAwts1qVAaFZnL+MDvDWV6A7AFj57CLAgaUFXIB7TBkbAEN949wAmCsBOaiPsZREA==
Content-Language: ru
Archived-At: <https://mailarchive.ietf.org/arch/msg/mls/O6UlDdEKnFkTBaYPZpr6bPJUquU>
Subject: Re: [MLS] Message Protection
X-BeenThere: mls@ietf.org
X-Mailman-Version: 2.1.26
Precedence: list
List-Id: Messaging Layer Security <mls.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/mls>, <mailto:mls-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/mls/>
List-Post: <mailto:mls@ietf.org>
List-Help: <mailto:mls-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/mls>, <mailto:mls-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 29 Jun 2018 07:39:12 -0000

Hello, Alex here.

Thanks for the comments, my reply below:

Sorry for the typo, Contant == Constant. It's purely for domain separation.

I'm not sure if nonce should be also derived as keys will be unique and used
only once. It does not seem to affect security in either way. Signal is also
using zero nonces for one time keys.


As stated in the PR, each message includes 2 counters:
1) PN. Number of messages in previous epoch (can be zero)
2) N. Message number in the current epoch.

Both of them are under AAD

I think I'll add couple of amends and make a proper PR so that we could
start a proper dialogue there


-----Original Message-----
From: MLS <mls-bounces@ietf.org> On Behalf Of Martin Thomson
Sent: Friday, June 29, 2018 11:37 AM
To: Katriel Cohn-Gordon <me@katriel.co.uk>
Cc: mls@ietf.org; scratch@virgilsecurity.com
Subject: Re: [MLS] Message Protection

A few comments here (I'd comment on a PR if one existed :)

Is "Contant" supposed to be the content of the message, a constant, or
something else?  Is "Msg" a label in the sense of the label passed to HKDF
in TLS 1.3, or the the content of the message?  Assuming the former, a 255
octet limit is probably plenty.  You probably don't want to use the
plaintext of the message for key derivation; then you won't be able to read
messages out of order.

Your PR-in-progress seems to imply that one use of HKDF is used.  It might
be best to have three derivations: one for the next key, one for the key,
and another for the nonce.

You don't seem to include the number of messages from the previous epoch in
the counter.  Is this just under the AAD?  What happens if an endpoint
doesn't send any messages in a given epoch?  How is the count of messages
from the previous epoch protected?

(Sorry, too many questions.  I'm sure that you'll sort most of these out.)
On Fri, Jun 29, 2018 at 1:12 AM Katriel Cohn-Gordon <me@katriel.co.uk>
wrote:
>
> I've been chatting with Alexey at Virgil Security, who has started work on
a PR [1] to add this form of key separation.
>
> I think we all liked this design; shall we figure out exactly how it
works? I like the idea of symmetric key chains so that each message has a
separate encryption key, as in Signal; that requires N and PN counters in
the header to figure out which key to use, which I guess should go into the
authenticated data.
>
> Note that this means that each message key is used once, which helps guard
against nonce reuse.
>
> best,
> Katriel
>
>   [1] 
> https://github.com/ekr/mls-protocol/compare/master...Scratch-net:maste
> r
>
> On Thu, 28 Jun 2018, at 3:38 PM, Russ Housley wrote:
> > Martin:
> >
> > Each sender using a separate key seems pretty easy.  The key can be 
> > derived using the sender's position in the key or any other unique 
> > identifier that comes natural in the messaging protocol.
> >
> > Russ
> >
> >
> > > On Jun 27, 2018, at 6:12 PM, Martin Thomson <martin.thomson@gmail.com>
wrote:
> > >
> > > I was thinking that the nonce generation aspect would be worth 
> > > looking into as well.  If you crib from the TLS design, maybe you 
> > > could have per-participant keys so that each can be independently 
> > > responsible for ensuring nonce-uniqueness.  Then they can use 
> > > counters to avoid nonce reuse if they so choose.  Otherwise, I was 
> > > tempted to suggest AES-SIV or another nonce-reuse-resistant 
> > > scheme, but there are fewer of those available than straight up AEADs.
> > > On Thu, Jun 28, 2018 at 7:36 AM Russ Housley <housley@vigilsec.com>
wrote:
> > >>
> > >>
> > >>
> > >>> On Jun 26, 2018, at 8:38 PM, Richard Barnes <rlb@ipv.sx> wrote:
> > >>>
> > >>> Hey all,
> > >>>
> > >>> One of the things we kind of waved our hands about in the charter
and current protocol draft is message protection.  That is, the idea of
specifying a concrete syntax for using the keys we negotiate using MLS to
actually protect content.
> > >>>
> > >>> This is a simpler problem than key exchange (since you've already
established a group key), but it still has some nuances that matter to the
overall security story, so it seems worth writing some things down:
> > >>>
> > >>> - Content encapsulation (e.g., what nonces / AAD you use with 
> > >>> AEAD)
> > >>> - Key schedule, i.e., how message keys are derived from the 
> > >>> group key
> > >>> - ACK / NACK / replay
> > >>> - Transcript integrity (?)
> > >>> - Expiration times (?)
> > >>>
> > >>> What's missing here?
> > >>
> > >> If the tree produces a key and an identifier for that key, then the
protocol is straightforward.
> > >>
> > >> The key identifier could be derived from the key itself so that
anyone that knows the key also knows the identifier.
> > >>
> > >>        prk = HKDF-Extract('mls-key-id' | tree-identifier, key)
> > >>
> > >>        keyid = HKDF-Expand(prk, '', sizeof(keyid))
> > >>
> > >> Russ
> > >>
> > >> _______________________________________________
> > >> MLS mailing list
> > >> MLS@ietf.org
> > >> https://www.ietf.org/mailman/listinfo/mls
> >
> > _______________________________________________
> > MLS mailing list
> > MLS@ietf.org
> > https://www.ietf.org/mailman/listinfo/mls
>
> _______________________________________________
> MLS mailing list
> MLS@ietf.org
> https://www.ietf.org/mailman/listinfo/mls

_______________________________________________
MLS mailing list
MLS@ietf.org
https://www.ietf.org/mailman/listinfo/mls