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

Simplify ChaCha20 interface #2990

Merged
merged 2 commits into from
Sep 10, 2019
Merged

Simplify ChaCha20 interface #2990

merged 2 commits into from
Sep 10, 2019

Conversation

martinthomson
Copy link
Member

The nonce can just be opaque bytes.

The block counter is tricky, as noted in the issue. The "obvious"
choice is little-endian, as that is consistent with the philosophy of
the designer (as I understand it), but that is not anything more than a
guess.

Absent strong evidence that big-endian is a better choice, I'm going to
err on the side of not making a substantive change here. But I think
that we need a consensus call to support that viewpoint.

Closes #2171.

The nonce can just be opaque bytes.

The block counter is tricky, as noted in the issue.  The "obvious"
choice is little-endian, as that is consistent with the philosophy of
the designer (as I understand it), but that is not anything more than a
guess.

Absent strong evidence that big-endian is a better choice, I'm going to
err on the side of not making a substantive change here.  But I think
that we need a consensus call to support that viewpoint.

Closes #2171.
@martinthomson martinthomson added editorial An issue that does not affect the design of the protocol; does not require consensus. -tls labels Aug 26, 2019
used as the nonce.
in little-endian order and are used as the block count; a ChaCha20
implementation might instead take the 4 bytes as an opaque sequence of bytes.
The remaining 12 bytes are used as the nonce.
Copy link
Member

Choose a reason for hiding this comment

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

While I like the idea of providing practical advice, I am a bit concerned of dropping the text that state the format of input in terms of specification language (in this case RFC 7539).

RFC 7539 assumes that the nonce to be three uint32 values. Is it possible to provide a formal definition without describing the interaction with that design? In practice, I think that the new text does not read good when the user is using a Chacha20 implementation (used on a big endian machine) that in fact takes uint32 values as inputs (rather than octets).

To reiterate, I think that it might be better preserve the existing text, at the same time "adding" implementation advice when using a Chacha20 function that takes octets as input.

Copy link
Member

@kazuho kazuho left a comment

Choose a reason for hiding this comment

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

I like the updated text. It reads good as it gives the practical advice first, then amends that with the formal definition.

@martinthomson martinthomson merged commit 519148f into master Sep 10, 2019
@martinthomson martinthomson deleted the chacha-simple branch September 10, 2019 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-tls editorial An issue that does not affect the design of the protocol; does not require consensus.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ChaCha inputs
4 participants