Re: [Cfrg] Second RGLC on draft-irtf-cfrg-hpke

Richard Barnes <rlb@ipv.sx> Mon, 31 August 2020 19:19 UTC

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 534883A18F3 for <cfrg@ietfa.amsl.com>; Mon, 31 Aug 2020 12:19:57 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.896
X-Spam-Level:
X-Spam-Status: No, score=-1.896 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, 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=unavailable 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 HguYLMvI7X4i for <cfrg@ietfa.amsl.com>; Mon, 31 Aug 2020 12:19:55 -0700 (PDT)
Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com [IPv6:2607:f8b0:4864:20::730]) (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 942113A18F2 for <cfrg@irtf.org>; Mon, 31 Aug 2020 12:19:55 -0700 (PDT)
Received: by mail-qk1-x730.google.com with SMTP id n129so7240900qkd.6 for <cfrg@irtf.org>; Mon, 31 Aug 2020 12:19:55 -0700 (PDT)
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=5UUtpvqpKg14egraIZLznBM5odBiF53xB1AIvi2gVaI=; b=szW5Fi7azvalf5sNJ5nSbmeltKAUVfdLsR+YmlXc0DYLB4muweZnR//oA8l5TgAlzt odWAlhx7Wv0u81n4qVWEnIWHMt2M4C0HbtKnWl+lJel34t1brv42wL13Xd+DGGpfUWQu ITIVkRp365lCELG7v6v6qwMB+e33g0HR527qVlv5+nLRvNsU/TA6YSCUzLJbapA1ueQu C7GSTHeoFysjSr+yv+qV+4AB916CKHhNj6ovCwjNLfSRbRSM74R3JzFteg5dt6MCTdiS 8d2VMzAYVtfgMWZHhtNg45OcH+EVYlIxICv+KChxYQ3G7BEIVmyWlxAMl28OF2+WpM2V Zlug==
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=5UUtpvqpKg14egraIZLznBM5odBiF53xB1AIvi2gVaI=; b=iGtFhWydViRFXxecigqe6HE8lfRi/lMRZVkzbodunp3wWC+Yohb/1mA69CJxHd0Tig 0B7E6SNtD/mXtRdODcO6OTO1aX80EUXKlNttVekzlBNIW87ByyNlrJXfJBD1BgTP2a9X uMxGtxPb1+7NrbmrM4ZN5ptEFB2ODUsP+Rg16ssHXvKN181Y/TgnA9uO8XpnJDNu+wZc OO9ADdLpVHMdf5L1xXb+BpVhnU2tId/wahhWWzt1+J3syBb6pBM8YKkSP0OIAvYXICas MpqwuegSz93ms2tKjItCcM5Clge1L2F7y8qUWixL3dflAs5kqL5JsXqo04o/ESYwYy/X mnrg==
X-Gm-Message-State: AOAM5304l5aMRsh439faZTM5LsZjZIYgdl0FdNV95lT6HpQBf6er+5/U QVp6sQJn05AonpIN39dzXqLzOp8KAzLE50KoSasR1w==
X-Google-Smtp-Source: ABdhPJyFpjsn1fpehjl16/kz4QM7IzpoAUnfRNQRCG87/I02Ek2RyA2jkqiHMiH07JYMyUf3WhJpaDAU8RJU56z/X5I=
X-Received: by 2002:a37:8287:: with SMTP id e129mr2809669qkd.132.1598901593562; Mon, 31 Aug 2020 12:19:53 -0700 (PDT)
MIME-Version: 1.0
References: <CAMr0u6k5Yx1i6KmdZVvBmonQHPDT_3+tWNTdJkpyLLRrwWuLfg@mail.gmail.com> <CAOgPGoCsL3tuJMSs4Twn0iiZ_BecvbKyCpmN+fqFKU+C732x9A@mail.gmail.com> <CAG2Zi22VPwRFh5ZNJ9sNsu52X_dkxUV5=1Mt99zwrHPCtdkRbQ@mail.gmail.com>
In-Reply-To: <CAG2Zi22VPwRFh5ZNJ9sNsu52X_dkxUV5=1Mt99zwrHPCtdkRbQ@mail.gmail.com>
From: Richard Barnes <rlb@ipv.sx>
Date: Mon, 31 Aug 2020 15:19:24 -0400
Message-ID: <CAL02cgR5Rs4-mZ5ytdCSW=Tu3cOC657RROhLFzzvuXAO6LBjPQ@mail.gmail.com>
To: Christopher Patton <cpatton=40cloudflare.com@dmarc.ietf.org>
Cc: Joseph Salowey <joe@salowey.net>, CFRG <cfrg@irtf.org>, cfrg-chairs@ietf.org
Content-Type: multipart/alternative; boundary="00000000000083f55d05ae31499a"
Archived-At: <https://mailarchive.ietf.org/arch/msg/cfrg/vlSC7incYKxKTMAMY1gD5p4EkKE>
Subject: Re: [Cfrg] Second RGLC on draft-irtf-cfrg-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, 31 Aug 2020 19:19:57 -0000

Hi Chris,

Couple responses inline.

On Mon, Aug 31, 2020 at 1:27 PM Christopher Patton <cpatton=
40cloudflare.com@dmarc.ietf.org> wrote:

>
> In various places, e.g., 'KeySchedule()' in Section 5.1, value "" is used
> as the
> salt for KDF extraction. I'm wondering if implementations might
> misinterpret
> this. I read "" as 'the empty string', but the correct interpretation
> might be
> 'nil', i.e., 'None' in Python or 'NULL' in C. The HKDF spec defines the
> salt as
> follows: 'optional salt value (a non-secret random value); if not
> provided, it
> is set to a string of HashLen zeros.' I think the intention is to
> interpret ""
> as 'nil', i.e., no salt, but the empty string is certainly a valid salt for
> HKDF, since the extraction function is well-defined on this input. A
> 0-length
> salt might not be safe choice in terms of security, however.
>

I've been writing C++ lately, so I'll contribute the following:

auto salt = std::optional<std::vector<uint8_t>>(std::nullopt); // or...
auto salt = std::vector<uint8_t>{};

If you look at the HKDF and HMAC specs, and it turns out that it doesn't
matter.  HKDF replaces a nullopt salt with exactly the same thing that HMAC
expands a zero-length key to, namely "0" * block_size (in Python
notation).  In fact, any all-zero salt of a length up to the block size
would have the same result.

I would actually prefer to keep this as "zero-length octet string" and
*not* "not provided".  In the short run, it doesn't matter, as noted
above.  In the longer run, for some hypothetical future KDF, it means that
the new KDF doesn't need to have std::optional<T> semantics, it just needs
to operate byte strings.

So I think the spec is correct as it is.  If there are places where it is
implied that a salt is not provided, we should clarify that one is, and
that it is the zero-length octet string.



>
> Section 5.2
>
> I think the HPKE uses the term "nonce" incorrectly, since it's not a
> "Number
> that's used ONCE". In fact, it's used every time the "Seal()" or "Open()"
> operation is run. What's called a "nonce" here is usually called the
> "initialization vector" elsewhere: in TLS 1.3 for example, the "nonce" is
> the
> initialization vector XORed with a sequence number.
>

Agreed.  I assume something like "base_nonce" would work?

--Richard





>
> On Mon, Aug 31, 2020 at 9:14 AM Joseph Salowey <joe@salowey.net> wrote:
>
>>
>>
>> On Sun, Aug 16, 2020 at 1:51 AM Stanislav V. Smyshlyaev <
>> smyshsv@gmail.com> wrote:
>>
>>> Dear CFRG participants,
>>>
>>> This message starts a second 2-week RGLC on "Hybrid Public Key
>>> Encryption" (draft-irtf-cfrg-hpke-05), that will end on August 31st.
>>> See https://datatracker.ietf.org/doc/draft-irtf-cfrg-hpke/ for the
>>> latest version of the draft.
>>>
>>> We are having the second RGLC because we didn't have much feedback
>>> during the first RGLC and because we have obtained two new Crypto Panel
>>> reviews:
>>>
>>> https://mailarchive.ietf.org/arch/msg/crypto-panel/Ol1Mm8JUpmgapgq8ppnBQQSlEkE/
>>> https://mailarchive.ietf.org/arch/msg/cfrg/7zhOHPFkCyZC00xLZnsEBT3o6ZU/
>>>
>>> Please send your comments, as well as expression of support to publish
>>> as an RFC (or possible reasons for not doing so) in reply to this message
>>> or directly to CFRG chairs.
>>>
>>>
>> [Joe] I have reviewed this draft and I believe it is ready for
>> publication.
>>
>>
>>
>>> Regards,
>>> Stanislav, Nick and Alexey
>>> _______________________________________________
>>> Cfrg mailing list
>>> Cfrg@irtf.org
>>> https://www.irtf.org/mailman/listinfo/cfrg
>>>
>> _______________________________________________
>> Cfrg mailing list
>> Cfrg@irtf.org
>> https://www.irtf.org/mailman/listinfo/cfrg
>>
> _______________________________________________
> Cfrg mailing list
> Cfrg@irtf.org
> https://www.irtf.org/mailman/listinfo/cfrg
>