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

Prio3: Improve domain separation for multi-proof mode #309

Merged
merged 1 commit into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions draft-irtf-cfrg-vdaf.md
Original file line number Diff line number Diff line change
Expand Up @@ -2608,7 +2608,7 @@ def helper_proofs_share(Prio3, agg_id, k_share):
Prio3.Flp.Field,
k_share,
Prio3.domain_separation_tag(USAGE_PROOF_SHARE),
byte(agg_id),
byte(Prio3.PROOFS) + byte(agg_id),
cjpatton marked this conversation as resolved.
Show resolved Hide resolved
Prio3.Flp.PROOF_LEN * Prio3.PROOFS,
)

Expand All @@ -2624,7 +2624,7 @@ def prove_rands(Prio3, k_prove):
Prio3.Flp.Field,
k_prove,
Prio3.domain_separation_tag(USAGE_PROVE_RANDOMNESS),
b'',
byte(Prio3.PROOFS),
Prio3.Flp.PROVE_RAND_LEN * Prio3.PROOFS,
)

Expand All @@ -2633,7 +2633,7 @@ def query_rands(Prio3, verify_key, nonce):
Prio3.Flp.Field,
verify_key,
Prio3.domain_separation_tag(USAGE_QUERY_RANDOMNESS),
nonce,
byte(Prio3.PROOFS) + nonce,
Prio3.Flp.QUERY_RAND_LEN * Prio3.PROOFS,
)

Expand All @@ -2654,12 +2654,11 @@ def joint_rand_seed(Prio3, k_joint_rand_parts):

def joint_rands(Prio3, k_joint_rand_seed):
"""Derive the joint randomness from its seed."""
binder = b'' if Prio3.PROOFS == 1 else byte(Prio3.PROOFS)
return Prio3.Xof.expand_into_vec(
Prio3.Flp.Field,
k_joint_rand_seed,
Prio3.domain_separation_tag(USAGE_JOINT_RANDOMNESS),
binder,
byte(Prio3.PROOFS),
Prio3.Flp.JOINT_RAND_LEN * Prio3.PROOFS,
)
~~~
Expand Down
9 changes: 4 additions & 5 deletions poc/vdaf_prio3.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ def helper_proofs_share(Prio3, agg_id, k_share):
Prio3.Flp.Field,
k_share,
Prio3.domain_separation_tag(USAGE_PROOF_SHARE),
byte(agg_id),
byte(Prio3.PROOFS) + byte(agg_id),
Prio3.Flp.PROOF_LEN * Prio3.PROOFS,
)

Expand All @@ -318,7 +318,7 @@ def prove_rands(Prio3, k_prove):
Prio3.Flp.Field,
k_prove,
Prio3.domain_separation_tag(USAGE_PROVE_RANDOMNESS),
b'',
byte(Prio3.PROOFS),
Prio3.Flp.PROVE_RAND_LEN * Prio3.PROOFS,
)

Expand All @@ -328,7 +328,7 @@ def query_rands(Prio3, verify_key, nonce):
Prio3.Flp.Field,
verify_key,
Prio3.domain_separation_tag(USAGE_QUERY_RANDOMNESS),
nonce,
byte(Prio3.PROOFS) + nonce,
Prio3.Flp.QUERY_RAND_LEN * Prio3.PROOFS,
)

Expand All @@ -352,12 +352,11 @@ def joint_rand_seed(Prio3, k_joint_rand_parts):
@classmethod
def joint_rands(Prio3, k_joint_rand_seed):
"""Derive the joint randomness from its seed."""
binder = b'' if Prio3.PROOFS == 1 else byte(Prio3.PROOFS)
return Prio3.Xof.expand_into_vec(
Prio3.Flp.Field,
k_joint_rand_seed,
Prio3.domain_separation_tag(USAGE_JOINT_RANDOMNESS),
binder,
byte(Prio3.PROOFS),
Prio3.Flp.JOINT_RAND_LEN * Prio3.PROOFS,
)

Expand Down