Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move VOPRF into spec. #257

Merged
merged 18 commits into from
Jul 18, 2023
Merged

Move VOPRF into spec. #257

merged 18 commits into from
Jul 18, 2023

Conversation

dvorak42
Copy link
Collaborator

@dvorak42 dvorak42 commented May 25, 2023

This removes issuer protocol and moves some of the VOPRF serialization into the bikeshed spec.

Partially resolves #230.


Preview | Diff

This removes issuer protocol and moves some of the VOPRF serialization into the bikeshed spec.

Partially resolves #230.
@dvorak42 dvorak42 requested review from johannhof and aykutbulut May 25, 2023 16:26
Copy link

@colinbendell colinbendell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variance from voprf draft21 should generally be made more explicit. For places that might change (eg: the serialization of the nonces) we could offer recommendations such as:

const count = bytes.readInt(2);
// calculate blinded length to handle Ne=49 or legacy uncompressed (Ne=97)
const blindedLength = Math.round((bytes.length - 2) / count); 

for (let i = 0; i < count; i++) {
  const nonce = bytes.readBytes(blindedLength);
  ...

spec.bs Outdated Show resolved Hide resolved
spec.bs Show resolved Hide resolved
spec.bs Outdated
uint16 issued;
uint32 key_id = keyID;
SignedNonce signed[issued];
opaque proof<1..2^16-1>; // Length-prefixed form of DLEQProof.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should mention that the proof is a serialized Scalar of both values each of Ns

spec.bs Outdated Show resolved Hide resolved
spec.bs Outdated Show resolved Hide resolved
spec.bs Show resolved Hide resolved
spec.bs Outdated Show resolved Hide resolved
Copy link
Member

@johannhof johannhof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'd like @jyasskin to take a look at this to tell us if there's a better way to join bikeshed language and RFC language (the VOPRF Methods section).

Had some comments but I'll defer to Jeffrey to approve this :)

spec.bs Outdated

1. Let |unmaskOperation| be the Unmask operation corresponding to |issuerKeys|["protocol_version"].
1. Let |result| ([=list=] of byte strings) be the result of running |unmaskOperation| on |pretokens| and |response|.
1. Let |request| be a [=byte sequence=] consisting of |numTokens| encoded as a uint16.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I fully grok this. Is it bytes or uint16? Can you say a little bit more about what this is and why it's called "request" here? Maybe we should call these fields issueHeader and pretokens like in their later usage?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed and tried to clarify.

spec.bs Outdated Show resolved Hide resolved
spec.bs Outdated Show resolved Hide resolved
spec.bs Outdated Show resolved Hide resolved
@johannhof johannhof requested a review from jyasskin June 9, 2023 10:33
Copy link
Collaborator

@aykutbulut aykutbulut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with nit.

spec.bs Outdated Show resolved Hide resolved
dvorak42 and others added 2 commits June 13, 2023 09:19
Copy link
Member

@jyasskin jyasskin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick comments; I haven't looked at the whole patch in detail.

spec.bs Outdated Show resolved Hide resolved
spec.bs Outdated Show resolved Hide resolved
spec.bs Show resolved Hide resolved
dvorak42 and others added 2 commits June 14, 2023 09:42
Copy link
Member

@jyasskin jyasskin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't checked the details, but the interaction between bikeshed and RFCs looks pretty good.

spec.bs Show resolved Hide resolved
@@ -666,8 +773,9 @@ To <dfn>handle a redeem response</dfn>, given [=request=] |request| and [=respon

1. If |request|'s [=request/header list=] [=header list/contains|does not contain=] <a http-header>Sec-Private-State-Token</a>, return null.
1. If |response|'s [=response/header list=] [=header list/contains|does not contain=] <a http-header>Sec-Private-State-Token</a>, return a [=network error=].
1. Let |header| be the result of [=header list/get|getting=] <a http-header>Sec-Private-State-Token</a> from |response|'s [=response/header list=].
1. If |header| is empty, return null.
1. Let |rawHeader| be the result of [=header list/get|getting=] <a http-header>Sec-Private-State-Token</a> from |response|'s [=response/header list=].
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a step for the base64 decoding, unfortunately as currently implemented, this is just a base64 in a header and not the full structured header format.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh no, and simple base64 isn't forward compatible with the ':'-wrapped form used by structured field byte sequences. It'll parse as a Token instead.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aykutbulut Since you were looking at some of the structured header bits?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PST spec is incompatible with the RFC 8941 in its current form. Created #268 for this.

spec.bs Outdated Show resolved Hide resolved
spec.bs Outdated Show resolved Hide resolved
spec.bs Outdated
1. Let |blinds| be an empty [=list=].
1. Repeat the following steps, |numTokens| times:
1. Let |input| be an [=implementation-defined=] random value.
1. Let |result| ([=tuple=] ([=byte sequence=], [=byte sequence=])) be the result of running the [=Issue=] method, where the second element is encoded as a X9.62 uncompressed point.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What arguments get passed to [=Issue=]?

You can expand the result using the Infra syntax (|evaluatedElement|, |proof|) so you don't need the |result| variable.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be Blind, fixed and added arguments.

spec.bs Outdated
1. Set |issueRequest|["count"] to |numTokens|.
1. Let |blinds| be an empty [=list=].
1. Repeat the following steps, |numTokens| times:
1. Let |input| be an [=implementation-defined=] random value.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is |input| ever used? If it is, you need to say the type of the random value here, and you probably don't need to say it's [=implementation-defined=], unless each implementation is supposed to pick one random value and use it forever (https://xkcd.com/221/).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

spec.bs Outdated

This document encodes protocol messages in the TLS presentation language from section 3 of [[!RFC8446]].

For <dfn>Issue</dfn> (corresponding to [=BlindEvaluate=] function of the [[!VOPRF]] protocol), the <dfn>IssueRequest</dfn> and <dfn>IssueResponse</dfn> are serialized as:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's it mean for "Issue" to correspond to BlindEvaluate? Could you just have all the call sites call BlindEvaluate directly?

I also don't see obvious things in BlindEvaluate that would correspond to IssueRequest or IssueResponse. Are they just how we serialize things that'll eventually be passed to or from that algorithm?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarified the wording here, these are also the server-side steps so removed the Issue/Redeem function naming.

spec.bs Outdated Show resolved Hide resolved
spec.bs Show resolved Hide resolved
spec.bs Show resolved Hide resolved
spec.bs Outdated Show resolved Hide resolved
@@ -655,7 +760,8 @@ To <dfn>append private state token redemption request headers</dfn> given a [=/r
the issuer's most recent commitments.
1. Let |token| be the result of [=retrieve a token|retrieving a token=] for |issuer|.
1. If |token| is null, return.
1. Let |record| be the result of running a cryptographic redemption procedure with |token|. If the procedure fails, return.
1. Let |redeemRequest| be an empty [=RedeemRequest=].
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RedeemRequest is a struct. Does step mean with empty members?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

spec.bs Outdated Show resolved Hide resolved
Add serializing/deserializing step.
spec.bs Outdated

This document encodes protocol messages in the TLS presentation language from section 3 of [[!RFC8446]].

When the server is performing the [=BlindEvaluate=] function of the [[!VOPRF]] protocol, the input <dfn>IssueRequest</dfn> and output <dfn>IssueResponse</dfn> are serialized as:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The BlindEvaluate function in https://www.ietf.org/archive/id/draft-irtf-cfrg-voprf-21.html#name-voprf-protocol has a signature of

def BlindEvaluate(skS, pkS, blindedElement):

How does that correspond to the count and nonces[count] fields in IssueRequest?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comments on the correspondence.

spec.bs Outdated
} IssueResponse;
```

When the server is performing the [=Evaluate=] function of the [[!VOPRF]] protocol, the input <dfn>RedeemRequest</dfn> and output <dfn>RedeemResponse</dfn> are serialized as:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, Evaluate takes skS and input. While this is at least the same number of fields as in RedeemRequest, they have different names, so it's not clear they're supposed to match. Can you be clearer about how they map to each other?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comments and updated this to point at the PSTEvaluate version below.

spec.bs Outdated
```
struct {
uint32 key_id;
opaque nonce<nonce_size>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is nonce_size defined?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added it above along with G.

spec.bs Outdated
Comment on lines 271 to 272
uint16 count;
ECPoint nonces[count];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this equivalent to

Suggested change
uint16 count;
ECPoint nonces[count];
ECPoint nonces<0..65535>;

?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, though being able to refer to count separately from nonces is slightly useful from the original form.

spec.bs Show resolved Hide resolved
spec.bs Outdated Show resolved Hide resolved
Copy link
Member

@jyasskin jyasskin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll be out the rest of the week, so don't wait on me to re-review.

spec.bs Outdated Show resolved Hide resolved
spec.bs Outdated Show resolved Hide resolved
spec.bs Show resolved Hide resolved
spec.bs Outdated Show resolved Hide resolved
spec.bs Outdated Show resolved Hide resolved
spec.bs Outdated Show resolved Hide resolved
dvorak42 and others added 3 commits July 18, 2023 09:35
Co-authored-by: Jeffrey Yasskin <[email protected]>
Fix typos.
@dvorak42 dvorak42 merged commit 9dfaf87 into main Jul 18, 2023
github-actions bot added a commit that referenced this pull request Jul 18, 2023
SHA: 9dfaf87
Reason: push, by dvorak42

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
github-actions bot added a commit to aykutbulut/trust-token-api that referenced this pull request Aug 15, 2023
SHA: 9dfaf87
Reason: push, by aykutbulut

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Protocol specification is incomplete
5 participants