-
Notifications
You must be signed in to change notification settings - Fork 346
Upgrade dependencies #94
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
Changes from all commits
2f1cae6
a12b805
ec32138
3211536
3e35dd2
13933d8
81786c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -444,23 +444,12 @@ pub fn try_sapling_compact_note_decryption( | |
| let shared_secret = sapling_ka_agree(ivk, epk); | ||
| let key = kdf_sapling(shared_secret, &epk); | ||
|
|
||
| // Prefix plaintext with 64 zero-bytes to skip over Poly1305 keying output | ||
| const CHACHA20_BLOCK_SIZE: usize = 64; | ||
| let mut plaintext = [0; CHACHA20_BLOCK_SIZE + COMPACT_NOTE_SIZE]; | ||
| plaintext[CHACHA20_BLOCK_SIZE..].copy_from_slice(&enc_ciphertext[0..COMPACT_NOTE_SIZE]); | ||
| assert_eq!( | ||
| ChaCha20Ietf::cipher() | ||
| .decrypt( | ||
| &mut plaintext, | ||
| CHACHA20_BLOCK_SIZE + COMPACT_NOTE_SIZE, | ||
| key.as_bytes(), | ||
| &[0u8; 12], | ||
| ) | ||
| .ok()?, | ||
| CHACHA20_BLOCK_SIZE + COMPACT_NOTE_SIZE | ||
| ); | ||
| // Start from block 1 to skip over Poly1305 keying output | ||
| let mut plaintext = [0; COMPACT_NOTE_SIZE]; | ||
| plaintext.copy_from_slice(&enc_ciphertext); | ||
| ChaCha20Ietf::xor(key.as_bytes(), &[0u8; 12], 1, &mut plaintext); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm assuming the 3rd argument is the signifier of which block to start from instead of prefixing with a 'block' of zero bytes?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct. See RFC 7539 section 2.8 for details. |
||
|
|
||
| parse_note_plaintext_without_memo(ivk, cmu, &plaintext[CHACHA20_BLOCK_SIZE..]) | ||
| parse_note_plaintext_without_memo(ivk, cmu, &plaintext) | ||
| } | ||
|
|
||
| /// Recovery of the full note plaintext by the sender. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything else LGTM but I'm curious what prompted this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also there is no longer an
assert, that's fine yes?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #69 (comment) for the context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And yes, there's no longer an assert because
ChaCha20Ietf::xormutates in-place and doesn't return anything.