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

Support tagged ZIP 32 child derivation #7

Merged
merged 4 commits into from
Feb 20, 2025

Conversation

daira
Copy link
Collaborator

@daira daira commented Feb 12, 2025

No description provided.

@daira daira requested a review from str4d February 12, 2025 17:34
(for tagged ZIP 32 child derivation).

Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
@daira daira force-pushed the add-prfexpand-with-tag branch from ae219c7 to 0d3f591 Compare February 13, 2025 02:25
@daira daira requested a review from nuttycom February 13, 2025 03:15
@daira daira requested a review from nuttycom February 17, 2025 21:57
nuttycom
nuttycom previously approved these changes Feb 17, 2025
Copy link
Collaborator

@nuttycom nuttycom left a comment

Choose a reason for hiding this comment

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

utACK b9c2120

Comment on lines 125 to 121
match lead {
None => self.apply(c_par, &[sk_par, i, tag]),
Some(b) => self.apply(c_par, &[sk_par, i, &[b], tag]),
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

zcash/zips#978 says that the input to PRF^Expand is sk_par || i if lead == 0 && tag.is_empty(). Here if lead = None then the tag still gets appended. We should instead do something like lead.unwrap_or(0) and then the full check.

Co-authored-by: Jack Grigg <jack@electriccoin.co>
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
@daira daira force-pushed the add-prfexpand-with-tag branch from a07c889 to a0d5af6 Compare February 17, 2025 23:47
of `PrfExpand` (e.g. the `zip32` crate).

Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
pub const REGISTERED_ZIP32_CHILD: Self = Self::new(0xAC);

/// Expands the given secret key in this domain.
pub fn with(self, sk: &[u8], a: &[u8; 32], b: &[u8; 4], c: Option<(u8, &[u8])>) -> [u8; 64] {
Copy link
Collaborator

@nuttycom nuttycom Feb 19, 2025

Choose a reason for hiding this comment

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

Is it intended that Some((0, &[])) be a valid input to this function?

Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
@daira daira force-pushed the add-prfexpand-with-tag branch from 201d5e6 to 997bf72 Compare February 19, 2025 21:55
Copy link
Collaborator

@nuttycom nuttycom left a comment

Choose a reason for hiding this comment

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

utACK 997bf72

Copy link
Collaborator

@str4d str4d left a comment

Choose a reason for hiding this comment

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

utACK 997bf72

@nuttycom nuttycom merged commit a1b6c25 into zcash:main Feb 20, 2025
10 checks passed
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.

3 participants