dalek-cryptography / x25519-dalek

X25519 elliptic curve Diffie-Hellman key exchange in pure-Rust, using curve25519-dalek.
BSD 3-Clause "New" or "Revised" License
326 stars 132 forks source link

Do you really need to borrow self here? #91

Closed BoisterousCoder closed 1 year ago

BoisterousCoder commented 1 year ago

https://github.com/dalek-cryptography/x25519-dalek/blob/53bb1a3989874ffe526a90fd225b5cb1c18f06c3/src/x25519.rs#L78

I am trying to use this function however my ephemeral key is a pointer and it has to be that way due to some other packages I am using. Is there a reason that the self on this line of code can't just be &self?

P.S, I am sorry if I did something wrong here. This is my first time submitting an issue on GitHub.

pinkforest commented 1 year ago

Yes it takes the ownership. Ephemeral secret key is supposed to be short lived and destroyed after.

There is a feature - reusable_secrets that takes a borrow