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

Define Output that is analogous to Input #6

Closed
briansmith opened this issue Nov 14, 2016 · 0 comments
Closed

Define Output that is analogous to Input #6

briansmith opened this issue Nov 14, 2016 · 0 comments

Comments

@briansmith
Copy link
Owner

briansmith commented Nov 14, 2016

There are two concepts:

  1. We have to write a fixed-length buffer of a certain size, ensuring that we write the entire buffer. This is the case for RSA signature generation, fixed-length ECDSA signature generation, ECDH, X25519, Ed25519 signing, and other things. In this case, we may have Output::from(&mut [u8]) and then we need to ensure that every byte in the buffer is written at least once, from start to finish.

  2. We have to write a variable-length buffer of a certain maximum length, and the writer will return how many bytes (less than or equal to the maximum) were actually written. This is the case for ASN.1 ECDSA signature generation, extracting an encoded RSA public key from a private key, and other things. Again, the interface should guarantee that every byte of the output is written at least once.

Hopefully we can define an interface with a lot of commonality between the two use cases. Maybe we'd have a write_all() that is analogous to read_all() for first first case and a write_partial() for the second case. Not sure yet.

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

No branches or pull requests

1 participant