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

Use algorithm for ECDH that is described in the specification #724

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions protocols/v2/noise-sv2/src/handshake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,13 @@ pub trait HandshakeOp<Cipher: AeadCipher>: CipherState<Cipher> {
fn ecdh(private: &[u8], public: &[u8]) -> [u8; 32] {
let private = SecretKey::from_slice(private).expect("Wrong key");
let x_public = XOnlyPublicKey::from_slice(public).expect("Wrong key");
let res = SharedSecret::new(&x_public.public_key(crate::PARITY), &private);
res.secret_bytes()
let ec_point_x_y = secp256k1::ecdh::shared_secret_point(
&x_public.public_key(secp256k1::Parity::Even),
&private,
);
let mut ec_point_x = [0; 32];
ec_point_x.copy_from_slice(&ec_point_x_y[0..32]);
ec_point_x
}

/// Prior to starting first round of NX-handshake, both initiator and responder initializes
Expand Down
Loading