Skip to content

Clarify nonce size for onion cipher#849

Merged
Roasbeef merged 1 commit into
lightning:masterfrom
matheusd:onion-nonce-size
Mar 2, 2021
Merged

Clarify nonce size for onion cipher#849
Roasbeef merged 1 commit into
lightning:masterfrom
matheusd:onion-nonce-size

Conversation

@matheusd
Copy link
Copy Markdown
Contributor

Some ChaCha20 implementations API's support both 64- and 96-bit nonces, while
others only support a single one.

Functionally, both nonce sizes are equivalent for LN usage, since the
nonce is always zeroed. However, while evaluating spec compliance of
ChaCha20 libraries, the fact that some do not support the 8 byte nonce
variant prompted a closer investigation about the nonce requirement.

Since RFC8439 is the one linked to in the current BOLT0004 spec and that
RFC only specifies the 96-bit nonce variant, that requirement is made
more explicit by this commit.

Some ChaCha20 implementations API's support both 64- and 96-bit nonces, while
others only support a single one.

Functionally, both nonce sizes are equivalent for LN usage, since the
nonce is always zeroed. However, while evaluating spec compliance of
ChaCha20 libraries, the fact that some do not support the 8 byte nonce
variant prompted a closer investigation about the nonce requirement.

Since RFC8439 is the one linked to in the current BOLT0004 spec and that
RFC only specifies the 96-bit nonce variant, that requirement is made
more explicit by this commit.
Copy link
Copy Markdown
Collaborator

@t-bast t-bast left a comment

Choose a reason for hiding this comment

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

Good catch, ACK, we are indeed using 96-bit nonces.

@cdecker
Copy link
Copy Markdown
Collaborator

cdecker commented Mar 1, 2021

Oh nice one, we are using libsodium which takes 64bits, hence the implicit assumption in my writeup.

ACK

Copy link
Copy Markdown
Collaborator

@cfromknecht cfromknecht left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@Roasbeef Roasbeef merged commit 946bbeb into lightning:master Mar 2, 2021
@matheusd matheusd deleted the onion-nonce-size branch March 2, 2021 11:33
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.

5 participants