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

TSS Library: Define and create a Test Plan #14134

Closed
Tracked by #13316 ...
mxtartaglia-sl opened this issue Jul 3, 2024 · 5 comments
Closed
Tracked by #13316 ...

TSS Library: Define and create a Test Plan #14134

mxtartaglia-sl opened this issue Jul 3, 2024 · 5 comments
Assignees
Labels
Platform Tickets pertaining to the platform

Comments

@mxtartaglia-sl
Copy link
Contributor

mxtartaglia-sl commented Jul 3, 2024

This task aims to define the testing plan for assuring the quality of the project's cryptographic components.

Goals:

Since cryptographic code is often difficult to test, we should design our test cases based on the cryptographic properties that these implementations should satisfy.

  • Identify other properties to test
  • Define how to test.
  • Define Test structure: Different project, same project?

Proposed tests

Pairings Keys

  • Generation of Private and Public Key Pairs: This test measures the correctness of key pair generation by having the implementation under test produce 10 key pairs. The private key provided is used to compute the public key, Q’. The calculated value Q’ is then compared to the supplied public key, Q.

What should the comparison check?

  • Public Key Validation: Generate 12 key pairs, modify some public keys to introduce errors, and verify that we can detect those errors.

Pairings Signatures

  • Signature Generation: Ten preconfigured known messages per curve supported are supplied. Generate a signature for each message. The message, public key, and signature components are returned. The signatures are compared against previous known signatures.
  • Signature Verification: For each curve supported, 15 pseudorandom messages, a public key, Q, and a signature component (r, s) are supplied. Modify some of the provided values and verify that signature verification fails.

Pairings

  • How to validate operations? Compare against known results?

TSS

  • Encrypted TssMessage
    The private key can decrypt the intended recipient’s parts and no others.
  • Detection of invalid TssMessage
    -> Different polynomial commitment
    -> Different PaticipantDictionary
    -> Detection of invalid proof
  • Aggregation of TssMessage
    -> An aggregated private share has the same length of its original source
    -> An aggregated private share is different from its original source
    -> Threshold number of messages can produce a valid public key
    -> Public key does not change when rehasing
  • Aggregated Signatures
    -> Unforgeability of group signature:
    Less than threshold number of signatures cannot produce a valid aggregated signature
    More than threshold number of signatures can produce a valid aggregated signature
    -> Fixed length of threshold signature. Our scheme ensures that the size of a threshold signature is fixed (i.e., not depending on the number of signers).

Other tests mentioned in the bibliography that might apply for the TssMessage generation:

  • Bit Contribution for Key Test
  • Bit Contribution for Nonce Test
  • Bit Contribution for Plaintext Test
  • Bit Exclusion Test
  • Ciphertext Length Check Test

EVM

  • a stored signature can be retrieved correctly
  • a stored public key can be retrieved correctly
  • a valid TSS signature can be correctly validated.
  • an invalid TSS signature can be correctly detected.
  • Efficiency of verification.

Material:

@mxtartaglia-sl mxtartaglia-sl changed the title Define and create a Test Plan Define and create a Test Plan for the TSS-Library project Jul 3, 2024
@mxtartaglia-sl mxtartaglia-sl changed the title Define and create a Test Plan for the TSS-Library project Define and create a Test Plan for the TSS Library project Jul 3, 2024
@mxtartaglia-sl mxtartaglia-sl added the Platform Tickets pertaining to the platform label Jul 3, 2024
@mxtartaglia-sl mxtartaglia-sl changed the title Define and create a Test Plan for the TSS Library project TSS Library: Define and create a Test Plan Jul 3, 2024
@mxtartaglia-sl
Copy link
Contributor Author

In the TSS-Library, the operations that rely on a source of randomness are:

  • Proof Creation for the TssMessage.
  • Creation of the ciphertext for the TssMessage.

As for the operations that rely on order:

  • decryptPrivateShares: relies on the order of the TssMessages
  • aggregatePrivateShares: relies on the order of the shares
  • computePublicShares: relies on the order of the TssMessages.

In Pairings-Signature-Library, the creation of the private key depends on a random value.

@mxtartaglia-sl mxtartaglia-sl modified the milestone: v0.54 Aug 7, 2024
@mxtartaglia-sl mxtartaglia-sl self-assigned this Aug 7, 2024
@mxtartaglia-sl
Copy link
Contributor Author

@lpetrovic05
Copy link
Member

@mxtartaglia-sl It seems I cannot comment in the doc, so I will leave my comments here:

Measure the time taken for pairings, group operations, and field operations. → what are the performance parameters to compare against? What do we do with the results?

I would say we should have a JMH performance test at the top level. So generate shares, aggregate signatures and so on. What I have been doing with JMH results is just adding them to the class as a comment. I think these results should give us an idea about how long certain tasks take, how many shares can we practically support etc.

@edward-swirldslabs
Copy link
Contributor

I'm in favor of prioritizing the complex algorithmic tests and leaving the functionality tests of basic algebraic operations till the vary end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform Tickets pertaining to the platform
Projects
None yet
Development

No branches or pull requests

3 participants