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

Ensure presence and correctness of validity checks #31

Closed
8 tasks done
piotr-roslaniec opened this issue Jan 9, 2023 · 16 comments
Closed
8 tasks done

Ensure presence and correctness of validity checks #31

piotr-roslaniec opened this issue Jan 9, 2023 · 16 comments
Assignees
Labels
Milestone

Comments

@piotr-roslaniec
Copy link

piotr-roslaniec commented Jan 9, 2023

Revise Ferveo's whitepaper and docs. List all validity checks for the protocol. Revise the source code and make sure that those checks are present, correct, and tested. Devise green- and red path scenarios.

List of checks:


  • Ciphertext Validity Checking - must be done before creating a decryption share
  • Validity checks #38

Screenshot 2023-01-16 at 10 20 03


Screenshot 2023-01-16 at 10 22 07

Screenshot 2023-01-16 at 11 06 47


ferveo:

  • verify_optimistic
    • Usage example
    • Already tested with positive and negative examples.
    • This one is effectively done, we just need to make sure we know what it does and whether we are happy with using it
@piotr-roslaniec piotr-roslaniec added this to the v0.1 milestone Jan 9, 2023
@theref
Copy link

theref commented Jan 16, 2023

  • Ciphertext Validity Checking - must be done before creating a decryption share
  • Validity checks #38

Screenshot 2023-01-16 at 10 20 03

tpke/src/iphertext.rs:

pub fn check_ciphertext_validity<E: PairingEngine>(
    c: &Ciphertext<E>,
    aad: &[u8],
) -> bool {
    let g_inv = E::G1Prepared::from(-E::G1Affine::prime_subgroup_generator());
    let hash_g2 = E::G2Prepared::from(construct_tag_hash::<E>(
        c.commitment,
        &c.ciphertext[..],
        aad,
    ));

    E::product_of_pairings(&[
        (E::G1Prepared::from(c.commitment), hash_g2),
        (g_inv, E::G2Prepared::from(c.auth_tag)),
    ]) == E::Fqk::one()
}

which is used by pub fn checked_decrypt and fn decrypt_with_shared_secret.

Also, in file tpke/src/api we have:

    pub fn to_decryption_share(&self) -> DecryptionShare {
        // TODO: Add verification steps

Verification is missing from this function.

@theref
Copy link

theref commented Jan 16, 2023

  • Verifying Decryption Shares - must be done before combining decryption shares

Screenshot 2023-01-16 at 10 22 07

Screenshot 2023-01-16 at 11 06 47

@theref
Copy link

theref commented Jan 16, 2023

  • We don't use weights, but the indexing is still important

Screenshot 2023-01-16 at 10 59 19

@theref
Copy link

theref commented Jan 16, 2023

  • Are we going to be aggregating decryption shares?

Screenshot 2023-01-16 at 11 08 48

@cygnusv
Copy link
Member

cygnusv commented Jan 16, 2023

  • Are we going to be aggregating decryption shares?
Screenshot 2023-01-16 at 11 08 48

No, my understanding is that this makes sense for Ferveo original implementation, where a node (with a single private blinding key ek_i) may have many private shares, and the corresponding decryption shares can be aggregated.

@theref
Copy link

theref commented Jan 16, 2023

yeah, i couldn't think of any scenario where it would make sense for our use case

@piotr-roslaniec piotr-roslaniec self-assigned this Jan 17, 2023
@piotr-roslaniec piotr-roslaniec mentioned this issue Jan 17, 2023
1 task
@piotr-roslaniec
Copy link
Author

piotr-roslaniec commented Jan 17, 2023

I found some other checks that I would like to document and verify.

Moved to issue description

@theref
Copy link

theref commented Jan 17, 2023

oh nice, these are from the code and we need to verify the maths?

@piotr-roslaniec
Copy link
Author

Yes, these are from the original Ferveo source code, and I'd like to figure out what they do, how to use them, whether we need them etc.

@piotr-roslaniec
Copy link
Author

piotr-roslaniec commented Jan 19, 2023

We don't use weights, but the indexing is still important

Marking as complete since ferveo validators have a share_index attributed to them.

Are we going to be aggregating decryption shares?

Marking as solved.

I've aggregated the remaining checks into the issue description.

@piotr-roslaniec
Copy link
Author

Not sure how to compute 4.4.4 for a simple tDec variant. In this variant, $D_i$ is of type Fqk (product of pairing), but we need to be G1Prepared for $e(D_i, B_i)$ to work.

@piotr-roslaniec
Copy link
Author

verify_blinding doesn't work i.e. the original code seems to be implemented incorrectly. I can't find a reference to this operation in the docs or in the whitepaper.

@cygnusv, is this something we would like to explore further, or should we drop verify_blinding?

@piotr-roslaniec
Copy link
Author

piotr-roslaniec commented Jan 20, 2023

If blinding_key, $B_i = [b] dk_i$, is the same as PublicKey::encryption_key of DKG validator, then verify_blinding in tpke is effectively the same check that verify_full in ferveo does:

  • $e(G_1, \hat{Y}{i,\omega_j}) = e(A_{i,\omega_j}, ek_i)$ verify_full
  • $e(g, Y_i) = e(A_i, [b] H)$, verify_blinding

If $B_i = [b] dk_i = b [H]$ doesn't hold, then I don't know what verify_blinding is supposed to check.

@piotr-roslaniec
Copy link
Author

piotr-roslaniec commented Jan 20, 2023

Not sure how to compute 4.4.4 for a simple tDec variant. In this variant, Di is of type Fqk (product of pairing), but we need to be G1Prepared for e(Di,Bi) to work.

The naive rewrite doesn't make sense here anyway, since in simple tDec decryption share is defined as $C_i=e(U,Z_i)$, and in fast tDec as $D_i=[b−1]U$.

Marking this as a candidate for a research item in #42

@piotr-roslaniec
Copy link
Author

Found this earlier rewrite of verify_blinding.

@piotr-roslaniec
Copy link
Author

Closing this as the work will be continued in separate issues mentioned in OP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Completed
Development

No branches or pull requests

3 participants