Re: [Cfrg] Reviewing draft-irtf-cfrg-voprf-01

Alex Davidson <alex.davidson92@gmail.com> Fri, 26 July 2019 09:22 UTC

Return-Path: <alex.davidson92@gmail.com>
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 54F2A1202E8 for <cfrg@ietfa.amsl.com>; Fri, 26 Jul 2019 02:22:32 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.747
X-Spam-Level:
X-Spam-Status: No, score=-1.747 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=no autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.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 OS2oZ5SW5nww for <cfrg@ietfa.amsl.com>; Fri, 26 Jul 2019 02:22:30 -0700 (PDT)
Received: from mail-vs1-xe32.google.com (mail-vs1-xe32.google.com [IPv6:2607:f8b0:4864:20::e32]) (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 B333A1202C5 for <cfrg@irtf.org>; Fri, 26 Jul 2019 02:22:29 -0700 (PDT)
Received: by mail-vs1-xe32.google.com with SMTP id m23so35670691vso.1 for <cfrg@irtf.org>; Fri, 26 Jul 2019 02:22:29 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=fy4fP/KQWvLbJnaOkGQLagip4tS5DARKjtd42DxP79E=; b=Nk8KuqnaIy6jkUe0kZ8JnVR7MU80WHqA4vAzJcLwpncBfxsikGZUhU5QeQSYCEl3WK DJA5B4fb7nsY7teLFa/IBIQ/8LT7fQcZkhpd/FRKSi5mhWa6bUTJEJzrbcGkL1K41GEQ bCMJya7bdQPvfmWaZKZTTNTK1eRpMJSsv5E18Lb095c2XkiHzySfpQmKwRSmgkn1lJGS rVifGOz96dgmyaABbsMWVXj22xgdgTxdlbg2Bfp65Q3BOj9IeKyQIwjxVEdmhB6UAsga 0XtXJWdQwAKYBUyHYTDMcgsdl3G8lMLwgnEzmU6dp+l65692CW1NWPqvyTI+SAy8se9L ybNg==
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=fy4fP/KQWvLbJnaOkGQLagip4tS5DARKjtd42DxP79E=; b=PRc6Ll1vXsYIuHcg0wH66yUxEV72CAlMWi5GhGlGlLiS0qRX6qKAI8+wbJaL2NG2Bj JjDhp8YEnTt9aknU6eYbHqzt7MPQxnDii228z11vpE13v1U5KF9zJGQrnHqZnAa6+t0i 1/4dY1/yewmR9BKVdB/4dR+s2P7pOsf/bEAk034ha8TSqmtSsx71WUBdeN1pznuL9ZQh 1XefDlXhpLWTmFX9K4yAmCulfp1zIX7u9IlmtTuo4hcXOON5ok4hONllaWyTqfraDcZy x48TTtNKnbcaV5KiSWGkpxq0saRHow68VHkKQRA7MYpREDtg0ceoM4n8M9b2+BQr5/O7 8lDw==
X-Gm-Message-State: APjAAAU/lReXVhM0f5sHLxFVUF72WE6SfEvgSmDaWfU0XWbhcIBFgjaJ FdTZfCNTySSCIs9a+6HfpiuAISREKBBdqVtAeoNJaVU=
X-Google-Smtp-Source: APXvYqyI0j38ZuVlo1khC8Jtbi+MVKZgPdqWM88bzwCIxKD3iHvCcA7KMyKB3Y3JsJgxmbteDlXV4taDb+0C9Vy31d8=
X-Received: by 2002:a67:694f:: with SMTP id e76mr5418005vsc.77.1564132948685; Fri, 26 Jul 2019 02:22:28 -0700 (PDT)
MIME-Version: 1.0
References: <CAPC=aNUMKxVKuhAKtN4S-7z_CqK=CJ+6WkzE42FtCS-B2OCKug@mail.gmail.com>
In-Reply-To: <CAPC=aNUMKxVKuhAKtN4S-7z_CqK=CJ+6WkzE42FtCS-B2OCKug@mail.gmail.com>
From: Alex Davidson <alex.davidson92@gmail.com>
Date: Fri, 26 Jul 2019 10:22:17 +0100
Message-ID: <CAD5V+fOFCRCkQ5WdL9LiPLhZE2z1-n9=GMzV-Ty4fEMS643Vjg@mail.gmail.com>
To: ietf@jackgrigg.com
Cc: cfrg@irtf.org
Content-Type: multipart/alternative; boundary="000000000000c9b996058e9214dc"
Archived-At: <https://mailarchive.ietf.org/arch/msg/cfrg/7VzxA6kM1LkmFGZeVeGaDZSE13k>
Subject: Re: [Cfrg] Reviewing draft-irtf-cfrg-voprf-01
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: Fri, 26 Jul 2019 09:22:32 -0000

Hi Jack,

Thanks for your comments and for taking the time to read the latest version
of the draft; reply inlined.

On Thu, Jul 25, 2019 at 1:00 AM Jack Grigg <ietf@jackgrigg.com> wrote:

> Hi all,
>
> I've been looking at the VOPRF draft as part of my work on ristretto255,
> and have some comments which I hope will be of use to the CFRG.
>
> ---
>
> Section 4:
> > Let GG be an additive group of prime-order p, let GF(p) be the Galois
> field defined by the integers modulo p.
>
> Section 4.2:
> > As we remarked above, GG is a subgroup with associated prime-order p.
>
> These sections are inconsistent in defining GG as a group vs a subgroup
> (section 4.2 is the first mention of the latter).
>

> > In the multiplicative setting we can choose GG to be a prime-order
> > subgroup of a finite field FF_p. For example, let p be some large
> > prime (e.g. > 2048 bits) where p = 2q+1 for some other prime q.
>
> This is confusing regarding naming of the primes. GG is defined to have
> order p; in this example, GG now has order q, while the base field has
> order p.
>

Agreed, these should be cleaned up.


> > There are also other settings where GG is a prime-order subgroup
> > of an elliptic curve over a base field of non-prime order, these
> > include the work of Ristretto [RISTRETTO] and Decaf [DECAF].
>
> Ristretto and Decaf are abstractions that define a prime-order group of
> elements, not a prime-order subgroup of points on a specific elliptic curve.
>
> If the intention is to solely refer to Ristretto and Decaf in this
> paragraph, I suggest rewording this (lifting wording from the ristretto255
> introduction) as:
>
> > There are also other settings where GG is a prime-order group
> > constructed from non-prime-order elliptic curves, using techniques
> > such as Ristretto [RISTRETTO] and Decaf [DECAF].
>
> If the intention is to also include elliptic curves with prime-order
> subgroups and cofactors, I suggest rewording this as:
>
> > There are also other settings where GG is a prime-order subgroup
> > of an elliptic curve over a base field of non-prime order (such as
> > edwards25519 [RFC7748]), or where GG is a prime-order group
> > constructed from non-prime-order elliptic curves (using techniques
> > such as Ristretto [RISTRETTO] and Decaf [DECAF]).
>
> It would be generally useful to refactor section 4.2 to be clear that GG
> is assumed to be a group of prime-order p, and then be explicit about when
> (in examples or otherwise) this group is a subgroup of a larger group with
> prime or non-prime order.
>

I think the latter description is probably the most informative. I agree
that assuming that GG is of prime order p throughout is the best course of
action. The intention of the draft is to be as generic as possible (i.e. to
be agnostic to the instantiation of the prime-order group). We should only
really demand specificity when instantiating the construction in the
elliptic curve setting, and I think that the changes you have proposed here
help to achieve that.


>
> ---
>
> Section 4.3:
> > 1. P samples a uniformly random key k <- {0,1}^l for sufficient
> >    length l, and interprets it as an integer.
>
> Section 4.3.1:
> > l: Some suitable choice of key-length (e.g. as described in [NIST]).
>
> This definition feels less clear than something like "P samples a key
> uniformly from GF(p)". Particularly given the NIST reference, it appears to
> imply that greater security can be obtained by choosing a longer key, while
> in practice the security is bounded by the size of the group GG. I suggest
> making the modular reduction (applied to the key) explicit in OPRF_Setup,
> instead of being tucked away in bin2scalar. Perhaps "and interprets it as
> an integer modulo p" would suffice?
>

Agreed, I think replacing the first with "P samples a key uniformly from
GF(p)" is probably the easiest way, and then just remove the notion of
sampling k as a binary string altogether?


>
> ---
>
> Section 5.1:
> > H_3: A hash function from GG to {0,1}^L, modelled as a random oracle.
>
> Judging from the later definition of H_4, and looking at how H_3 is used,
> I suspect this is intended to be:
>
> > H_3: A hash function from GG^6 to {0,1}^L, modelled as a random oracle.
>

+1


>
> ---
>
> Section 7.2 defines an instantiation of VOPRF using ristretto255 as
> follows:
>
> > 7.2. ECVOPRF-RISTRETTO-HKDF-SHA512-Elligator2:
> >    o GG: Ristretto [RISTRETTO]
> >    o H_1: H2C-Curve25519-SHA512-Elligator2-Clear
> [I-D.irtf-cfrg-hash-to-curve]
> >       * label: voprf_h2c
> >    o H_2: SHA512
> >    o H_3: SHA512
> >    o H_4: SHA512
> >    o H_5: HKDF-Expand-SHA512
> > In the case of Ristretto, internal point representations are represented
> by
> > Ed25519 [RFC7748] points. As a result, we can use the same hash-to-curve
> > encoding as we would use for Ed25519 [I-D.irtf-cfrg-hash-to-curve].
>
> This directly conflicts with the VOPRF draft's normative reference to the
> ristretto255 draft, which states:
>
> > Implementations MUST NOT perform any other operation on internal
> > representations and MUST NOT construct group elements except via
> > "DECODE" and "FROM_UNIFORM_BYTES".
>
> Such an instantiation would breach the Ristretto abstraction, and in
> practice would not be compatible with ristretto255 implementations that use
> an alternative isomorphic curve instead of edwards25519.
>
> EDIT: While I was typing these comments up, a new revision of the VOPRF
> draft was published that alters section 7.2 to:
>
> > 7.2. ECVOPRF-ed25519-HKDF-SHA256-Elligator2:
> >    o GG: Ristretto255
> >    o H_1: edwards25519-SHA256-EDELL2-RO
> >       * label: voprf_h2c
> >    o H_2: SHA256
> >    o H_3: SHA256
> >    o H_4: SHA256
> >    o H_5: HKDF-Expand-SHA256
>
> This retains the above problem, and it is now unclear from the name
> whether this is an instantiation on ristretto255 or edwards25519. The two
> are of course incompatible (the encoding of ristretto255 elements is not
> equivalent to the encoding used for edwards25519 points).
>
> I suggest using the following instantiation and text for a
> ristretto255-based ECVOPRF:
>
> > ECVOPRF-ristretto255-HKDF-SHA256:
> >    o GG: ristretto255
> >    o H_1: ristretto255.FROM_UNIFORM_BYTES(SHA512)
> >    o H_2: SHA256
> >    o H_3: SHA256
> >    o H_4: SHA256
> >    o H_5: HKDF-Expand-SHA256
> >
> > The Ristretto API provides a FROM_UNIFORM_BYTES function
> > for mapping a 64-byte input to a ristretto255 element, suitable for
> > hash-to-group operations. To satisfy the arbitrary input requirement
> > of H_1, we hash the arbitrary input x with SHA512 to obtain 64 bytes,
> > then use this as the input to FROM_UNIFORM_BYTES.
>

Judging by the conversation in the thread on draft-irtf-cfrg-hash-to-curve,
I'm reticent to address this until some consensus has been achieved on how
encoding bytes as points in Ristretto is achieved. In particular, I
personally think it would be preferable if the Ristretto API included some
function that allowed mapping any (potentially non-uniformly distributed)
bytes to the curve. This would eliminate having to define an extra
unspecified hash function evaluation at the OPRF level.

In general, the OPRF construction is defined for all valid inputs; the only
security that we require is that the h2c mapping is one-way. If we define
H_1 in this way, then it would appear that we have to consider a different
security analysis for every instantiation of
ristretto255.FROM_UNIFORM_BYTES(H(x)) where H is whatever hash function
that you want to choose. If there was a way of mapping bytes of any
distribution to Ristretto, then we can analyse the security of H_1
independently of the OPRF construction.


>
> ---
>
> I'm happy to contribute a patch addressing these points.
>

Please do contribute a patch for the changes that you have proposed, I will
be happy to review it.

Thanks,
Alex


> Cheers,
> Jack
> _______________________________________________
> Cfrg mailing list
> Cfrg@irtf.org
> https://www.irtf.org/mailman/listinfo/cfrg
>