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

Elliptic curve point serialization and FROST group commitment encoding #5

Merged
merged 8 commits into from
Dec 18, 2023

Conversation

pdyraga
Copy link
Member

@pdyraga pdyraga commented Dec 15, 2023

This PR implements code for serializing elliptic curve points and implements FROST group commitment encoding needed in round 2 of the protocol.

The functions serializing and deserializing points expect to always return and accept slice of the same length that is specific to the curve implementation. This allows the FROST group commitment encoding to expect commitments always have a predictable length.

The functions allow to serialize elliptic curve point into bytes and
deserialize elliptic curve points from bytes. Given FROST requirements
during assembling group commitment, it is expected that serialized bytes
slice always have the same length.
This function implements section 4.3 of the [FROST] paper.

No unit tests were provided and three TODOs are listed in the
implementation. This commit should be interpreted as a draft that will
be improved in the next commits.
@pdyraga pdyraga requested a review from eth-r December 15, 2023 15:50
Checking if a point is not the identity element is the requirement of
the SerializeElement(A) function. This will be needed to implement
encoding of group commitments.
The parameter was unused and the signatures were conflicting with the
ones from the Ciphersuite interface.
Introduced validateGroupCommitment function called from
validateGroupCommitment that takes care of validating the
signer-provided commitments based on [FROST] requirements.

Two validations are done:
- None of the commitments is the identity element of the curve.
- The list of commitments is sorted in ascending order by signer
identifier.
@pdyraga pdyraga marked this pull request as ready for review December 18, 2023 15:07

// DeserializePoint deserializes byte slice to an elliptic curve point. The
// byte slice length must be equal to SerializedPointLength(). Otherwise,
// the function returns nil.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we also check that the deserialised points are valid points on the curve?

Copy link
Member Author

Choose a reason for hiding this comment

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

Addressed in #6.

Remember to check if point is on the curve.
Copy link
Contributor

@eth-r eth-r left a comment

Choose a reason for hiding this comment

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

Looks good.

@eth-r eth-r merged commit d3ba588 into main Dec 18, 2023
2 checks passed
@eth-r eth-r deleted the frost-2 branch December 18, 2023 16:15
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.

2 participants