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/rsa: Rewrite serialization functions for KeyShare and SignShare #454

Open
wants to merge 1 commit into
base: tssRSAverif
Choose a base branch
from

Conversation

armfazh
Copy link
Contributor

@armfazh armfazh commented Aug 3, 2023

Use cryptoybyte to leverage TLS syntax. Serialization of KeyShare and SignShares.

Staked on top of #453

@armfazh armfazh changed the title tss/rsa: Rewrite serialization functions, tss/rsa: Rewrite serialization functions for KeyShare and SignShare Aug 3, 2023

// UnmarshalBinary recovers a value from a byte array.
// Returns an error if the recovered value is invalid.
// Any panic raised when calling to ReadValue is recovered and an error is returned instead.
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this helper function generically implements UnmarshalBinary if there is an implementation of ReadValue (which internally uses the cryptobyte package).

ok := v.ReadValue(&r)
if !ok {
return fmt.Errorf("cannot read %T from input string", v)
}
Copy link
Member

Choose a reason for hiding this comment

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

What if there are trailing bytes in data?

Copy link
Contributor Author

@armfazh armfazh Jan 23, 2024

Choose a reason for hiding this comment

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

it consumes only the data needed by the implementor, so this allows to do reading continuations in composed data structures. User can call Empty() to check for trailing data.

@bwesterb bwesterb self-requested a review January 3, 2024 12:26
Copy link
Member

@bwesterb bwesterb left a comment

Choose a reason for hiding this comment

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

See comments in previous review.

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.

None yet

2 participants