Skip to content

Add a method to get session secret for onion packet to KeysInterface #260

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

Merged
merged 1 commit into from
Nov 27, 2018

Conversation

yuntai
Copy link
Contributor

@yuntai yuntai commented Nov 26, 2018

@TheBlueMatt
Copy link
Collaborator

Nice, looks good, need to get implemented in full_stack_target, though.

@yuntai
Copy link
Contributor Author

yuntai commented Nov 26, 2018

oops. fixed.

Copy link
Collaborator

@TheBlueMatt TheBlueMatt left a comment

Choose a reason for hiding this comment

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

Please squash commits so we dont have intermediary commits that don't build.


fn get_session_key(&self) -> SecretKey {
let child_ix = self.session_child_index.fetch_add(1, Ordering::AcqRel);
self.session_master_key.ckd_priv(&self.secp_ctx, ChildNumber::from_hardened_idx(child_ix as u32)).expect("Your RNG is busted").secret_key
Copy link
Collaborator

Choose a reason for hiding this comment

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

Oops, sorry, this isnt sufficient as it'll wrap back to 0 on restart and we'll re-use session keys. Can you hash in the timestamp like we do for channel keys? I'm not too worried about needing extra rng output, here, though.

@@ -265,6 +265,10 @@ impl KeysInterface for KeyProvider {
}
}
}

fn get_session_key(&self) -> SecretKey {
SecretKey::from_slice(&Secp256k1::without_caps(), &[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]).unwrap()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Oops, please avoid changing the keys used in things in the fuzz targets. You can just take TheBlueMatt@5a82977, I think.

@yuntai
Copy link
Contributor Author

yuntai commented Nov 26, 2018

updated. not sure ...expect("RNG is busted") is correct things to print out

@TheBlueMatt
Copy link
Collaborator

Looks good, sans the compile error that broke travis.

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.

2 participants