From nobody Mon Feb 15 12:33:28 2021
Return-Path: <rlb@ipv.sx>
X-Original-To: cfrg@ietfa.amsl.com
Delivered-To: cfrg@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1])
 by ietfa.amsl.com (Postfix) with ESMTP id 3FF993A1109
 for <cfrg@ietfa.amsl.com>; Mon, 15 Feb 2021 12:33:27 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: 0.004
X-Spam-Level: 
X-Spam-Status: No, score=0.004 tagged_above=-999 required=5
 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001,
 SPF_HELO_NONE=0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001]
 autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key)
 header.d=ipv-sx.20150623.gappssmtp.com
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 0TaAD_8-8gvE for <cfrg@ietfa.amsl.com>;
 Mon, 15 Feb 2021 12:33:24 -0800 (PST)
Received: from mail-qk1-x734.google.com (mail-qk1-x734.google.com
 [IPv6:2607:f8b0:4864:20::734])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by ietfa.amsl.com (Postfix) with ESMTPS id 2AACF3A1108
 for <cfrg@irtf.org>; Mon, 15 Feb 2021 12:33:23 -0800 (PST)
Received: by mail-qk1-x734.google.com with SMTP id b14so7601701qkk.0
 for <cfrg@irtf.org>; Mon, 15 Feb 2021 12:33:23 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=ipv-sx.20150623.gappssmtp.com; s=20150623;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=E1XV6TXcLhudNShOhBKpjZ5mtk8oWP+5US3t2/FCMf8=;
 b=tVqQ1KddMwFIgBSt4f+FrJFqUaUZy41U1p1yUT6iniahHZ7OLisbSW344BKDf/IIU4
 65O0SfBWxgYdHggn6e8a+klu4Yv0t0x93l8l0mpwiDZjoWa35dN+X5uhm6ILimV2gb/+
 UYFSX0J3XjqebYp/RBBqVWe1ezixY/8TJX/nCVADyS+xdysUyqEFDZeYPWtaMd6bpDGl
 daUvEoODKFyL3DUWfGH8iUhsuYhwqJKaHEv8SSiaNz9X2HaOldgLW8usYKVDQUmpA/cj
 /UI+2QtYLkD/YP9SBWXudip6W7I/tKAI630+YCrIF9qZOzhcwbc/FlPVzwMECzYgDWD2
 wMOQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=E1XV6TXcLhudNShOhBKpjZ5mtk8oWP+5US3t2/FCMf8=;
 b=GLQ30sOk5fkTG4UOqnspIF04hoIEL3hfhgauOmn9YjF2V3R9E0+IjH+fS+JsmThg0l
 whfyaXdoSUQO8FpB6q2GCCxaT9DzuQ3ieILm3cl84OY9GlFhEsk8Hr0MuBqJAFRbI0+0
 jwufBZnH6qlClUpoExksamDMBVrj79bC0TAn78dK4tVnMtpwTtxhxQjqYBD6CVL8Lvqv
 AVcKmwvQO7tkvU0EZU7GiN8Xi/FcHgYhGl4afCgcEEhdBSrtEXZETha4eEvRvVHHl/hb
 /b9ZEHZrFibr5zBK1vr6pgziQC1pleOpdioDBcWzwlIVQXIncJ7O9G26ZQ1EnGDhtWZ7
 OkuQ==
X-Gm-Message-State: AOAM530kVVUWn7lomgzkTfIJA6lRW1V/unpuWmxBtIHpXozmfk9S9qWz
 4vMjbEAEyUWn3LYHeR8/He9679Upyf1X5FbUWtPfZg==
X-Google-Smtp-Source: ABdhPJxDn2VUYmdKS+qtnTez5GFfR11eYHXo4ksJKQ8Ed9DuA5RZ7zkCZ0rG5YblHwLZzErseszf36eWP7iflBdheFg=
X-Received: by 2002:a37:4b52:: with SMTP id y79mr16482661qka.132.1613421202834; 
 Mon, 15 Feb 2021 12:33:22 -0800 (PST)
MIME-Version: 1.0
References: <c089c88b-c5f6-f228-31a3-fb4e97a436c8@lounge.org>
 <4FCD508B-0ECB-4F7B-B252-B92CDFBC5B8B@gmail.com>
 <1ded9ec0-4da1-981d-fedc-709ca301c166@lounge.org>
 <CAL02cgQCnb3BhOp1Qmsi1tN2j1Tx3p5_QCta=eBKvtH9hzApFg@mail.gmail.com>
 <51802415-536e-3d8c-1c1f-b7ff00be533e@lounge.org>
In-Reply-To: <51802415-536e-3d8c-1c1f-b7ff00be533e@lounge.org>
From: Richard Barnes <rlb@ipv.sx>
Date: Mon, 15 Feb 2021 15:33:07 -0500
Message-ID: <CAL02cgT3BA65dP9o+stB9PGvv-hRGU=_k-vhsWnuwMFU1LDpAg@mail.gmail.com>
To: Dan Harkins <dharkins@lounge.org>
Cc: Karthikeyan Bhargavan <karthik.bhargavan@gmail.com>,
 "cfrg@irtf.org" <cfrg@irtf.org>
Content-Type: multipart/alternative; boundary="000000000000ab212c05bb65e5f2"
Archived-At: <https://mailarchive.ietf.org/arch/msg/cfrg/3f9gAvSYBl4IWD6KOGEdqdAO6r4>
Subject: Re: [CFRG] Fixing the multi-shot API of HPKE
X-BeenThere: cfrg@irtf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Crypto Forum Research Group <cfrg.irtf.org>
List-Unsubscribe: <https://www.irtf.org/mailman/options/cfrg>,
 <mailto:cfrg-request@irtf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cfrg/>
List-Post: <mailto:cfrg@irtf.org>
List-Help: <mailto:cfrg-request@irtf.org?subject=help>
List-Subscribe: <https://www.irtf.org/mailman/listinfo/cfrg>,
 <mailto:cfrg-request@irtf.org?subject=subscribe>
X-List-Received-Date: Mon, 15 Feb 2021 20:33:27 -0000

--000000000000ab212c05bb65e5f2
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hi Dan,

Thanks for the suggested text.  I adapted it into the document in this PR:

https://github.com/cfrg/draft-irtf-cfrg-hpke/pull/209

Cheers,
--Richard

On Mon, Feb 15, 2021 at 1:33 PM Dan Harkins <dharkins@lounge.org> wrote:

>
>   Hi Richard,
>
> On 2/15/21 8:31 AM, Richard Barnes wrote:
>
> Hi Dan,
>
> HPKE is not intended to be a full network protocol; it is supposed to be
> embedded in an application that assures properties such as those you
> mention.  Section 8.6, "External Requirements / Non-Goals" [1] has some
> text on this.  If you think we can be clearer in these disclaimers,
> suggested text / PRs would be welcome.
>
>
>   Right, it's designed to be a fairly low-level primitive. Section 8.6 is
> describing the non-goals of HPKE. It's basically, "if you want this featu=
re
> you need to handle this on your own", which is perfectly understandable. =
No
> need to be clearer there.
>
>   But this is the other way around. This is an expectation that HPKE plac=
es
> on any high-level protocol that might want to use it. It might be nice to
> have a (sub-)section formally devoted to this instead of burying the
> requirement in a discussion of how the sequence number is managed inside =
of
> an opaque HPKE context where its importance could easily be missed.
>
>   Actually since this is an external requirement, you could make the titl=
e
> of
> 8.6 just be "External Requirements", make the current content of 8.6 be a
> sub-section 8.6.1 entitled "Non-Goals" and then make an 8.6.2 entitled
> "Requirements on Upper-Layer Protocol" that says this requirement formall=
y:
>
>     A high-level protocol that uses HPKE's stateful API MUST provide
>     for guaranteed in-order delivery of packets to ensure that all
>     ciphertexts are presented to ContextR.Open() in the order in which
>     they were generated by ContextS.Seal().
>
>     A high-level protocol MUST be able to detect packet loss and to
>     abandon any HPKE state that becomes unsynchronized as a result of
>     unrecoverable packet loss. Any packet number a high-level protocol
>     assigns to an HPKE message SHOULD be (part of) the AAD passed to
>     ContextS.Seal() and ContextR.Open() and it is the responsibility of
>     the high-level protocol to specify how that is accomplished.
>
>     A high-level protocol SHOULD provide a means of re-establishing
>     synchronized state in the event that contexts get hopelessly out
>     of sync. If this feature is provided it MUST NOT open the protocol
>     up to any additional attack-- that is, the only way an attacker can
>     induce parties to resynchronize is by dropping packets or otherwise
>     denying service.
>
> Something along those lines but in your voice.
>
>   But I still maintain that adding AES-SIV is the way to go :-)
>
>   regards,
>
>   Dan.
>
> --Richard
>
> [1] https://tools.ietf.org/html/draft-irtf-cfrg-hpke-07#section-8.6
>
>
> On Sat, Feb 13, 2021 at 7:29 AM Dan Harkins <dharkins@lounge.org> wrote:
>
>>
>>    Hi Karthik,
>>
>> On 2/13/21 3:10 AM, Karthikeyan Bhargavan wrote:
>> > Hi Dan,
>> >
>> > I don=E2=80=99t fully understand the problem you are alluding to.
>> >
>> >>     "It is up to the application to ensure that encryptions and
>> >>      decryptions are done in the proper sequence, so that encryption
>> >>      and decryption nonces align.=E2=80=9D
>> > The HPKE stateful API guarantees that nonces cannot be misused, even i=
f
>> you use AES-GCM or Chacha-Poly. (Of course, you could also add a SIV
>> ciphersuite.)
>> > Furthermore, it guarantees that the stream of plaintext messages
>> received by the decryptor is a prefix of the stream of plaintext message=
s
>> sent by the encryptor.
>>
>>    It's not an issue of misuse, it's an issue of the sender and
>> receiver contexts getting out of sync through entirely normal
>> network behavior and becoming unusable.
>>
>> > In the current design, if two ciphertexts are decrypted out-of-order,
>> both decryptions will fail.
>> > So the problem alluded to in the text above is one of functionality;
>> the application has to ensure (using some meta-data) that it is calling
>> decrypt in the right order.
>> > The application usually has to do something like this anyway to put th=
e
>> plaintext stream together.
>> >
>> > I do not see how using AES-GCM-SIV is going to solve the above issue;
>> yes, it would allow you to decrypt the plaintext in any order, but  the
>> HPKE receiver would not be able to authenticate the correct order.
>> > Am I missing something?
>>
>>    AES-GCM-SIV requires a nonce (although reuse is not tragic in the
>> way it is for GCM) so there still needs to be some guarantee that the
>> nonce plugged into the receiver is the same as the one plugged into
>> the sender when the ciphertext was created. This is a proposal for
>> AES-SIV (defined by Rogaway and Shrimpton) which can do deterministic
>> AEAD (it can also be passed a nonce to be more like a traditional AEAD
>> mode, albeit slower, but that's not what I'm proposing here). No nonce
>> so nothing to worry about getting out of order.
>>
>>    Regarding the correct order, for a streaming application yes that's
>> true. The correct order would still be needed and whatever technique
>> you use to ensure that decrypted packets get ordered correctly could
>> probably be used to ensure that packets are decrypted in order. But
>> there are other interesting applications of HPKE that are not streaming
>> and each message can be thought of as self-contained. Imagine a sensor
>> obtaining some environmental data and then sending it off to a server
>> for correlation and processing every <time slice>. It would be quite
>> easy for such a sensor and server to get their HPKE contexts out of
>> sync and that would be a real PITA.
>>
>>    regards,
>>
>>    Dan.
>>
>> > -Karthik
>> >
>> >
>> >
>> >> On 13 Feb 2021, at 00:29, Dan Harkins <dharkins@lounge.org> wrote:
>> >>
>> >>
>> >>    Hello again,
>> >>
>> >>    The HPKE spec defines a single shot API for doing things like
>> key-wrapping.
>> >> You pass in the recipient's public key and some plaintext and get bac=
k
>> a
>> >> ciphertext. And that's it. One and done.
>> >>
>> >>    There is also (what I'll call for lack of a better word) a
>> multi-shot API.
>> >> The idea here is that there's a single asymmetric crypto operation
>> involving
>> >> the recipient's pubic key to derive some state that resides in an
>> opaque HPKE
>> >> context and then multiple calls to encrypt distinct plaintexts. The
>> state
>> >> created includes a base nonce and a sequence number (initialized to
>> zero).
>> >> Each call to another encryption (decryption) increments the sequence
>> number
>> >> which is xor'd with the base nonce and passed to the AEAD algorithm.
>> The HPKE
>> >> APIs take a plaintext, and AAD, and produce a ciphertext, and vice
>> versa.
>> >>
>> >>    This multi-shot API is fine if your world is Guaranteed In Order
>> Delivery
>> >> of Packets but that's not the world we all live in. As such, it'll on=
ly
>> >> be a matter of time before the sender and receiver are out of sync. T=
he
>> >> HPKE draft alludes to this problem this way:
>> >>
>> >>
>> >>
>> >> Well that's a pain! One of the nice things about HPKE is that one
>> doesn't
>> >> need to worry about the nitty gritty of crypto state management
>> anymore,
>> >> it's all hidden. The API is nice and clean-- pass in a plaintext and
>> get a
>> >> ciphertext, pass in a ciphertext and get a plaintext.
>> >>
>> >>    If there was an AEAD mode that did not require a nonce it could be
>> used
>> >> in HPKE's multi-shot API without need for the application to manage
>> state
>> >> and guarantee the parties stay in sync. Thankfully there is such an
>> AEAD
>> >> mode: AES-SIV (RFC 5297).
>> >>
>> >>    When I brought this up earlier (and also on github) in the context
>> of
>> >> misuse resistance the response was, there's an export-only API that
>> will
>> >> give you a secret and you can go do any AEAD mode you feel like,
>> including
>> >> AES-SIV, issue closed.
>> >>
>> >>    While that is technically true, it applies equally to the AEAD
>> functions
>> >> that HPKE already defines-- you can export a secret and do AES-GCM-25=
6
>> >> outside of HPKE while managing the necessary state yourself. Yet HPKE
>> >> defines AEAD functions whose state resides in an opaque context so
>> there
>> >> is obviously value in having that functionality. I just want to get
>> that
>> >> value-- a clean, multi-shot API where I don't need to worry about
>> managing
>> >> state or guaranteeing people remain in sync-- for people who don't li=
ve
>> >> in the world of Guaranteed In Order Delivery of Packets.
>> >>
>> >>    So I'd like to ask the group whether they see value in having a
>> nonce-less
>> >> AEAD mode in HPKE. If so I'll be happy to resurrect the text changes =
I
>> >> proposed and will be happy to contribute test vectors from my HPKE
>> >> implementation which already does AES-SIV.
>> >>
>> >>    One issue is that there are different security properties for a
>> >> deterministic authenticated encryption scheme than for a probabilisti=
c
>> >> scheme. This is discussed in [1] and the security considerations woul=
d
>> >> have to mention this. But I don't see that as a formidable problem.
>> >>
>> >>    regards,
>> >>
>> >>    Dan.
>> >>
>> >> [1] Rogaway and Shrimpton, "Deterministic Authenticated Encryption",
>> >>      EUROCRYPT, 2006
>> >>
>> >> --
>> >> "The object of life is not to be on the side of the majority, but to
>> >> escape finding oneself in the ranks of the insane." -- Marcus Aureliu=
s
>> >>
>> >> _______________________________________________
>> >> CFRG mailing list
>> >> CFRG@irtf.org
>> >> https://www.irtf.org/mailman/listinfo/cfrg
>>
>> --
>> "The object of life is not to be on the side of the majority, but to
>> escape finding oneself in the ranks of the insane." -- Marcus Aurelius
>>
>> _______________________________________________
>> CFRG mailing list
>> CFRG@irtf.org
>> https://www.irtf.org/mailman/listinfo/cfrg
>>
>
> --
> "The object of life is not to be on the side of the majority, but to
> escape finding oneself in the ranks of the insane." -- Marcus Aurelius
>
>

--000000000000ab212c05bb65e5f2
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Hi Dan,</div><div><br></div><div>Thanks for the sugge=
sted text.=C2=A0 I adapted it into the document in this PR:</div><div><br><=
/div><div><a href=3D"https://github.com/cfrg/draft-irtf-cfrg-hpke/pull/209"=
>https://github.com/cfrg/draft-irtf-cfrg-hpke/pull/209</a></div><div><br></=
div><div>Cheers,</div><div>--Richard<br></div></div><br><div class=3D"gmail=
_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Mon, Feb 15, 2021 at 1:33 =
PM Dan Harkins &lt;<a href=3D"mailto:dharkins@lounge.org">dharkins@lounge.o=
rg</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margi=
n:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex=
">
 =20
   =20
 =20
  <div>
    <br>
    <tt>=C2=A0 Hi Richard,<br>
      <br>
    </tt>
    <div>On 2/15/21 8:31 AM, Richard Barnes
      wrote:<br>
    </div>
    <blockquote type=3D"cite">
     =20
      <div dir=3D"ltr">
        <div>Hi Dan,</div>
        <div><br>
        </div>
        <div>HPKE is not intended to be a full network protocol; it is
          supposed to be embedded in an application that assures
          properties such as those you mention.=C2=A0 Section 8.6, &quot;Ex=
ternal
          Requirements / Non-Goals&quot; [1] has some text on this.=C2=A0 I=
f you
          think we can be clearer in these disclaimers, suggested text /
          PRs would be welcome.</div>
      </div>
    </blockquote>
    <tt>=C2=A0<br>
      =C2=A0 Right, it&#39;s designed to be a fairly low-level primitive. S=
ection
      8.6 is<br>
      describing the non-goals of HPKE. It&#39;s basically, &quot;if you wa=
nt
      this feature<br>
      you need to handle this on your own&quot;, which is perfectly
      understandable. No<br>
      need to be clearer there.<br>
      <br>
      =C2=A0 But this is the other way around. This is an expectation that
      HPKE places<br>
      on any high-level protocol that might want to use it. It might be
      nice to<br>
      have a (sub-)section formally devoted to this instead of burying
      the<br>
      requirement in a discussion of how the sequence number is managed
      inside of<br>
      an opaque HPKE context where its importance could easily be
      missed.<br>
      <br>
      =C2=A0 Actually since this is an external requirement, you could make
      the title of<br>
      8.6 just be &quot;External Requirements&quot;, make the current conte=
nt of
      8.6 be a<br>
      sub-section 8.6.1 entitled &quot;Non-Goals&quot; and then make an 8.6=
.2
      entitled <br>
      &quot;Requirements on Upper-Layer Protocol&quot; that says this requi=
rement
      formally:<br>
      <br>
      =C2=A0=C2=A0=C2=A0 A high-level protocol that uses HPKE&#39;s statefu=
l API MUST
      provide<br>
      =C2=A0=C2=A0=C2=A0 for guaranteed in-order delivery of packets to ens=
ure that all<br>
      =C2=A0=C2=A0=C2=A0 ciphertexts are presented to ContextR.Open() in th=
e order in
      which<br>
      =C2=A0=C2=A0=C2=A0 they were generated by ContextS.Seal().<br>
      <br>
      =C2=A0=C2=A0=C2=A0 A high-level protocol MUST be able to detect packe=
t loss and
      to<br>
      =C2=A0=C2=A0=C2=A0 abandon any HPKE state that becomes unsynchronized=
 as a result
      of<br>
      =C2=A0=C2=A0=C2=A0 unrecoverable packet loss. Any packet number a hig=
h-level
      protocol<br>
      =C2=A0=C2=A0=C2=A0 assigns to an HPKE message SHOULD be (part of) the=
 AAD passed
      to<br>
      =C2=A0=C2=A0=C2=A0 ContextS.Seal() and ContextR.Open() and it is the
      responsibility of<br>
      =C2=A0=C2=A0=C2=A0 the high-level protocol to specify how that is acc=
omplished.<br>
      <br>
      =C2=A0=C2=A0=C2=A0 A high-level protocol SHOULD provide a means of
      re-establishing <br>
      =C2=A0=C2=A0=C2=A0 synchronized state in the event that contexts get =
hopelessly
      out<br>
      =C2=A0=C2=A0=C2=A0 of sync. If this feature is provided it MUST NOT o=
pen the
      protocol<br>
      =C2=A0=C2=A0=C2=A0 up to any additional attack-- that is, the only wa=
y an
      attacker can<br>
      =C2=A0=C2=A0=C2=A0 induce parties to resynchronize is by dropping pac=
kets or
      otherwise<br>
      =C2=A0=C2=A0=C2=A0 denying service. <br>
      <br>
      Something along those lines but in your voice.<br>
      <br>
      =C2=A0 But I still maintain that adding AES-SIV is the way to go :-)<=
br>
      <br>
      =C2=A0 regards,<br>
      <br>
      =C2=A0 Dan.<br>
      <br>
    </tt>
    <blockquote type=3D"cite">
      <div dir=3D"ltr">
        <div>--Richard<br>
        </div>
        <div><br>
        </div>
        <div>[1] <a href=3D"https://tools.ietf.org/html/draft-irtf-cfrg-hpk=
e-07#section-8.6" target=3D"_blank">https://tools.ietf.org/html/draft-irtf-=
cfrg-hpke-07#section-8.6</a></div>
        <div dir=3D"ltr"><br>
        </div>
        <div dir=3D"ltr"><br>
        </div>
        <div dir=3D"ltr">On Sat, Feb 13, 2021 at 7:29 AM Dan Harkins &lt;<a=
 href=3D"mailto:dharkins@lounge.org" target=3D"_blank">dharkins@lounge.org<=
/a>&gt;
          wrote:<br>
        </div>
        <div class=3D"gmail_quote">
          <blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8=
ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
            =C2=A0=C2=A0 Hi Karthik,<br>
            <br>
            On 2/13/21 3:10 AM, Karthikeyan Bhargavan wrote:<br>
            &gt; Hi Dan,<br>
            &gt;<br>
            &gt; I don=E2=80=99t fully understand the problem you are allud=
ing
            to.<br>
            &gt;<br>
            &gt;&gt;=C2=A0 =C2=A0 =C2=A0&quot;It is up to the application t=
o ensure that
            encryptions and<br>
            &gt;&gt;=C2=A0 =C2=A0 =C2=A0 decryptions are done in the proper=
 sequence,
            so that encryption<br>
            &gt;&gt;=C2=A0 =C2=A0 =C2=A0 and decryption nonces align.=E2=80=
=9D<br>
            &gt; The HPKE stateful API guarantees that nonces cannot be
            misused, even if you use AES-GCM or Chacha-Poly. (Of course,
            you could also add a SIV ciphersuite.)<br>
            &gt; Furthermore, it guarantees that the stream of plaintext
            messages received by the decryptor is a prefix of the stream
            of plaintext messages sent by the encryptor.<br>
            <br>
            =C2=A0=C2=A0 It&#39;s not an issue of misuse, it&#39;s an issue=
 of the sender
            and<br>
            receiver contexts getting out of sync through entirely
            normal<br>
            network behavior and becoming unusable.<br>
            <br>
            &gt; In the current design, if two ciphertexts are decrypted
            out-of-order, both decryptions will fail.<br>
            &gt; So the problem alluded to in the text above is one of
            functionality; the application has to ensure (using some
            meta-data) that it is calling decrypt in the right order.<br>
            &gt; The application usually has to do something like this
            anyway to put the plaintext stream together.<br>
            &gt;<br>
            &gt; I do not see how using AES-GCM-SIV is going to solve
            the above issue; yes, it would allow you to decrypt the
            plaintext in any order, but=C2=A0 the HPKE receiver would not b=
e
            able to authenticate the correct order.<br>
            &gt; Am I missing something?<br>
            <br>
            =C2=A0=C2=A0 AES-GCM-SIV requires a nonce (although reuse is no=
t
            tragic in the<br>
            way it is for GCM) so there still needs to be some guarantee
            that the<br>
            nonce plugged into the receiver is the same as the one
            plugged into<br>
            the sender when the ciphertext was created. This is a
            proposal for<br>
            AES-SIV (defined by Rogaway and Shrimpton) which can do
            deterministic<br>
            AEAD (it can also be passed a nonce to be more like a
            traditional AEAD<br>
            mode, albeit slower, but that&#39;s not what I&#39;m proposing
            here). No nonce<br>
            so nothing to worry about getting out of order.<br>
            <br>
            =C2=A0=C2=A0 Regarding the correct order, for a streaming appli=
cation
            yes that&#39;s<br>
            true. The correct order would still be needed and whatever
            technique<br>
            you use to ensure that decrypted packets get ordered
            correctly could<br>
            probably be used to ensure that packets are decrypted in
            order. But<br>
            there are other interesting applications of HPKE that are
            not streaming<br>
            and each message can be thought of as self-contained.
            Imagine a sensor<br>
            obtaining some environmental data and then sending it off to
            a server<br>
            for correlation and processing every &lt;time slice&gt;. It
            would be quite<br>
            easy for such a sensor and server to get their HPKE contexts
            out of<br>
            sync and that would be a real PITA.<br>
            <br>
            =C2=A0=C2=A0 regards,<br>
            <br>
            =C2=A0=C2=A0 Dan.<br>
            <br>
            &gt; -Karthik<br>
            &gt;<br>
            &gt;<br>
            &gt;<br>
            &gt;&gt; On 13 Feb 2021, at 00:29, Dan Harkins &lt;<a href=3D"m=
ailto:dharkins@lounge.org" target=3D"_blank">dharkins@lounge.org</a>&gt; wr=
ote:<br>
            &gt;&gt;<br>
            &gt;&gt;<br>
            &gt;&gt;=C2=A0 =C2=A0 Hello again,<br>
            &gt;&gt;<br>
            &gt;&gt;=C2=A0 =C2=A0 The HPKE spec defines a single shot API f=
or
            doing things like key-wrapping.<br>
            &gt;&gt; You pass in the recipient&#39;s public key and some
            plaintext and get back a<br>
            &gt;&gt; ciphertext. And that&#39;s it. One and done.<br>
            &gt;&gt;<br>
            &gt;&gt;=C2=A0 =C2=A0 There is also (what I&#39;ll call for lac=
k of a
            better word) a multi-shot API.<br>
            &gt;&gt; The idea here is that there&#39;s a single asymmetric
            crypto operation involving<br>
            &gt;&gt; the recipient&#39;s pubic key to derive some state tha=
t
            resides in an opaque HPKE<br>
            &gt;&gt; context and then multiple calls to encrypt distinct
            plaintexts. The state<br>
            &gt;&gt; created includes a base nonce and a sequence number
            (initialized to zero).<br>
            &gt;&gt; Each call to another encryption (decryption)
            increments the sequence number<br>
            &gt;&gt; which is xor&#39;d with the base nonce and passed to
            the AEAD algorithm. The HPKE<br>
            &gt;&gt; APIs take a plaintext, and AAD, and produce a
            ciphertext, and vice versa.<br>
            &gt;&gt;<br>
            &gt;&gt;=C2=A0 =C2=A0 This multi-shot API is fine if your world=
 is
            Guaranteed In Order Delivery<br>
            &gt;&gt; of Packets but that&#39;s not the world we all live in=
.
            As such, it&#39;ll only<br>
            &gt;&gt; be a matter of time before the sender and receiver
            are out of sync. The<br>
            &gt;&gt; HPKE draft alludes to this problem this way:<br>
            &gt;&gt;<br>
            &gt;&gt;<br>
            &gt;&gt;<br>
            &gt;&gt; Well that&#39;s a pain! One of the nice things about
            HPKE is that one doesn&#39;t<br>
            &gt;&gt; need to worry about the nitty gritty of crypto
            state management anymore,<br>
            &gt;&gt; it&#39;s all hidden. The API is nice and clean-- pass
            in a plaintext and get a<br>
            &gt;&gt; ciphertext, pass in a ciphertext and get a
            plaintext.<br>
            &gt;&gt;<br>
            &gt;&gt;=C2=A0 =C2=A0 If there was an AEAD mode that did not re=
quire a
            nonce it could be used<br>
            &gt;&gt; in HPKE&#39;s multi-shot API without need for the
            application to manage state<br>
            &gt;&gt; and guarantee the parties stay in sync. Thankfully
            there is such an AEAD<br>
            &gt;&gt; mode: AES-SIV (RFC 5297).<br>
            &gt;&gt;<br>
            &gt;&gt;=C2=A0 =C2=A0 When I brought this up earlier (and also =
on
            github) in the context of<br>
            &gt;&gt; misuse resistance the response was, there&#39;s an
            export-only API that will<br>
            &gt;&gt; give you a secret and you can go do any AEAD mode
            you feel like, including<br>
            &gt;&gt; AES-SIV, issue closed.<br>
            &gt;&gt;<br>
            &gt;&gt;=C2=A0 =C2=A0 While that is technically true, it applie=
s
            equally to the AEAD functions<br>
            &gt;&gt; that HPKE already defines-- you can export a secret
            and do AES-GCM-256<br>
            &gt;&gt; outside of HPKE while managing the necessary state
            yourself. Yet HPKE<br>
            &gt;&gt; defines AEAD functions whose state resides in an
            opaque context so there<br>
            &gt;&gt; is obviously value in having that functionality. I
            just want to get that<br>
            &gt;&gt; value-- a clean, multi-shot API where I don&#39;t need
            to worry about managing<br>
            &gt;&gt; state or guaranteeing people remain in sync-- for
            people who don&#39;t live<br>
            &gt;&gt; in the world of Guaranteed In Order Delivery of
            Packets.<br>
            &gt;&gt;<br>
            &gt;&gt;=C2=A0 =C2=A0 So I&#39;d like to ask the group whether =
they see
            value in having a nonce-less<br>
            &gt;&gt; AEAD mode in HPKE. If so I&#39;ll be happy to resurrec=
t
            the text changes I<br>
            &gt;&gt; proposed and will be happy to contribute test
            vectors from my HPKE<br>
            &gt;&gt; implementation which already does AES-SIV.<br>
            &gt;&gt;<br>
            &gt;&gt;=C2=A0 =C2=A0 One issue is that there are different sec=
urity
            properties for a<br>
            &gt;&gt; deterministic authenticated encryption scheme than
            for a probabilistic<br>
            &gt;&gt; scheme. This is discussed in [1] and the security
            considerations would<br>
            &gt;&gt; have to mention this. But I don&#39;t see that as a
            formidable problem.<br>
            &gt;&gt;<br>
            &gt;&gt;=C2=A0 =C2=A0 regards,<br>
            &gt;&gt;<br>
            &gt;&gt;=C2=A0 =C2=A0 Dan.<br>
            &gt;&gt;<br>
            &gt;&gt; [1] Rogaway and Shrimpton, &quot;Deterministic
            Authenticated Encryption&quot;,<br>
            &gt;&gt;=C2=A0 =C2=A0 =C2=A0 EUROCRYPT, 2006<br>
            &gt;&gt;<br>
            &gt;&gt; -- <br>
            &gt;&gt; &quot;The object of life is not to be on the side of t=
he
            majority, but to<br>
            &gt;&gt; escape finding oneself in the ranks of the insane.&quo=
t;
            -- Marcus Aurelius<br>
            &gt;&gt;<br>
            &gt;&gt; _______________________________________________<br>
            &gt;&gt; CFRG mailing list<br>
            &gt;&gt; <a href=3D"mailto:CFRG@irtf.org" target=3D"_blank">CFR=
G@irtf.org</a><br>
            &gt;&gt; <a href=3D"https://www.irtf.org/mailman/listinfo/cfrg"=
 rel=3D"noreferrer" target=3D"_blank">https://www.irtf.org/mailman/listinfo=
/cfrg</a><br>
            <br>
            -- <br>
            &quot;The object of life is not to be on the side of the
            majority, but to<br>
            escape finding oneself in the ranks of the insane.&quot; --
            Marcus Aurelius<br>
            <br>
            _______________________________________________<br>
            CFRG mailing list<br>
            <a href=3D"mailto:CFRG@irtf.org" target=3D"_blank">CFRG@irtf.or=
g</a><br>
            <a href=3D"https://www.irtf.org/mailman/listinfo/cfrg" rel=3D"n=
oreferrer" target=3D"_blank">https://www.irtf.org/mailman/listinfo/cfrg</a>=
<br>
          </blockquote>
        </div>
      </div>
    </blockquote>
    <br>
    <pre cols=3D"72">--=20
&quot;The object of life is not to be on the side of the majority, but to
escape finding oneself in the ranks of the insane.&quot; -- Marcus Aurelius=
</pre>
  </div>

</blockquote></div>

--000000000000ab212c05bb65e5f2--

