happy clippy

This commit is contained in:
dignifiedquire 2022-12-09 15:36:55 +01:00
parent 50dc19b389
commit fa9e16e938
2 changed files with 4 additions and 4 deletions

View file

@ -25,12 +25,12 @@ use x25519_dalek::EphemeralSecret;
use x25519_dalek::PublicKey;
fn bench_diffie_hellman(c: &mut Criterion) {
let bob_secret = EphemeralSecret::new(&mut OsRng);
let bob_secret = EphemeralSecret::new(OsRng);
let bob_public = PublicKey::from(&bob_secret);
c.bench_function("diffie_hellman", move |b| {
b.iter_with_setup(
|| EphemeralSecret::new(&mut OsRng),
|| EphemeralSecret::new(OsRng),
|alice_secret| alice_secret.diffie_hellman(&bob_public),
)
});

View file

@ -120,7 +120,7 @@ impl ReusableSecret {
/// Perform a Diffie-Hellman key agreement between `self` and
/// `their_public` key to produce a [`SharedSecret`].
pub fn diffie_hellman(&self, their_public: &PublicKey) -> SharedSecret {
SharedSecret(&self.0 * their_public.0)
SharedSecret(self.0 * their_public.0)
}
/// Generate a non-serializeable x25519 [`ReuseableSecret`] key.
@ -166,7 +166,7 @@ impl StaticSecret {
/// Perform a Diffie-Hellman key agreement between `self` and
/// `their_public` key to produce a `SharedSecret`.
pub fn diffie_hellman(&self, their_public: &PublicKey) -> SharedSecret {
SharedSecret(&self.0 * their_public.0)
SharedSecret(self.0 * their_public.0)
}
/// Generate an x25519 key.